Add contextual check to main.cpp
Reject transactions with nonzero vpub_old after NU4
This commit is contained in:
parent
552482a404
commit
01cdea54ee
10
src/main.cpp
10
src/main.cpp
|
@ -792,6 +792,7 @@ bool ContextualCheckTransaction(
|
|||
bool saplingActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_SAPLING);
|
||||
bool isSprout = !overwinterActive;
|
||||
bool heartwoodActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_HEARTWOOD);
|
||||
bool canopyActive = chainparams.GetConsensus().NetworkUpgradeActive(nHeight, Consensus::UPGRADE_CANOPY);
|
||||
|
||||
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
|
||||
if (isSprout && tx.fOverwintered) {
|
||||
|
@ -936,6 +937,15 @@ bool ContextualCheckTransaction(
|
|||
}
|
||||
}
|
||||
|
||||
// Rules that apply to Canopy or later:
|
||||
if (canopyActive) {
|
||||
for (const JSDescription& joinsplit : tx.vJoinSplit) {
|
||||
if (joinsplit.vpub_old > 0) {
|
||||
return state.DoS(DOS_LEVEL_BLOCK, error("ContextualCheckTransaction(): joinsplit.vpub_old nonzero"), REJECT_INVALID, "bad-txns-vpub_old-nonzero");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
auto consensusBranchId = CurrentEpochBranchId(nHeight, chainparams.GetConsensus());
|
||||
auto prevConsensusBranchId = PrevEpochBranchId(consensusBranchId, chainparams.GetConsensus());
|
||||
uint256 dataToBeSigned;
|
||||
|
|
Loading…
Reference in New Issue