received and tx.verify.

This commit is contained in:
Christopher Jeffrey 2016-02-28 21:56:13 -08:00
parent 6b54897b57
commit 8d0f432c7a
2 changed files with 6 additions and 1 deletions

View File

@ -444,7 +444,7 @@ TXPool.prototype.getReceived = function getReceived(address) {
return this._addresses[address].received.clone();
return new bn(0);
}
return this._sent.clone();
return this._received.clone();
};
TXPool.prototype.getBalance = function getBalance(address) {

View File

@ -411,6 +411,11 @@ TX.prototype.verify = function verify(index, force, flags) {
if (this.isCoinbase())
return true;
if (this.getOutputValue().cmp(this.getInputValue()) > 0) {
utils.debug('TX is spending funds it does not have.');
return false;
}
return this.inputs.every(function(input, i) {
if (index != null && i !== index)
return true;