Skip to content

Commit

Permalink
Merge pull request #388 from XLPeng57/#140-transfer-to-same-wallet
Browse files Browse the repository at this point in the history
fix: check if the sender wallet is the same as the receiver wallet
  • Loading branch information
Kpoke committed Aug 6, 2023
2 parents 9ddaf4e + 6d2826b commit 2a27d91
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/services/TransferService.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ class TransferService {
// begin transaction
try {
await this._session.beginTransaction();

if (transferBody.sender_wallet === transferBody.receiver_wallet) {
throw new HttpError(
422,
'Cannot transfer to the same wallet as the originating one!',
);
}

const walletSender = await this._walletService.getByIdOrName(
transferBody.sender_wallet,
);
Expand Down

0 comments on commit 2a27d91

Please sign in to comment.