Skip to content

Commit

Permalink
fix: check if the sender wallet is the same as the receiver wallet
Browse files Browse the repository at this point in the history
  • Loading branch information
xianglupeng committed Aug 6, 2023
1 parent 9ddaf4e commit 6d2826b
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 6d2826b

Please sign in to comment.