lnwire: add LocalNonce to AcceptChannel
This commit is contained in:
1 file changed
+15
@@ -105,6 +105,13 @@ type AcceptChannel struct {
|
|||||||
// type.
|
// type.
|
||||||
LeaseExpiry *LeaseExpiry
|
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
|
// ExtraData is the set of data that was appended to this message to
|
||||||
// fill out the full maximum transport message size. These fields can
|
// fill out the full maximum transport message size. These fields can
|
||||||
// be used to specify optional data such as custom TLV fields.
|
// 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 {
|
if a.LeaseExpiry != nil {
|
||||||
recordProducers = append(recordProducers, a.LeaseExpiry)
|
recordProducers = append(recordProducers, a.LeaseExpiry)
|
||||||
}
|
}
|
||||||
|
if a.LocalNonce != nil {
|
||||||
|
recordProducers = append(recordProducers, a.LocalNonce)
|
||||||
|
}
|
||||||
err := EncodeMessageExtraData(&a.ExtraData, recordProducers...)
|
err := EncodeMessageExtraData(&a.ExtraData, recordProducers...)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -238,9 +248,11 @@ func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error {
|
|||||||
var (
|
var (
|
||||||
chanType ChannelType
|
chanType ChannelType
|
||||||
leaseExpiry LeaseExpiry
|
leaseExpiry LeaseExpiry
|
||||||
|
localNonce Musig2Nonce
|
||||||
)
|
)
|
||||||
typeMap, err := tlvRecords.ExtractRecords(
|
typeMap, err := tlvRecords.ExtractRecords(
|
||||||
&a.UpfrontShutdownScript, &chanType, &leaseExpiry,
|
&a.UpfrontShutdownScript, &chanType, &leaseExpiry,
|
||||||
|
&localNonce,
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -253,6 +265,9 @@ func (a *AcceptChannel) Decode(r io.Reader, pver uint32) error {
|
|||||||
if val, ok := typeMap[LeaseExpiryRecordType]; ok && val == nil {
|
if val, ok := typeMap[LeaseExpiryRecordType]; ok && val == nil {
|
||||||
a.LeaseExpiry = &leaseExpiry
|
a.LeaseExpiry = &leaseExpiry
|
||||||
}
|
}
|
||||||
|
if val, ok := typeMap[NonceRecordType]; ok && val == nil {
|
||||||
|
a.LocalNonce = &localNonce
|
||||||
|
}
|
||||||
|
|
||||||
a.ExtraData = tlvRecords
|
a.ExtraData = tlvRecords
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user