FIX: Fixed testing.

This commit is contained in:
Marcos Rodriguez Vélez 2018-10-01 01:24:34 -04:00
parent ca365a5615
commit c35dd1e426
2 changed files with 5 additions and 2 deletions

View File

@ -125,7 +125,7 @@ it('Segwit HD (BIP49) can fetch UTXO', async function() {
hd.usedAddresses = ['1Ez69SnzzmePmZX3WpEzMKTrcBF2gpNQ55', '1BiTCHeYzJNMxBLFCMkwYXNdFEdPJP53ZV']; // hacking internals
await hd.fetchUtxo();
assert.equal(hd.utxo.length, 9);
assert.ok(hd.utxo[0].confirmations);
assert.ok(typeof hd.utxo[0].confirmations === 'number');
assert.ok(hd.utxo[0].txid);
assert.ok(hd.utxo[0].vout);
assert.ok(hd.utxo[0].amount);
@ -283,6 +283,6 @@ it('can convert blockchain.info TX to blockcypher TX format', () => {
assert.ok(blockcyphertx.received); // time
assert.ok(blockcyphertx.hash);
assert.ok(blockcyphertx.value);
assert.ok(blockcyphertx.confirmations);
assert.ok(typeof blockcyphertx.confirmations === 'number');
assert.ok(blockcyphertx.outputs);
});

View File

@ -41,6 +41,9 @@ export class AbstractHDWallet extends LegacyWallet {
var clone = Object.assign({}, tx);
clone.received = new Date(clone.time * 1000).toISOString();
clone.outputs = clone.out;
if (clone.confirmations === undefined) {
clone.confirmations = 0;
}
for (let o of clone.outputs) {
o.addresses = [o.addr];
}