mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-26 08:55:59 +01:00
lnwire: add LocalNonce to OpenChannel
This commit is contained in:
parent
14949c972d
commit
7c5ba067ab
1 changed files with 15 additions and 0 deletions
|
@ -141,6 +141,13 @@ type OpenChannel 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.
|
||||
|
@ -168,6 +175,9 @@ func (o *OpenChannel) Encode(w *bytes.Buffer, pver uint32) error {
|
|||
if o.LeaseExpiry != nil {
|
||||
recordProducers = append(recordProducers, o.LeaseExpiry)
|
||||
}
|
||||
if o.LocalNonce != nil {
|
||||
recordProducers = append(recordProducers, o.LocalNonce)
|
||||
}
|
||||
err := EncodeMessageExtraData(&o.ExtraData, recordProducers...)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -292,9 +302,11 @@ func (o *OpenChannel) Decode(r io.Reader, pver uint32) error {
|
|||
var (
|
||||
chanType ChannelType
|
||||
leaseExpiry LeaseExpiry
|
||||
localNonce Musig2Nonce
|
||||
)
|
||||
typeMap, err := tlvRecords.ExtractRecords(
|
||||
&o.UpfrontShutdownScript, &chanType, &leaseExpiry,
|
||||
&localNonce,
|
||||
)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -307,6 +319,9 @@ func (o *OpenChannel) Decode(r io.Reader, pver uint32) error {
|
|||
if val, ok := typeMap[LeaseExpiryRecordType]; ok && val == nil {
|
||||
o.LeaseExpiry = &leaseExpiry
|
||||
}
|
||||
if val, ok := typeMap[NonceRecordType]; ok && val == nil {
|
||||
o.LocalNonce = &localNonce
|
||||
}
|
||||
|
||||
o.ExtraData = tlvRecords
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue