File tree Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Expand file tree Collapse file tree 2 files changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -134,7 +134,7 @@ func (b *Body) EncodeRLP(dst io.Writer) error {
134134 return err
135135 }
136136
137- withdraws := len ( b .Withdrawals ) > 0
137+ withdraws := b .Withdrawals != nil
138138
139139 // TODO(arr4n): call hook here, passing `withdraws` as a
140140 // mustWriteEmptyOptional flag. The hook could also return a
Original file line number Diff line number Diff line change @@ -47,7 +47,14 @@ func (s *Stream) FromList(fn func() error) error {
4747}
4848
4949func DecodeList [T any ](s * Stream ) ([]* T , error ) {
50- var vals []* T
50+ // From the package-level documentation:
51+ //
52+ // > Note that package rlp never leaves a pointer-type struct field as nil
53+ // > unless one of the "nil" struct tags is present.
54+ //
55+ // We therefore return a non-nil pointer to maintain said invariant as it
56+ // makes use of this function easier.
57+ vals := make ([]* T , 0 )
5158 err := s .FromList (func () error {
5259 for s .MoreDataInList () {
5360 var v T
You can’t perform that action at this time.
0 commit comments