mtx: coin selection - handle reorgd coinbases.

This commit is contained in:
Christopher Jeffrey 2016-12-18 02:54:01 -08:00
parent 82d1345311
commit c358a1b59e
No known key found for this signature in database
GPG Key ID: 8962AB9DE6666BBD

View File

@ -1562,6 +1562,14 @@ CoinSelector.prototype.isSpendable = function isSpendable(coin) {
if (this.height === -1)
return true;
if (coin.coinbase) {
if (coin.height === -1)
return false;
if (this.height + 1 < coin.height + maturity)
return false;
}
if (this.confirmations > 0) {
if (coin.height === -1)
return this.confirmations <= 0;
@ -1577,11 +1585,6 @@ CoinSelector.prototype.isSpendable = function isSpendable(coin) {
return false;
}
if (coin.coinbase) {
if (this.height + 1 < coin.height + maturity)
return false;
}
return true;
};