force presente of to in eip-5806 delegate tx

This commit is contained in:
Hadrien Croubois 2024-03-07 18:20:08 +01:00
parent 0efbc0b794
commit 0a6941be8e
No known key found for this signature in database
GPG key ID: B53810561A746A06

View file

@ -420,9 +420,10 @@ func (tx *Transaction) UnmarshalJSON(input []byte) error {
return errors.New("missing required field 'nonce' in transaction") return errors.New("missing required field 'nonce' in transaction")
} }
itx.Nonce = uint64(*dec.Nonce) itx.Nonce = uint64(*dec.Nonce)
if dec.To != nil { if dec.To == nil {
itx.To = dec.To return errors.New("missing required field 'to' in transaction")
} }
itx.To = *dec.To
if dec.Gas == nil { if dec.Gas == nil {
return errors.New("missing required field 'gas' for txdata") return errors.New("missing required field 'gas' for txdata")
} }