mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-29 15:11:09 +02:00
lnwire: add LocalNonce to AcceptChannel
This commit is contained in:
@@ -105,6 +105,13 @@ type AcceptChannel struct {
|
||||
// type.
|
||||
LeaseExpiry *LeaseExpiry
|
||||
|
||||
// LocalNonce is an optional field that transmits the
|
||||
// local/verification nonce for a party. This nonce will be used to
|
||||
// verify the very first commitment transaction signature.
|
||||
// This will only be populated if the simple taproot channels type was
|
||||
// negotiated.
|
||||
LocalNonce *Musig2Nonce
|
||||
|
||||
// ExtraData is the set of data that was appended to this message to
|
||||
// fill out the full maximum transport message size. These fields can
|
||||
// be used to specify optional data such as custom TLV fields.
|
||||
@@ -134,6 +141,9 @@ func (a *AcceptChannel) Encode(w *bytes.Buffer, pver uint32) error {
|
||||
if a.LeaseExpiry != nil {
|
||||
recordProducers = append(recordProducers, a.LeaseExpiry)
|
||||
}
|
||||
if a.LocalNonce != nil {
|
||||
recordProducers = append(recordProducers, a.LocalNonce)
|
||||
}
|
||||
err := EncodeMessageExtraData(&a.ExtraData, recordProducers...)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -238,9 +248,11 @@ func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error {
|
||||
var (
|
||||
chanType ChannelType
|
||||
leaseExpiry LeaseExpiry
|
||||
localNonce Musig2Nonce
|
||||
)
|
||||
typeMap, err := tlvRecords.ExtractRecords(
|
||||
&a.UpfrontShutdownScript, &chanType, &leaseExpiry,
|
||||
&localNonce,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
@@ -253,6 +265,9 @@ func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error {
|
||||
if val, ok := typeMap[LeaseExpiryRecordType]; ok && val == nil {
|
||||
a.LeaseExpiry = &leaseExpiry
|
||||
}
|
||||
if val, ok := typeMap[NonceRecordType]; ok && val == nil {
|
||||
a.LocalNonce = &localNonce
|
||||
}
|
||||
|
||||
a.ExtraData = tlvRecords
|
||||
|
||||
|
Reference in New Issue
Block a user