Skip to content

Commit 47759e1

Browse files
committed
AcceptBlock(), reject invalid PoS stake
1 parent e237823 commit 47759e1

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4655,6 +4655,11 @@ bool AcceptBlock(CBlock& block, CValidationState& state, CBlockIndex** ppindex,
46554655
if(!stakeTxIn.IsZerocoinSpend()) {
46564656
for (CTxIn in: stakeTxIn.vin) {
46574657
const CCoins* coin = coins.AccessCoins(in.prevout.hash);
4658+
4659+
if(!coin && !isBlockFromFork){
4660+
// No coins on the main chain
4661+
return error("%s: coin stake inputs not available on main chain", __func__);
4662+
}
46584663
if(coin && !coin->IsAvailable(in.prevout.n)){
46594664
// If this is not available get the height of the spent and validate it with the forked height
46604665
// Check if this occurred before the chain split

0 commit comments

Comments
 (0)