tx-pool fixes.
This commit is contained in:
parent
39ecd292b3
commit
7a32e510e9
@ -140,8 +140,10 @@ TXPool.prototype.add = function add(tx, noWrite, strict) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Only add orphans if this input is ours.
|
// Only add orphans if this input is ours.
|
||||||
if (!this._wallet.ownInput(input))
|
if (input.output) {
|
||||||
continue;
|
if (!this._wallet.ownInput(input))
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// Add orphan, if no parent transaction is yet known
|
// Add orphan, if no parent transaction is yet known
|
||||||
orphan = { tx: tx, index: i };
|
orphan = { tx: tx, index: i };
|
||||||
@ -237,16 +239,19 @@ TXPool.prototype._storeTX = function _storeTX(hash, tx, noWrite) {
|
|||||||
|
|
||||||
TXPool.prototype._removeTX = function _removeTX(tx, noWrite) {
|
TXPool.prototype._removeTX = function _removeTX(tx, noWrite) {
|
||||||
var self = this;
|
var self = this;
|
||||||
|
var hash = tx.hash('hex');
|
||||||
var key;
|
var key;
|
||||||
|
|
||||||
for (var i = 0; i < tx.outputs.length; i++) {
|
for (var i = 0; i < tx.outputs.length; i++) {
|
||||||
key = tx.hash('hex') + '/' + i;
|
key = hash + '/' + i;
|
||||||
if (this._unspent[key]) {
|
if (this._unspent[key]) {
|
||||||
delete this._unspent[key];
|
delete this._unspent[key];
|
||||||
this._removeOutput(tx, i);
|
this._removeOutput(tx, i);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// delete this._all[hash];
|
||||||
|
|
||||||
if (!this._storage || noWrite)
|
if (!this._storage || noWrite)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -360,7 +365,7 @@ TXPool.prototype.getUnspent = function getUnspent(address) {
|
|||||||
return this._unspent[key];
|
return this._unspent[key];
|
||||||
}, this).filter(function(unspent) {
|
}, this).filter(function(unspent) {
|
||||||
if (address) {
|
if (address) {
|
||||||
if (!unspent.test(address) && !unspent.test(address))
|
if (!unspent.test(address))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user