|
|
@ -166,7 +166,7 @@ TEST(checktransaction_tests, BadTxnsOversize) { |
|
|
|
|
|
|
|
// ... but fails contextual ones!
|
|
|
|
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-oversize", false)).Times(1); |
|
|
|
EXPECT_FALSE(ContextualCheckTransaction(tx, state, 1, 100)); |
|
|
|
EXPECT_FALSE(ContextualCheckTransaction(0,tx, state, 1, 100)); |
|
|
|
} |
|
|
|
|
|
|
|
{ |
|
|
@ -188,7 +188,7 @@ TEST(checktransaction_tests, BadTxnsOversize) { |
|
|
|
|
|
|
|
MockCValidationState state; |
|
|
|
EXPECT_TRUE(CheckTransactionWithoutProofVerification(tx, state)); |
|
|
|
EXPECT_TRUE(ContextualCheckTransaction(tx, state, 1, 100)); |
|
|
|
EXPECT_TRUE(ContextualCheckTransaction(0,tx, state, 1, 100)); |
|
|
|
|
|
|
|
// Revert to default
|
|
|
|
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_SAPLING, Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT); |
|
|
@ -508,9 +508,9 @@ TEST(checktransaction_tests, bad_txns_invalid_joinsplit_signature) { |
|
|
|
MockCValidationState state; |
|
|
|
// during initial block download, DoS ban score should be zero, else 100
|
|
|
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 0, 100, []() { return true; }); |
|
|
|
ContextualCheckTransaction(0,tx, state, 0, 100, []() { return true; }); |
|
|
|
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 0, 100, []() { return false; }); |
|
|
|
ContextualCheckTransaction(0,tx, state, 0, 100, []() { return false; }); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(checktransaction_tests, non_canonical_ed25519_signature) { |
|
|
@ -522,7 +522,7 @@ TEST(checktransaction_tests, non_canonical_ed25519_signature) { |
|
|
|
{ |
|
|
|
CTransaction tx(mtx); |
|
|
|
MockCValidationState state; |
|
|
|
EXPECT_TRUE(ContextualCheckTransaction(tx, state, 0, 100)); |
|
|
|
EXPECT_TRUE(ContextualCheckTransaction(0,tx, state, 0, 100)); |
|
|
|
} |
|
|
|
|
|
|
|
// Copied from libsodium/crypto_sign/ed25519/ref10/open.c
|
|
|
@ -544,9 +544,9 @@ TEST(checktransaction_tests, non_canonical_ed25519_signature) { |
|
|
|
MockCValidationState state; |
|
|
|
// during initial block download, DoS ban score should be zero, else 100
|
|
|
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 0, 100, []() { return true; }); |
|
|
|
ContextualCheckTransaction(0,tx, state, 0, 100, []() { return true; }); |
|
|
|
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-txns-invalid-joinsplit-signature", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 0, 100, []() { return false; }); |
|
|
|
ContextualCheckTransaction(0,tx, state, 0, 100, []() { return false; }); |
|
|
|
} |
|
|
|
|
|
|
|
TEST(checktransaction_tests, OverwinterConstructors) { |
|
|
@ -801,7 +801,7 @@ TEST(checktransaction_tests, OverwinterVersionNumberHigh) { |
|
|
|
UNSAFE_CTransaction tx(mtx); |
|
|
|
MockCValidationState state; |
|
|
|
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "bad-tx-overwinter-version-too-high", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 1, 100); |
|
|
|
ContextualCheckTransaction(0,tx, state, 1, 100); |
|
|
|
|
|
|
|
// Revert to default
|
|
|
|
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_OVERWINTER, Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT); |
|
|
@ -837,9 +837,9 @@ TEST(checktransaction_tests, OverwinterNotActive) { |
|
|
|
MockCValidationState state; |
|
|
|
// during initial block download, DoS ban score should be zero, else 100
|
|
|
|
EXPECT_CALL(state, DoS(0, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 1, 100, []() { return true; }); |
|
|
|
ContextualCheckTransaction(0,tx, state, 1, 100, []() { return true; }); |
|
|
|
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "tx-overwinter-not-active", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 1, 100, []() { return false; }); |
|
|
|
ContextualCheckTransaction(0,tx, state, 1, 100, []() { return false; }); |
|
|
|
} |
|
|
|
|
|
|
|
// This tests a transaction without the fOverwintered flag set, against the Overwinter consensus rule set.
|
|
|
@ -856,7 +856,7 @@ TEST(checktransaction_tests, OverwinterFlagNotSet) { |
|
|
|
CTransaction tx(mtx); |
|
|
|
MockCValidationState state; |
|
|
|
EXPECT_CALL(state, DoS(100, false, REJECT_INVALID, "tx-overwinter-flag-not-set", false)).Times(1); |
|
|
|
ContextualCheckTransaction(tx, state, 1, 100); |
|
|
|
ContextualCheckTransaction(0,tx, state, 1, 100); |
|
|
|
|
|
|
|
// Revert to default
|
|
|
|
UpdateNetworkUpgradeParameters(Consensus::UPGRADE_OVERWINTER, Consensus::NetworkUpgrade::NO_ACTIVATION_HEIGHT); |
|
|
|