core/types: add "chainID" field to legacy tx JSON encoding (#27452)

Co-authored-by: lightclient <14004106+lightclient@users.noreply.github.com>
This commit is contained in:
Freeman Jiang 2023-06-13 08:46:45 -04:00 committed by GitHub
parent f3314bb6df
commit 8bbaf882a6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -69,6 +69,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)