lnwire: make LocalNonce an optional tlv record and fix extra data

It should be an optional record instead of an fn option. In addition,
its tlv type is bumped to be 14 as this record is also included in the
`DynCommit`. If we use tlv type 0, it will create a conflict in the msg
`DynCommit`, which is fixed in the following commit.
This commit is contained in:
yyforyongyu
2025-07-02 20:50:44 +08:00
parent b7d2f68ed0
commit f39c3679f2
2 changed files with 26 additions and 46 deletions

View File

@@ -796,9 +796,10 @@ func (da *DynAck) RandTestMessage(t *rapid.T) Message {
}
includeLocalNonce := rapid.Bool().Draw(t, "includeLocalNonce")
if includeLocalNonce {
msg.LocalNonce = fn.Some(RandMusig2Nonce(t))
nonce := RandMusig2Nonce(t)
rec := tlv.NewRecordT[tlv.TlvType14](nonce)
msg.LocalNonce = tlv.SomeRecordT(rec)
}
// Create a tlv type lists to hold all known records which will be