htlcswitch: update CloseLink to accept ideal fee rate
This commit is contained in:
parent
259a01b29d
commit
5a51600f95
@ -75,6 +75,12 @@ type ChanClose struct {
|
|||||||
// ChanPoint represent the id of the channel which should be closed.
|
// ChanPoint represent the id of the channel which should be closed.
|
||||||
ChanPoint *wire.OutPoint
|
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
|
// Updates is used by request creator to receive the notifications about
|
||||||
// execution of the close channel request.
|
// execution of the close channel request.
|
||||||
Updates chan *lnrpc.CloseStatusUpdate
|
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,
|
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.
|
// TODO(roasbeef) abstract out the close updates.
|
||||||
updateChan := make(chan *lnrpc.CloseStatusUpdate, 2)
|
updateChan := make(chan *lnrpc.CloseStatusUpdate, 2)
|
||||||
errChan := make(chan error, 1)
|
errChan := make(chan error, 1)
|
||||||
|
|
||||||
command := &ChanClose{
|
command := &ChanClose{
|
||||||
CloseType: closeType,
|
CloseType: closeType,
|
||||||
ChanPoint: chanPoint,
|
ChanPoint: chanPoint,
|
||||||
Updates: updateChan,
|
Updates: updateChan,
|
||||||
Err: errChan,
|
TargetFeePerKw: targetFeePerKw,
|
||||||
|
Err: errChan,
|
||||||
}
|
}
|
||||||
|
|
||||||
select {
|
select {
|
||||||
|
Loading…
Reference in New Issue
Block a user