Skip to content

Commit ff1cddb

Browse files
committed
server: enable ExtraBudgetForInputs to be called before full server start up
This is a pure function that just returns what's basically a static value. There's no risk of deadlock if a caller calls into this function before the server has fully started up.
1 parent 4ffe39f commit ff1cddb

File tree

2 files changed

+10
-8
lines changed

2 files changed

+10
-8
lines changed

server.go

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1262,11 +1262,7 @@ func (s *Server) ExtraBudgetForInputs(
12621262
srvrLog.Tracef("ExtraBudgetForInputs called, inputs=%v",
12631263
lnutils.SpewLogClosure(inputs))
12641264

1265-
if err := s.waitForReady(); err != nil {
1266-
return lfn.Err[btcutil.Amount](err)
1267-
}
1268-
1269-
return s.cfg.AuxSweeper.ExtraBudgetForInputs(inputs)
1265+
return tapchannel.ExtraBudgetForInputs(inputs)
12701266
}
12711267

12721268
// NotifyBroadcast is used to notify external callers of the broadcast of a

tapchannel/aux_sweeper.go

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2557,9 +2557,7 @@ func (a *AuxSweeper) DeriveSweepAddr(inputs []input.Input,
25572557

25582558
// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget
25592559
// that should be added to the sweep transaction.
2560-
func (a *AuxSweeper) ExtraBudgetForInputs(
2561-
inputs []input.Input) lfn.Result[btcutil.Amount] {
2562-
2560+
func ExtraBudgetForInputs(inputs []input.Input) lfn.Result[btcutil.Amount] {
25632561
inputsWithBlobs := fn.Filter(inputs, func(i input.Input) bool {
25642562
return i.ResolutionBlob().IsSome()
25652563
})
@@ -2581,6 +2579,14 @@ func (a *AuxSweeper) ExtraBudgetForInputs(
25812579
return lfn.Ok(extraBudget)
25822580
}
25832581

2582+
// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget
2583+
// that should be added to the sweep transaction.
2584+
func (a *AuxSweeper) ExtraBudgetForInputs(
2585+
inputs []input.Input) lfn.Result[btcutil.Amount] {
2586+
2587+
return ExtraBudgetForInputs(inputs)
2588+
}
2589+
25842590
// NotifyBroadcast is used to notify external callers of the broadcast of a
25852591
// sweep transaction, generated by the passed BumpRequest.
25862592
func (a *AuxSweeper) NotifyBroadcast(req *sweep.BumpRequest,

0 commit comments

Comments
 (0)