Skip to content

Commit

Permalink
bug fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
12henry committed Jul 24, 2018
1 parent c29a124 commit ed25ecd
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions src/validation.cpp
Expand Up @@ -3187,6 +3187,19 @@ bool CChainState::ConnectBlock(const CBlock& block, CValidationState& state, CBl
REJECT_INVALID, "bad-txns-nonfinal");
}
}
if(block.IsProofOfStake() && tx.IsCoinStake())
{
const COutPoint &prevout = tx.vin[0].prevout;
const Coin& coin = view.AccessCoin(prevout);
assert(!coin.IsSpent());

// If prev is coinbase, check that it's matured

if (coin.nHeight > ((chainActive.Height() + 1) - Params().GetConsensus().nStakeMinConfirmations))
return state.Invalid(false,
REJECT_INVALID, "utxo not reach stake min confirmations",
strprintf("coin.nHeight: %d", coin.nHeight));
}

// GetTransactionSigOpCost counts 3 types of sigops:
// * legacy (always)
Expand Down

0 comments on commit ed25ecd

Please sign in to comment.