From 5634b75866d9ed8cded75e35455f3ad5991299a2 Mon Sep 17 00:00:00 2001 From: Daniel Liu <139250065@qq.com> Date: Tue, 9 Dec 2025 13:32:24 +0800 Subject: [PATCH] core/types: add derived chain ID to LegacyTx JSON encoding #27452 (#1792) --- core/types/transaction_marshalling.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core/types/transaction_marshalling.go b/core/types/transaction_marshalling.go index f52e8df657..668dd906c5 100644 --- a/core/types/transaction_marshalling.go +++ b/core/types/transaction_marshalling.go @@ -66,6 +66,9 @@ func (tx *Transaction) MarshalJSON() ([]byte, error) { enc.V = (*hexutil.Big)(itx.V) enc.R = (*hexutil.Big)(itx.R) enc.S = (*hexutil.Big)(itx.S) + if tx.Protected() { + enc.ChainID = (*hexutil.Big)(tx.ChainId()) + } case *AccessListTx: enc.ChainID = (*hexutil.Big)(itx.ChainID)