From 2354941e21bc9a715e378c0c1b96e5756466d240 Mon Sep 17 00:00:00 2001 From: kayan Date: Fri, 15 Mar 2024 17:57:44 +0800 Subject: [PATCH] fix is_replay_protected --- silkworm/silkrpc/common/util.cpp | 2 +- silkworm/silkrpc/common/util_test.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/silkworm/silkrpc/common/util.cpp b/silkworm/silkrpc/common/util.cpp index ea12194e8..025bd9b33 100644 --- a/silkworm/silkrpc/common/util.cpp +++ b/silkworm/silkrpc/common/util.cpp @@ -146,7 +146,7 @@ bool check_tx_fee_less_cap(float cap, const intx::uint256& max_fee_per_gas, uint bool is_replay_protected(const silkworm::Transaction& txn) { if (txn.type != TransactionType::kLegacy) { - return false; + return true; } intx::uint256 v = txn.v(); if (v != 27 && v != 28 && v != 0 && v != 1) { diff --git a/silkworm/silkrpc/common/util_test.cpp b/silkworm/silkrpc/common/util_test.cpp index 5dd3611b8..91014112c 100644 --- a/silkworm/silkrpc/common/util_test.cpp +++ b/silkworm/silkrpc/common/util_test.cpp @@ -132,7 +132,7 @@ TEST_CASE("check_tx_fee_less_cap returns false", "[silkrpc][common][util]") { CHECK(check == true); } -TEST_CASE("is_replay_protected(tx legacy) returns true", "[silkrpc][common][util]") { +TEST_CASE("is_replay_protected(tx non-legacy) returns true", "[silkrpc][common][util]") { const Transaction txn{ {.type = TransactionType::kAccessList, .nonce = 0, @@ -147,7 +147,7 @@ TEST_CASE("is_replay_protected(tx legacy) returns true", "[silkrpc][common][util }; auto check = is_replay_protected(txn); - CHECK(check == false); + CHECK(check == true); } TEST_CASE("is_replay_protected returns true", "[silkrpc][common][util]") {