Skip to content

Commit

Permalink
fix is_replay_protected
Browse files Browse the repository at this point in the history
  • Loading branch information
taokayan committed Mar 15, 2024
1 parent 9e1cbda commit 2354941
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion silkworm/silkrpc/common/util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions silkworm/silkrpc/common/util_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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]") {
Expand Down

0 comments on commit 2354941

Please sign in to comment.