From 33b81e8362b8819046f8c5093f53282d67503d48 Mon Sep 17 00:00:00 2001 From: Sam Davies Date: Fri, 26 Jan 2024 12:43:42 -0500 Subject: [PATCH] Convert streamID and channelID => uint64 --- llo/plugin.go | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/llo/plugin.go b/llo/plugin.go index 2a7ad4d..e9db212 100644 --- a/llo/plugin.go +++ b/llo/plugin.go @@ -95,16 +95,16 @@ const ( // Solana, CosmWasm, kalechain, etc... all go here ) +// MakeChannelHash is used for mapping ChannelDefinitionWithIDs func MakeChannelHash(cd ChannelDefinitionWithID) ChannelHash { h := sha256.New() - h.Write(cd.ChannelID[:]) + binary.Write(h, binary.BigEndian, cd.ChannelID) binary.Write(h, binary.BigEndian, uint32(len(cd.ReportFormat))) h.Write([]byte(cd.ReportFormat)) binary.Write(h, binary.BigEndian, cd.ChainSelector) binary.Write(h, binary.BigEndian, uint32(len(cd.StreamIDs))) - for _, stream := range cd.StreamIDs { - binary.Write(h, binary.BigEndian, uint32(len(stream))) - h.Write([]byte(stream)) + for _, streamID := range cd.StreamIDs { + binary.Write(h, binary.BigEndian, streamID) } var result [32]byte h.Sum(result[:0]) @@ -498,7 +498,7 @@ func (out *Outcome) ReportableChannels() []commontypes.ChannelID { } sort.Slice(result, func(i, j int) bool { - return result[i].Less(result[j]) + return result[i] < result[j] }) return result @@ -900,7 +900,7 @@ func subtractChannelDefinitions(minuend commontypes.ChannelDefinitions, subtrahe // Sort so we return deterministic result sort.Slice(differenceList, func(i, j int) bool { - return differenceList[i].ChannelID.Less(differenceList[j].ChannelID) + return differenceList[i].ChannelID < differenceList[j].ChannelID }) if len(differenceList) > limit {