multi: Set upfront shutdown from open and accept chanel messages
This commit gets upfront shutdown scripts from openchannel and acceptchannel wire messages sent from our peer and sets upfront shutdown scripts in our open and accept channel messages when the remote peer supports option upfront shutdown and we have the feature enabled.
This commit is contained in:
6 files changed
+256
-35
No files matched your search
@@ -44,6 +44,10 @@ type ChannelContribution struct {
|
||||
// such as the min HTLC, and also all the keys which will be used for
|
||||
// the duration of the channel.
|
||||
*channeldb.ChannelConfig
|
||||
|
||||
// UpfrontShutdown is an optional address to which the channel should be
|
||||
// paid out to on cooperative close.
|
||||
UpfrontShutdown lnwire.DeliveryAddress
|
||||
}
|
||||
|
||||
// toChanConfig returns the raw channel configuration generated by a node's
|
||||
@@ -531,6 +535,14 @@ func (r *ChannelReservation) FundingOutpoint() *wire.OutPoint {
|
||||
return &r.partialState.FundingOutpoint
|
||||
}
|
||||
|
||||
// SetOurUpfrontShutdown sets the upfront shutdown address on our contribution.
|
||||
func (r *ChannelReservation) SetOurUpfrontShutdown(shutdown lnwire.DeliveryAddress) {
|
||||
r.Lock()
|
||||
defer r.Unlock()
|
||||
|
||||
r.ourContribution.UpfrontShutdown = shutdown
|
||||
}
|
||||
|
||||
// Capacity returns the channel capacity for this reservation.
|
||||
func (r *ChannelReservation) Capacity() btcutil.Amount {
|
||||
r.RLock()
|
||||
|
||||
Reference in new issue
Block a user