@@ -1288,13 +1288,10 @@ func (s *SQLStore) FilterChannelRange(startHeight, endHeight uint32,
1288
1288
TxIndex : math .MaxUint32 & 0x00ffffff ,
1289
1289
TxPosition : math .MaxUint16 ,
1290
1290
}
1291
+ chanIDStart = channelIDToBytes (startSCID .ToUint64 ())
1292
+ chanIDEnd = channelIDToBytes (endSCID .ToUint64 ())
1291
1293
)
1292
1294
1293
- var chanIDStart [8 ]byte
1294
- byteOrder .PutUint64 (chanIDStart [:], startSCID .ToUint64 ())
1295
- var chanIDEnd [8 ]byte
1296
- byteOrder .PutUint64 (chanIDEnd [:], endSCID .ToUint64 ())
1297
-
1298
1295
// 1) get all channels where channelID is between start and end chan ID.
1299
1296
// 2) skip if not public (ie, no channel_proof)
1300
1297
// 3) collect that channel.
@@ -1638,9 +1635,8 @@ func updateChanEdgePolicy(ctx context.Context, tx SQLQueries,
1638
1635
var (
1639
1636
node1Pub , node2Pub route.Vertex
1640
1637
isNode1 bool
1641
- chanIDB [ 8 ] byte
1638
+ chanIDB = channelIDToBytes ( edge . ChannelID )
1642
1639
)
1643
- byteOrder .PutUint64 (chanIDB [:], edge .ChannelID )
1644
1640
1645
1641
// Check that this edge policy refers to a channel that we already
1646
1642
// know of. We do this explicitly so that we can return the appropriate
@@ -2334,8 +2330,7 @@ func marshalExtraOpaqueData(data []byte) (map[uint64][]byte, error) {
2334
2330
func insertChannel (ctx context.Context , db SQLQueries ,
2335
2331
edge * models.ChannelEdgeInfo ) error {
2336
2332
2337
- var chanIDB [8 ]byte
2338
- byteOrder .PutUint64 (chanIDB [:], edge .ChannelID )
2333
+ chanIDB := channelIDToBytes (edge .ChannelID )
2339
2334
2340
2335
// Make sure that the channel doesn't already exist. We do this
2341
2336
// explicitly instead of relying on catching a unique constraint error
@@ -2920,3 +2915,12 @@ func extractChannelPolicies(row any) (*sqlc.ChannelPolicy, *sqlc.ChannelPolicy,
2920
2915
"extractChannelPolicies: %T" , r )
2921
2916
}
2922
2917
}
2918
+
2919
+ // channelIDToBytes converts a channel ID (SCID) to a byte array
2920
+ // representation.
2921
+ func channelIDToBytes (channelID uint64 ) [8 ]byte {
2922
+ var chanIDB [8 ]byte
2923
+ byteOrder .PutUint64 (chanIDB [:], channelID )
2924
+
2925
+ return chanIDB
2926
+ }
0 commit comments