Fixed reentrant event
This commit is contained in:
parent
48a4e8b555
commit
48cbd01686
1 changed files with 7 additions and 2 deletions
|
|
@ -1549,6 +1549,8 @@ Wallet.prototype.removeTxWithSpentInputs = function(cb) {
|
||||||
if (inputs.length === 0)
|
if (inputs.length === 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
var proposalsChanged = false;
|
||||||
this.blockchain.getUnspent(this.getAddressesStr(), function(err, unspentList) {
|
this.blockchain.getUnspent(this.getAddressesStr(), function(err, unspentList) {
|
||||||
if (err) return cb(err);
|
if (err) return cb(err);
|
||||||
|
|
||||||
|
|
@ -1560,12 +1562,15 @@ Wallet.prototype.removeTxWithSpentInputs = function(cb) {
|
||||||
|
|
||||||
inputs.forEach(function (input) {
|
inputs.forEach(function (input) {
|
||||||
if (!input.unspent) {
|
if (!input.unspent) {
|
||||||
|
proposalsChanged = true;
|
||||||
self.txProposals.deleteOne(input.ntxid);
|
self.txProposals.deleteOne(input.ntxid);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
self.emit('txProposalsUpdated');
|
if (proposalsChanged) {
|
||||||
self.store();
|
self.emit('txProposalsUpdated');
|
||||||
|
self.store();
|
||||||
|
}
|
||||||
|
|
||||||
cb(null);
|
cb(null);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue