github.com/ethw3/go-ethereuma@v0.0.0-20221013053120-c14602a4c23c/core/types/gen_account_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 *StateAccount) EncodeRLP(_w io.Writer) error {
    12  	w := rlp.NewEncoderBuffer(_w)
    13  	_tmp0 := w.List()
    14  	w.WriteUint64(obj.Nonce)
    15  	if obj.Balance == nil {
    16  		w.Write(rlp.EmptyString)
    17  	} else {
    18  		if obj.Balance.Sign() == -1 {
    19  			return rlp.ErrNegativeBigInt
    20  		}
    21  		w.WriteBigInt(obj.Balance)
    22  	}
    23  	w.WriteBytes(obj.Root[:])
    24  	w.WriteBytes(obj.CodeHash)
    25  	w.ListEnd(_tmp0)
    26  	return w.Flush()
    27  }