fixing outgoing balances
This commit is contained in:
parent
c955498f4d
commit
20fec9d17b
@ -188,10 +188,17 @@ BitcoreNode.prototype.getStatus = function() {
|
||||
peerCount: this.networkMonitor.getConnectedPeers(),
|
||||
version: pjson.version,
|
||||
network: bitcore.Networks.defaultNetwork.name,
|
||||
height: this.blockchain.getCurrentHeight(),
|
||||
height: this.getCurrentHeight(),
|
||||
});
|
||||
};
|
||||
|
||||
BitcoreNode.prototype.getCurrentHeight = function() {
|
||||
if (!this.blockchain) {
|
||||
return 0;
|
||||
}
|
||||
return this.blockchain.getCurrentHeight();
|
||||
};
|
||||
|
||||
BitcoreNode.prototype.getSyncProgress = function() {
|
||||
return !_.isUndefined(this.reportedMaxHeight) ?
|
||||
(this.blockchain.getCurrentHeight() / this.reportedMaxHeight) : 0;
|
||||
|
||||
@ -140,9 +140,12 @@ TransactionService.prototype._confirmInput = function(ops, block, transaction) {
|
||||
var self = this;
|
||||
var txid = transaction.id;
|
||||
return function(input, index) {
|
||||
if (input.prevTxId.toString('hex') === NULLTXHASH) {
|
||||
if (input.isNull()) {
|
||||
return Promise.resolve();
|
||||
}
|
||||
if (input.script.isPublicKeyHashIn()) {
|
||||
console.log(input.toObject());
|
||||
}
|
||||
ops.push({
|
||||
type: 'put',
|
||||
key: Index.getOutput(txid, index),
|
||||
@ -151,12 +154,13 @@ TransactionService.prototype._confirmInput = function(ops, block, transaction) {
|
||||
}))
|
||||
});
|
||||
var script = input.script;
|
||||
if (!(script.isPublicKeyHashIn() || script.isPublicKeyIn() || script.isScriptHashIn())) {
|
||||
if (!(script.isPublicKeyHashIn() || script.isScriptHashIn())) {
|
||||
return;
|
||||
}
|
||||
|
||||
return Promise.try(function() {
|
||||
var address = self._getAddressForInput(input);
|
||||
var address = input.script.toAddress();
|
||||
console.log('input address!', address.toString());
|
||||
if (address) {
|
||||
ops.push({
|
||||
type: 'put',
|
||||
@ -173,12 +177,6 @@ TransactionService.prototype._confirmInput = function(ops, block, transaction) {
|
||||
};
|
||||
};
|
||||
|
||||
TransactionService.prototype._getAddressForInput = function(input) {
|
||||
var script = input.script;
|
||||
// TODO: move this to bitcore
|
||||
return new bitcore.Script(script.chunks[script.chunks.length - 1]).toAddress();
|
||||
};
|
||||
|
||||
TransactionService.prototype._confirmTransaction = function(ops, block, transaction) {
|
||||
var self = this;
|
||||
ops.push({
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
"bluebird": "^2.9.12",
|
||||
"body-parser": "^1.12.0",
|
||||
"bufferput": "bitpay/node-bufferput",
|
||||
"buffertools": "*",
|
||||
"compression": "^1.4.1",
|
||||
"config": "^1.12.0",
|
||||
"cors": "^2.5.3",
|
||||
|
||||
Loading…
Reference in New Issue
Block a user