mirror of
https://github.com/BlueWallet/BlueWallet.git
synced 2025-02-22 23:08:07 +01:00
fix for legacy-wallet.fetchTransactions() to not crash when vout for transaction is missing addresses.
This commit is contained in:
parent
c70ba87195
commit
116f3ae4df
2 changed files with 16 additions and 1 deletions
|
@ -193,7 +193,7 @@ export class LegacyWallet extends AbstractWallet {
|
|||
}
|
||||
}
|
||||
for (let vout of tx.vout) {
|
||||
if (vout.scriptPubKey.addresses.indexOf(this.getAddress()) !== -1) {
|
||||
if (vout.scriptPubKey.addresses && vout.scriptPubKey.addresses.indexOf(this.getAddress()) !== -1) {
|
||||
// this TX is related to our address
|
||||
let clonedTx = Object.assign({}, tx);
|
||||
clonedTx.inputs = tx.vin.slice(0);
|
||||
|
|
|
@ -68,6 +68,21 @@ describe('LegacyWallet', function() {
|
|||
}
|
||||
});
|
||||
|
||||
it('can fetch TXs when addresses for vout are missing', async () => {
|
||||
// Transaction with missing address output https://www.blockchain.com/btc/tx/d45818ae11a584357f7b74da26012d2becf4ef064db015a45bdfcd9cb438929d
|
||||
let w = new LegacyWallet();
|
||||
w._address = '1PVfrmbn1vSMoFZB2Ga7nDuXLFDyJZHrHK';
|
||||
await w.fetchTransactions();
|
||||
|
||||
assert.ok(w.getTransactions().length > 0);
|
||||
for (let tx of w.getTransactions()) {
|
||||
assert.ok(tx.hash);
|
||||
assert.ok(tx.value);
|
||||
assert.ok(tx.received);
|
||||
assert.ok(tx.confirmations > 1);
|
||||
}
|
||||
});
|
||||
|
||||
it('can fetch UTXO', async () => {
|
||||
let w = new LegacyWallet();
|
||||
w._address = '12c6DSiU4Rq3P4ZxziKxzrL5LmMBrzjrJX';
|
||||
|
|
Loading…
Add table
Reference in a new issue