Skip to content

Commit

Permalink
fix: update TUNA v2 shape (#68)
Browse files Browse the repository at this point in the history
This was updated upstream before v2 was launched, so we need to update
to match
  • Loading branch information
agaffney authored Jul 2, 2024
1 parent 1743bf1 commit 5ad53a2
Showing 1 changed file with 4 additions and 10 deletions.
14 changes: 4 additions & 10 deletions tuna.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,11 @@ type TunaV2State struct {
LeadingZeros int64
DifficultyNumber int64
EpochTime int64
RealTimeNow int64
Interlink [][]byte
Extra any
CurrentPosixTime int64
MerkleRoot []byte
}

func (t *TunaV2State) MarshalCBOR() ([]byte, error) {
var tmpInterlink []any
for _, item := range t.Interlink {
tmpInterlink = append(tmpInterlink, item)
}
tmp := cbor.NewConstructor(
0,
cbor.IndefLengthList{
Expand All @@ -91,9 +86,8 @@ func (t *TunaV2State) MarshalCBOR() ([]byte, error) {
t.LeadingZeros,
t.DifficultyNumber,
t.EpochTime,
t.RealTimeNow,
cbor.IndefLengthList(tmpInterlink),
t.Extra,
t.CurrentPosixTime,
t.MerkleRoot,
},
)
return cbor.Encode(&tmp)
Expand Down

0 comments on commit 5ad53a2

Please sign in to comment.