Skip to content

Commit e413759

Browse files
committed
contractcourt: Always register anchors with sweeper.
Even if no HTLCs are at stake we are going to register the anchor outputs with the sweeper subsystem with a default high deadline. We need to do this, because otherwise we are not able to bump the fee of the closing transaction manually.
1 parent 7f9fbbe commit e413759

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

contractcourt/channel_arbitrator.go

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,12 @@ const (
4040
// arbitratorBlockBufferSize is the size of the buffer we give to each
4141
// channel arbitrator.
4242
arbitratorBlockBufferSize = 20
43+
44+
// AnchorOutputValue is the output value for the anchor output of an
45+
// anchor channel.
46+
// See BOLT 03 for more details:
47+
// https://github.com/lightning/bolts/blob/master/03-transactions.md
48+
AnchorOutputValue = btcutil.Amount(330)
4349
)
4450

4551
// WitnessSubscription represents an intent to be notified once new witnesses
@@ -1313,13 +1319,14 @@ func (c *ChannelArbitrator) sweepAnchors(anchors *lnwallet.AnchorResolutions,
13131319
}
13141320

13151321
// If we cannot find a deadline, it means there's no HTLCs at
1316-
// stake, which means we can relax our anchor sweeping as we
1317-
// don't have any time sensitive outputs to sweep.
1322+
// stake, which means we can relax our anchor sweeping
1323+
// conditions as we don't have any time sensitive outputs to
1324+
// sweep. However we need to register the anchor output with the
1325+
// sweeper so we are later able to bump the close fee.
13181326
if deadline.IsNone() {
13191327
log.Infof("ChannelArbitrator(%v): no HTLCs at stake, "+
1320-
"skipped anchor CPFP", c.cfg.ChanPoint)
1321-
1322-
return nil
1328+
"sweeping anchor with default deadline",
1329+
c.cfg.ChanPoint)
13231330
}
13241331

13251332
witnessType := input.CommitmentAnchor
@@ -1357,10 +1364,13 @@ func (c *ChannelArbitrator) sweepAnchors(anchors *lnwallet.AnchorResolutions,
13571364
// Calculate the budget based on the value under protection,
13581365
// which is the sum of all HTLCs on this commitment subtracted
13591366
// by their budgets.
1367+
// The anchor output in itself has a small output value of 330
1368+
// sats so we also include it in the budget to pay for the
1369+
// cpfp transaction.
13601370
budget := calculateBudget(
13611371
value, c.cfg.Budget.AnchorCPFPRatio,
13621372
c.cfg.Budget.AnchorCPFP,
1363-
)
1373+
) + AnchorOutputValue
13641374

13651375
log.Infof("ChannelArbitrator(%v): offering anchor from %s "+
13661376
"commitment %v to sweeper with deadline=%v, budget=%v",

0 commit comments

Comments
 (0)