mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-31 17:51:33 +02:00
lnwire: add btc and node announcement nonces to channel_ready
In preparation for Gossip 1.75, we add new TLV's to the `ChannelReady` message. Namely: `AnnouncementBitcoinNonce` and `AnnouncementNodeNonce`. These will be used to exchange nones required for producing the partial signature to be send in the `AnnouncementSignatures2` message. The type numbers for these new fields are even because if they are set, then a peer is expecting its peer to understand gossip 1.75 and the new fields.
This commit is contained in:
@@ -730,18 +730,13 @@ func TestLightningWireProtocol(t *testing.T) {
|
||||
},
|
||||
MsgChannelReady: func(v []reflect.Value, r *rand.Rand) {
|
||||
var c [32]byte
|
||||
if _, err := r.Read(c[:]); err != nil {
|
||||
t.Fatalf("unable to generate chan id: %v", err)
|
||||
return
|
||||
}
|
||||
_, err := r.Read(c[:])
|
||||
require.NoError(t, err)
|
||||
|
||||
pubKey, err := randPubKey()
|
||||
if err != nil {
|
||||
t.Fatalf("unable to generate key: %v", err)
|
||||
return
|
||||
}
|
||||
require.NoError(t, err)
|
||||
|
||||
req := NewChannelReady(ChannelID(c), pubKey)
|
||||
req := NewChannelReady(c, pubKey)
|
||||
|
||||
if r.Int31()%2 == 0 {
|
||||
scid := NewShortChanIDFromInt(uint64(r.Int63()))
|
||||
@@ -751,6 +746,24 @@ func TestLightningWireProtocol(t *testing.T) {
|
||||
req.NextLocalNonce = someLocalNonce[NonceRecordTypeT](r)
|
||||
}
|
||||
|
||||
if r.Int31()%2 == 0 {
|
||||
nodeNonce := tlv.ZeroRecordT[
|
||||
tlv.TlvType0, Musig2Nonce,
|
||||
]()
|
||||
nodeNonce.Val = randLocalNonce(r)
|
||||
req.AnnouncementNodeNonce = tlv.SomeRecordT(
|
||||
nodeNonce,
|
||||
)
|
||||
|
||||
btcNonce := tlv.ZeroRecordT[
|
||||
tlv.TlvType2, Musig2Nonce,
|
||||
]()
|
||||
btcNonce.Val = randLocalNonce(r)
|
||||
req.AnnouncementBitcoinNonce = tlv.SomeRecordT(
|
||||
btcNonce,
|
||||
)
|
||||
}
|
||||
|
||||
v[0] = reflect.ValueOf(*req)
|
||||
},
|
||||
MsgShutdown: func(v []reflect.Value, r *rand.Rand) {
|
||||
|
Reference in New Issue
Block a user