@@ -526,7 +526,7 @@ func (s *UtxoSweeper) SweepInput(inp input.Input,
526
526
}
527
527
528
528
absoluteTimeLock , _ := inp .RequiredLockTime ()
529
- log .Infof ("Sweep request received: out_point=%v, witness_type=%v, " +
529
+ log .Debugf ("Sweep request received: out_point=%v, witness_type=%v, " +
530
530
"relative_time_lock=%v, absolute_time_lock=%v, amount=%v, " +
531
531
"parent=(%v), params=(%v)" , inp .OutPoint (), inp .WitnessType (),
532
532
inp .BlocksToMaturity (), absoluteTimeLock ,
@@ -732,7 +732,18 @@ func (s *UtxoSweeper) collector(blockEpochs <-chan *chainntnfs.BlockEpoch) {
732
732
inputs := s .updateSweeperInputs ()
733
733
734
734
log .Debugf ("Received new block: height=%v, attempt " +
735
- "sweeping %d inputs" , epoch .Height , len (inputs ))
735
+ "sweeping %d inputs:\n %s" ,
736
+ epoch .Height , len (inputs ),
737
+ lnutils .NewLogClosure (func () string {
738
+ inps := make (
739
+ []input.Input , 0 , len (inputs ),
740
+ )
741
+ for _ , in := range inputs {
742
+ inps = append (inps , in )
743
+ }
744
+
745
+ return inputTypeSummary (inps )
746
+ }))
736
747
737
748
// Attempt to sweep any pending inputs.
738
749
s .sweepPendingInputs (inputs )
@@ -1203,13 +1214,29 @@ func (s *UtxoSweeper) mempoolLookup(op wire.OutPoint) fn.Option[wire.MsgTx] {
1203
1214
return s .cfg .Mempool .LookupInputMempoolSpend (op )
1204
1215
}
1205
1216
1206
- // handleNewInput processes a new input by registering spend notification and
1207
- // scheduling sweeping for it .
1208
- func (s * UtxoSweeper ) handleNewInput ( input * sweepInputMessage ) error {
1217
+ // calculateDefaultDeadline calculates the default deadline height for a sweep
1218
+ // request that has no deadline height specified .
1219
+ func (s * UtxoSweeper ) calculateDefaultDeadline ( pi * SweeperInput ) int32 {
1209
1220
// Create a default deadline height, which will be used when there's no
1210
1221
// DeadlineHeight specified for a given input.
1211
1222
defaultDeadline := s .currentHeight + int32 (s .cfg .NoDeadlineConfTarget )
1212
1223
1224
+ // If the input is immature and has a locktime, we'll use the locktime
1225
+ // height as the starting height.
1226
+ matured , locktime := pi .isMature (uint32 (s .currentHeight ))
1227
+ if ! matured {
1228
+ defaultDeadline = int32 (locktime + s .cfg .NoDeadlineConfTarget )
1229
+ log .Debugf ("Input %v is immature, using locktime=%v instead " +
1230
+ "of current height=%d" , pi .OutPoint (), locktime ,
1231
+ s .currentHeight )
1232
+ }
1233
+
1234
+ return defaultDeadline
1235
+ }
1236
+
1237
+ // handleNewInput processes a new input by registering spend notification and
1238
+ // scheduling sweeping for it.
1239
+ func (s * UtxoSweeper ) handleNewInput (input * sweepInputMessage ) error {
1213
1240
outpoint := input .input .OutPoint ()
1214
1241
pi , pending := s .inputs [outpoint ]
1215
1242
if pending {
@@ -1234,15 +1261,22 @@ func (s *UtxoSweeper) handleNewInput(input *sweepInputMessage) error {
1234
1261
Input : input .input ,
1235
1262
params : input .params ,
1236
1263
rbf : rbfInfo ,
1237
- // Set the acutal deadline height.
1238
- DeadlineHeight : input .params .DeadlineHeight .UnwrapOr (
1239
- defaultDeadline ,
1240
- ),
1241
1264
}
1242
1265
1266
+ // Set the acutal deadline height.
1267
+ pi .DeadlineHeight = input .params .DeadlineHeight .UnwrapOr (
1268
+ s .calculateDefaultDeadline (pi ),
1269
+ )
1270
+
1243
1271
s .inputs [outpoint ] = pi
1244
1272
log .Tracef ("input %v, state=%v, added to inputs" , outpoint , pi .state )
1245
1273
1274
+ log .Infof ("Registered sweep request at block %d: out_point=%v, " +
1275
+ "witness_type=%v, amount=%v, deadline=%d, params=(%v)" ,
1276
+ s .currentHeight , pi .OutPoint (), pi .WitnessType (),
1277
+ btcutil .Amount (pi .SignDesc ().Output .Value ), pi .DeadlineHeight ,
1278
+ pi .params )
1279
+
1246
1280
// Start watching for spend of this input, either by us or the remote
1247
1281
// party.
1248
1282
cancel , err := s .monitorSpend (
@@ -1656,7 +1690,7 @@ func (s *UtxoSweeper) handleBumpEventTxFailed(resp *bumpResp) {
1656
1690
r := resp .result
1657
1691
tx , err := r .Tx , r .Err
1658
1692
1659
- log .Errorf ("Fee bump attempt failed for tx=%v: %v" , tx .TxHash (), err )
1693
+ log .Warnf ("Fee bump attempt failed for tx=%v: %v" , tx .TxHash (), err )
1660
1694
1661
1695
// NOTE: When marking the inputs as failed, we are using the input set
1662
1696
// instead of the inputs found in the tx. This is fine for current
0 commit comments