github.com/ethw3/go-ethereuma@v0.0.0-20221013053120-c14602a4c23c/core/types/gen_header_rlp.go (about) 1 // Code generated by rlpgen. DO NOT EDIT. 2 3 //go:build !norlpgen 4 // +build !norlpgen 5 6 package types 7 8 import "github.com/ethw3/go-ethereuma/rlp" 9 import "io" 10 11 func (obj *Header) EncodeRLP(_w io.Writer) error { 12 w := rlp.NewEncoderBuffer(_w) 13 _tmp0 := w.List() 14 w.WriteBytes(obj.ParentHash[:]) 15 w.WriteBytes(obj.UncleHash[:]) 16 w.WriteBytes(obj.Coinbase[:]) 17 w.WriteBytes(obj.Root[:]) 18 w.WriteBytes(obj.TxHash[:]) 19 w.WriteBytes(obj.ReceiptHash[:]) 20 w.WriteBytes(obj.Bloom[:]) 21 if obj.Difficulty == nil { 22 w.Write(rlp.EmptyString) 23 } else { 24 if obj.Difficulty.Sign() == -1 { 25 return rlp.ErrNegativeBigInt 26 } 27 w.WriteBigInt(obj.Difficulty) 28 } 29 if obj.Number == nil { 30 w.Write(rlp.EmptyString) 31 } else { 32 if obj.Number.Sign() == -1 { 33 return rlp.ErrNegativeBigInt 34 } 35 w.WriteBigInt(obj.Number) 36 } 37 w.WriteUint64(obj.GasLimit) 38 w.WriteUint64(obj.GasUsed) 39 w.WriteUint64(obj.Time) 40 w.WriteBytes(obj.Extra) 41 w.WriteBytes(obj.MixDigest[:]) 42 w.WriteBytes(obj.Nonce[:]) 43 _tmp1 := obj.BaseFee != nil 44 if _tmp1 { 45 if obj.BaseFee == nil { 46 w.Write(rlp.EmptyString) 47 } else { 48 if obj.BaseFee.Sign() == -1 { 49 return rlp.ErrNegativeBigInt 50 } 51 w.WriteBigInt(obj.BaseFee) 52 } 53 } 54 w.ListEnd(_tmp0) 55 return w.Flush() 56 }