diff --git a/htlcswitch/switch.go b/htlcswitch/switch.go index 419849be..dda6b911 100644 --- a/htlcswitch/switch.go +++ b/htlcswitch/switch.go @@ -75,6 +75,12 @@ type ChanClose struct { // ChanPoint represent the id of the channel which should be closed. ChanPoint *wire.OutPoint + // TargetFeePerKw is the ideal fee that was specified by the caller. + // This value is only utilized if the closure type is CloseRegular. + // This will be the starting offered fee when the fee negotiation + // process for the cooperative closure transaction kicks off. + TargetFeePerKw btcutil.Amount + // Updates is used by request creator to receive the notifications about // execution of the close channel request. Updates chan *lnrpc.CloseStatusUpdate @@ -599,19 +605,24 @@ func (s *Switch) handlePacketForward(packet *htlcPacket) error { } } -// CloseLink creates and sends the close channel command. +// CloseLink creates and sends the close channel command to the target link +// directing the specified closure type. If the closure type if CloseRegular, +// then the last parameter should be the ideal fee-per-kw that will be used as +// a starting point for close negotiation. func (s *Switch) CloseLink(chanPoint *wire.OutPoint, - closeType ChannelCloseType) (chan *lnrpc.CloseStatusUpdate, chan error) { + closeType ChannelCloseType, + targetFeePerKw btcutil.Amount) (chan *lnrpc.CloseStatusUpdate, chan error) { // TODO(roasbeef) abstract out the close updates. updateChan := make(chan *lnrpc.CloseStatusUpdate, 2) errChan := make(chan error, 1) command := &ChanClose{ - CloseType: closeType, - ChanPoint: chanPoint, - Updates: updateChan, - Err: errChan, + CloseType: closeType, + ChanPoint: chanPoint, + Updates: updateChan, + TargetFeePerKw: targetFeePerKw, + Err: errChan, } select {