Skip to content

Commit

Permalink
FIX: skip faulty bip47 notification transactions
Browse files Browse the repository at this point in the history
  • Loading branch information
Overtorment committed Mar 17, 2023
1 parent accbb4d commit ba36dc6
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions class/wallets/abstract-hd-electrum-wallet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1487,6 +1487,14 @@ export class AbstractHDElectrumWallet extends AbstractHDWallet {
try {
const paymentCode = bip47_instance.getPaymentCodeFromRawNotificationTransaction(txHex);
if (this._sender_payment_codes.includes(paymentCode)) continue; // already have it

// final check if PC is even valid (could've been constructed by a buggy code, and our code would crash with that):
try {
BIP47Factory(ecc).fromPaymentCode(paymentCode);
} catch (_) {
continue;
}

this._sender_payment_codes.push(paymentCode);
this._next_free_payment_code_address_index[paymentCode] = 0; // initialize
this._balances_by_payment_code_index[paymentCode] = { c: 0, u: 0 };
Expand Down

0 comments on commit ba36dc6

Please sign in to comment.