Skip to content

Commit

Permalink
To in EIP-4844 transactions must be non-nil (#8047)
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis authored and AskAlexSharov committed Sep 6, 2023
1 parent c57850b commit db1b93c
Showing 1 changed file with 6 additions and 14 deletions.
20 changes: 6 additions & 14 deletions core/types/blob_tx.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,18 +150,12 @@ func (stx BlobTx) encodePayload(w io.Writer, b []byte, payloadSize, nonceLen, ga
return err
}
// encode To
if stx.To == nil {
b[0] = 128
} else {
b[0] = 128 + 20
}
b[0] = 128 + 20
if _, err := w.Write(b[:1]); err != nil {
return err
}
if stx.To != nil {
if _, err := w.Write(stx.To.Bytes()); err != nil {
return err
}
if _, err := w.Write(stx.To.Bytes()); err != nil {
return err
}
// encode Value
if err := stx.Value.EncodeRLP(w); err != nil {
Expand Down Expand Up @@ -276,13 +270,11 @@ func (stx *BlobTx) DecodeRLP(s *rlp.Stream) error {
if b, err = s.Bytes(); err != nil {
return err
}
if len(b) > 0 && len(b) != 20 {
if len(b) != 20 {
return fmt.Errorf("wrong size for To: %d", len(b))
}
if len(b) > 0 {
stx.To = &libcommon.Address{}
copy((*stx.To)[:], b)
}
stx.To = &libcommon.Address{}
copy((*stx.To)[:], b)

if b, err = s.Uint256Bytes(); err != nil {
return err
Expand Down

0 comments on commit db1b93c

Please sign in to comment.