Fixed confirmations.

This commit is contained in:
Chris Kleeschulte 2017-11-01 16:00:39 -04:00
parent 8abb9fe4cf
commit baf75b2d60
No known key found for this signature in database
GPG Key ID: 33195D27EF6BDB7F
3 changed files with 5 additions and 3 deletions

View File

@ -278,7 +278,7 @@ AddressService.prototype.getAddressUnspentOutputs = function(address, options, c
amount: Unit.fromSatoshis(value.satoshis).toBTC(),
height: value.height,
satoshis: value.satoshis,
confirmationsFromCache: true
confirmations: self._block.getTip().height - value.height + 1
});
});

View File

@ -265,6 +265,8 @@ TransactionService.prototype._getTransaction = function(txid, options, callback)
tx = self._encoding.decodeTransactionValue(tx);
tx.confirmations = self._block.getTip().height - tx.__height + 1;
tx.__confirmations = self._block.getTip().height - tx.__height + 1;
tx.height = tx.__height;
tx.blockhash = tx.__blockhash;
callback(null, txid, tx, options);

View File

@ -177,7 +177,7 @@ describe('Address Service', function() {
value: encoding.encodeUtxoIndexValue(123, 120000, ts, tx.outputs[1].script.raw)
};
addressService._header = { getBestHeight: function() { return 150; } };
addressService._block = { getTip: function() { return { height: 150 }; } };
var txidStream = new EventEmitter();
@ -193,7 +193,7 @@ describe('Address Service', function() {
address: 'a',
amount: 0.0012,
height: 123,
confirmationsFromCache: true,
confirmations: 28,
satoshis: 120000,
scriptPubKey: '76a91449f8c749a9960dc29b5cbe7d2397cea7d26611bb88ac',
ts: 1546300800,