don't ban peers when loading pre-overwinter blocks
This commit is contained in:
@@ -135,7 +135,7 @@ TEST(ContextualCheckBlock, BlockSproutRulesRejectSaplingTx) {
|
|||||||
MockCValidationState state;
|
MockCValidationState state;
|
||||||
CBlockIndex indexPrev {Params().GenesisBlock()};
|
CBlockIndex indexPrev {Params().GenesisBlock()};
|
||||||
|
|
||||||
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1);
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1);
|
||||||
EXPECT_FALSE(ContextualCheckBlock(block, state, &indexPrev));
|
EXPECT_FALSE(ContextualCheckBlock(block, state, &indexPrev));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,7 +164,7 @@ TEST(ContextualCheckBlock, BlockSproutRulesRejectOverwinterTx) {
|
|||||||
MockCValidationState state;
|
MockCValidationState state;
|
||||||
CBlockIndex indexPrev {Params().GenesisBlock()};
|
CBlockIndex indexPrev {Params().GenesisBlock()};
|
||||||
|
|
||||||
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1);
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1);
|
||||||
EXPECT_FALSE(ContextualCheckBlock(block, state, &indexPrev));
|
EXPECT_FALSE(ContextualCheckBlock(block, state, &indexPrev));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -504,7 +504,7 @@ TEST(checktransaction_tests, bad_txns_invalid_joinsplit_signature) {
|
|||||||
CTransaction tx(mtx);
|
CTransaction tx(mtx);
|
||||||
|
|
||||||
MockCValidationState state;
|
MockCValidationState state;
|
||||||
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1);
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1);
|
||||||
ContextualCheckTransaction(tx, state, 0, 100);
|
ContextualCheckTransaction(tx, state, 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +537,7 @@ TEST(checktransaction_tests, non_canonical_ed25519_signature) {
|
|||||||
CTransaction tx(mtx);
|
CTransaction tx(mtx);
|
||||||
|
|
||||||
MockCValidationState state;
|
MockCValidationState state;
|
||||||
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1);
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1);
|
||||||
ContextualCheckTransaction(tx, state, 0, 100);
|
ContextualCheckTransaction(tx, state, 0, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -775,7 +775,7 @@ TEST(checktransaction_tests, OverwinterNotActive) {
|
|||||||
|
|
||||||
CTransaction tx(mtx);
|
CTransaction tx(mtx);
|
||||||
MockCValidationState state;
|
MockCValidationState state;
|
||||||
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1);
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1);
|
||||||
ContextualCheckTransaction(tx, state, 1, 100);
|
ContextualCheckTransaction(tx, state, 1, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -970,4 +970,4 @@ TEST(checktransaction_tests, BadTxReceivedOverNetwork)
|
|||||||
FAIL() << "Expected std::ios_base::failure 'Unknown transaction format', got some other exception";
|
FAIL() << "Expected std::ios_base::failure 'Unknown transaction format', got some other exception";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -886,7 +886,8 @@ bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state,
|
|||||||
|
|
||||||
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
|
// If Sprout rules apply, reject transactions which are intended for Overwinter and beyond
|
||||||
if (isSprout && tx.fOverwintered) {
|
if (isSprout && tx.fOverwintered) {
|
||||||
return state.DoS(dosLevel, error("ContextualCheckTransaction(): overwinter is not active yet"),
|
return state.DoS(IsInitialBlockDownload() ? 0 : dosLevel,
|
||||||
|
error("ContextualCheckTransaction(): overwinter is not active yet"),
|
||||||
REJECT_INVALID, "tx-overwinter-not-active");
|
REJECT_INVALID, "tx-overwinter-not-active");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -986,7 +987,8 @@ bool ContextualCheckTransaction(const CTransaction& tx, CValidationState &state,
|
|||||||
dataToBeSigned.begin(), 32,
|
dataToBeSigned.begin(), 32,
|
||||||
tx.joinSplitPubKey.begin()
|
tx.joinSplitPubKey.begin()
|
||||||
) != 0) {
|
) != 0) {
|
||||||
return state.DoS(100, error("CheckTransaction(): invalid joinsplit signature"),
|
return state.DoS(IsInitialBlockDownload() ? 0 : 100,
|
||||||
|
error("CheckTransaction(): invalid joinsplit signature"),
|
||||||
REJECT_INVALID, "bad-txns-invalid-joinsplit-signature");
|
REJECT_INVALID, "bad-txns-invalid-joinsplit-signature");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user