core/types: add derived chain ID to LegacyTx JSON encoding #27452 (#1792)

This commit is contained in:
Daniel Liu 2025-12-09 13:32:24 +08:00 committed by GitHub
parent f363000d2d
commit 5634b75866
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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)