From ed9d875ae2602769b0ef5400318efd46d2cffd68 Mon Sep 17 00:00:00 2001 From: danceratopz Date: Mon, 17 Jul 2023 17:02:03 +0200 Subject: [PATCH] use v to determine if the transaction is protected --- .../java/org/hyperledger/besu/evmtool/T8nExecutor.java | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java index bba32511005..9a767d6f0f1 100644 --- a/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java +++ b/ethereum/evmtool/src/main/java/org/hyperledger/besu/evmtool/T8nExecutor.java @@ -135,9 +135,9 @@ protected static List extractTransactions( if (txNode.has("to")) { builder.to(Address.fromHexString(txNode.get("to").textValue())); } - - if (transactionType.requiresChainId() - || (txNode.has("protected") && txNode.get("protected").asBoolean(false))) { + BigInteger v = + Bytes.fromHexStringLenient(txNode.get("v").textValue()).toUnsignedBigInteger(); + if (transactionType.requiresChainId() || (v.compareTo(REPLAY_PROTECTED_V_MIN) > 0)) { // chainid if protected builder.chainId(chainId); } @@ -191,14 +191,11 @@ protected static List extractTransactions( transactions.add(builder.signAndBuild(keys)); } else { - BigInteger v = - Bytes.fromHexStringLenient(txNode.get("v").textValue()).toUnsignedBigInteger(); if (transactionType == TransactionType.FRONTIER) { if (v.compareTo(REPLAY_PROTECTED_V_MIN) > 0) { v = v.subtract(REPLAY_PROTECTED_V_BASE) .subtract(chainId.multiply(BigInteger.TWO)); - builder.chainId(chainId); } else { v = v.subtract(REPLAY_UNPROTECTED_V_BASE); }