(testnet) Reject blocks that result in turnstile violations
This commit is contained in:
parent
24db3297df
commit
8a990a7d64
26
src/main.cpp
26
src/main.cpp
|
@ -2451,6 +2451,32 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we're on testnet, reject a block that results in a negative
|
||||||
|
// shielded value pool balance.
|
||||||
|
if (Params().NetworkIDString() == "test") {
|
||||||
|
// Sprout
|
||||||
|
//
|
||||||
|
// We can expect nChainSproutValue to be valid after the hardcoded
|
||||||
|
// height, and this will be enforced on all descendant blocks. If
|
||||||
|
// the node was reindexed then this will be enforced for all blocks.
|
||||||
|
if (pindex->nChainSproutValue) {
|
||||||
|
if (*pindex->nChainSproutValue < 0) {
|
||||||
|
return state.DoS(100, error("ConnectBlock(): turnstile violation in Sprout shielded value pool"),
|
||||||
|
REJECT_INVALID, "turnstile-violation-sprout-shielded-pool");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Sapling
|
||||||
|
//
|
||||||
|
// If we've reached ConnectBlock, we have all transactions of
|
||||||
|
// parents and can expect nChainSaplingValue not to be boost::none.
|
||||||
|
assert(pindex->nChainSaplingValue != boost::none);
|
||||||
|
if (*pindex->nChainSaplingValue < 0) {
|
||||||
|
return state.DoS(100, error("ConnectBlock(): turnstile violation in Sapling shielded value pool"),
|
||||||
|
REJECT_INVALID, "turnstile-violation-sapling-shielded-pool");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
|
// Do not allow blocks that contain transactions which 'overwrite' older transactions,
|
||||||
// unless those are already completely spent.
|
// unless those are already completely spent.
|
||||||
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
|
BOOST_FOREACH(const CTransaction& tx, block.vtx) {
|
||||||
|
|
Loading…
Reference in New Issue