FIX: Reduced batchsize to prevent "undefined" error and allow viewing of transactions for these 2 wallet addresses: 34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo, 18rnfoQgGo1HqvVQaAN4QnxjYE7Sez9eca

This commit is contained in:
Matt Gurzenski 2020-05-19 16:45:54 -04:00
parent f62ee7dd91
commit 387a15f1ef
2 changed files with 21 additions and 15 deletions

View file

@ -339,7 +339,7 @@ module.exports.multiGetHistoryByAddress = async function(addresses, batchsize) {
};
module.exports.multiGetTransactionByTxid = async function(txids, batchsize, verbose) {
batchsize = batchsize || 61;
batchsize = batchsize || 40;
// this value is fine-tuned so althrough wallets in test suite will occasionally
// throw 'response too large (over 1,000,000 bytes', test suite will pass
verbose = verbose !== false;

View file

@ -67,21 +67,27 @@ describe('LegacyWallet', function() {
assert.ok(tx.confirmations > 1);
}
});
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.each([
['addresses for vout missing', '1PVfrmbn1vSMoFZB2Ga7nDuXLFDyJZHrHK'],
['txdatas were coming back null from BlueElectrum because of high batchsize', '34xp4vRoCGJym3xR7yCVPFHoCNxv4Twseo'],
])(
'can fetch TXs when %s',
async (useCase, address) => {
let w = new LegacyWallet();
w._address = address;
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);
}
},
240000,
);
it('can fetch UTXO', async () => {
let w = new LegacyWallet();