Skip to content

Commit

Permalink
Preserve requests nil-ness in (un)marshalling
Browse files Browse the repository at this point in the history
  • Loading branch information
yperbasis committed Oct 4, 2024
1 parent 8d66803 commit c9f01ff
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions core/types/request.go
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ func (r *Requests) Withdrawals() WithdrawalRequests {
}

func MarshalRequestsBinary(requests Requests) ([][]byte, error) {
if requests == nil {
return nil, nil
}
ret := make([][]byte, 0)
for _, req := range requests {
buf := new(bytes.Buffer)
Expand All @@ -155,6 +158,10 @@ func MarshalRequestsBinary(requests Requests) ([][]byte, error) {
}

func UnmarshalRequestsFromBinary(requests [][]byte) (reqs Requests, err error) {
if requests == nil {
return nil, nil
}
reqs = make(Requests, 0)
for _, b := range requests {
switch b[0] {
case DepositRequestType:
Expand Down

0 comments on commit c9f01ff

Please sign in to comment.