Skip to content

Commit

Permalink
fix: custom CBOR marshaling for UtxoId (#817)
Browse files Browse the repository at this point in the history
  • Loading branch information
agaffney authored Dec 31, 2024
1 parent 28cadd7 commit eedb336
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions protocol/localstatequery/queries.go
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,23 @@ func (u *UtxoId) UnmarshalCBOR(data []byte) error {
return nil
}

func (u *UtxoId) MarshalCBOR() ([]byte, error) {
var tmpData []any
if u.DatumHash == ledger.NewBlake2b256(nil) {
tmpData = []any{
u.Hash,
u.Idx,
}
} else {
tmpData = []any{
u.Hash,
u.Idx,
u.DatumHash,
}
}
return cbor.Encode(tmpData)
}

// TODO
/*
result [{* utxo => value }]
Expand Down

0 comments on commit eedb336

Please sign in to comment.