Fixed confirmations.
This commit is contained in:
parent
8abb9fe4cf
commit
baf75b2d60
@ -278,7 +278,7 @@ AddressService.prototype.getAddressUnspentOutputs = function(address, options, c
|
|||||||
amount: Unit.fromSatoshis(value.satoshis).toBTC(),
|
amount: Unit.fromSatoshis(value.satoshis).toBTC(),
|
||||||
height: value.height,
|
height: value.height,
|
||||||
satoshis: value.satoshis,
|
satoshis: value.satoshis,
|
||||||
confirmationsFromCache: true
|
confirmations: self._block.getTip().height - value.height + 1
|
||||||
});
|
});
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|||||||
@ -265,6 +265,8 @@ TransactionService.prototype._getTransaction = function(txid, options, callback)
|
|||||||
|
|
||||||
tx = self._encoding.decodeTransactionValue(tx);
|
tx = self._encoding.decodeTransactionValue(tx);
|
||||||
tx.confirmations = self._block.getTip().height - tx.__height + 1;
|
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;
|
tx.blockhash = tx.__blockhash;
|
||||||
|
|
||||||
callback(null, txid, tx, options);
|
callback(null, txid, tx, options);
|
||||||
|
|||||||
@ -177,7 +177,7 @@ describe('Address Service', function() {
|
|||||||
value: encoding.encodeUtxoIndexValue(123, 120000, ts, tx.outputs[1].script.raw)
|
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();
|
var txidStream = new EventEmitter();
|
||||||
|
|
||||||
@ -193,7 +193,7 @@ describe('Address Service', function() {
|
|||||||
address: 'a',
|
address: 'a',
|
||||||
amount: 0.0012,
|
amount: 0.0012,
|
||||||
height: 123,
|
height: 123,
|
||||||
confirmationsFromCache: true,
|
confirmations: 28,
|
||||||
satoshis: 120000,
|
satoshis: 120000,
|
||||||
scriptPubKey: '76a91449f8c749a9960dc29b5cbe7d2397cea7d26611bb88ac',
|
scriptPubKey: '76a91449f8c749a9960dc29b5cbe7d2397cea7d26611bb88ac',
|
||||||
ts: 1546300800,
|
ts: 1546300800,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user