lnwire: add FirstBlock and BlockRange to GossipTimestampRange

Add new FirstBlockHeight and BlockRange TLV fields to the
GossipTimestampRange message. This will be used to query for Gossip 1.75
messages which are timestamped using block height instead of Unix
timestamps.
This commit is contained in:
Elle Mouton
2024-01-08 16:57:06 +02:00
parent 60b0e46c36
commit df65b7cad9
2 changed files with 96 additions and 5 deletions

View File

@@ -1215,6 +1215,35 @@ func TestLightningWireProtocol(t *testing.T) {
v[0] = reflect.ValueOf(req)
},
MsgGossipTimestampRange: func(v []reflect.Value, r *rand.Rand) {
req := GossipTimestampRange{
FirstTimestamp: rand.Uint32(),
TimestampRange: rand.Uint32(),
ExtraData: make([]byte, 0),
}
_, err := rand.Read(req.ChainHash[:])
require.NoError(t, err)
// Sometimes add a block range.
if r.Int31()%2 == 0 {
firstBlock := tlv.ZeroRecordT[
tlv.TlvType2, uint32,
]()
firstBlock.Val = rand.Uint32()
req.FirstBlockHeight = tlv.SomeRecordT(
firstBlock,
)
blockRange := tlv.ZeroRecordT[
tlv.TlvType4, uint32,
]()
blockRange.Val = rand.Uint32()
req.BlockRange = tlv.SomeRecordT(blockRange)
}
v[0] = reflect.ValueOf(req)
},
MsgQueryShortChanIDs: func(v []reflect.Value, r *rand.Rand) {
req := QueryShortChanIDs{
ExtraData: make([]byte, 0),