Skip to content

Commit

Permalink
added check for tick data var struct emptyness when transforming to p…
Browse files Browse the repository at this point in the history
…roto
  • Loading branch information
0xluk committed Aug 26, 2024
1 parent debf2db commit 2cea1b1
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion validator/tick/models.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ func qubicToProto(tickData types.TickData) (*protobuff.TickData, error) {
Epoch: uint32(tickData.Epoch),
TickNumber: tickData.Tick,
Timestamp: uint64(timestamp),
VarStruct: tickData.UnionData[:],
VarStruct: varStructToProto(tickData.UnionData),
TimeLock: tickData.Timelock[:],
TransactionIds: transactionIds,
ContractFees: contractFeesToProto(tickData.ContractFees),
Expand Down Expand Up @@ -59,3 +59,11 @@ func contractFeesToProto(contractFees [1024]int64) []int64 {
}
return protoContractFees
}

func varStructToProto(varStruct [256]byte) []byte {
if varStruct == [256]byte{} {
return []byte{}
}

return varStruct[:]
}

0 comments on commit 2cea1b1

Please sign in to comment.