htlcswitch: update CloseLink to accept ideal fee rate

This commit is contained in:
Olaoluwa Osuntokun 2017-11-23 01:28:16 -06:00
parent 259a01b29d
commit 5a51600f95
No known key found for this signature in database
GPG Key ID: 964EA263DD637C21

@ -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,9 +605,13 @@ 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)
@ -611,6 +621,7 @@ func (s *Switch) CloseLink(chanPoint *wire.OutPoint,
CloseType: closeType,
ChanPoint: chanPoint,
Updates: updateChan,
TargetFeePerKw: targetFeePerKw,
Err: errChan,
}