Skip to content

Conversation

Roasbeef
Copy link
Member

@Roasbeef Roasbeef commented Sep 3, 2025

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.

@Roasbeef Roasbeef added this to the v0.7 milestone Sep 3, 2025
@coveralls
Copy link

coveralls commented Sep 3, 2025

Pull Request Test Coverage Report for Build 17448261145

Details

  • 0 of 6 (0.0%) changed or added relevant lines in 2 files are covered.
  • 52 unchanged lines in 8 files lost coverage.
  • Overall coverage increased (+0.01%) to 56.883%

Changes Missing Coverage Covered Lines Changed/Added Lines %
server.go 0 1 0.0%
tapchannel/aux_sweeper.go 0 5 0.0%
Files with Coverage Reduction New Missed Lines %
tapdb/addrs.go 2 78.23%
tapdb/sqlc/transfers.sql.go 2 83.33%
itest/multisig.go 3 97.91%
tapgarden/custodian.go 5 77.02%
mssmt/compacted_tree.go 6 78.48%
tapdb/multiverse.go 6 80.59%
tapgarden/re-org_watcher.go 11 71.65%
tapdb/assets_store.go 17 79.33%
Totals Coverage Status
Change from base Build 17435593956: 0.01%
Covered Lines: 61510
Relevant Lines: 108135

💛 - Coveralls

Copy link
Contributor

@ffranr ffranr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it's worth turning ExtraBudgetForInputs into a standalone function,
to make it clearer that it does not depend on s being ready. For example:

Index: tapchannel/aux_sweeper.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/tapchannel/aux_sweeper.go b/tapchannel/aux_sweeper.go
--- a/tapchannel/aux_sweeper.go	(revision b706a8d28c015191ffdcaae5496ab4b91692ca82)
+++ b/tapchannel/aux_sweeper.go	(date 1756895601606)
@@ -2554,9 +2554,7 @@
 
 // ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget
 // that should be added to the sweep transaction.
-func (a *AuxSweeper) ExtraBudgetForInputs(
-	inputs []input.Input) lfn.Result[btcutil.Amount] {
-
+func ExtraBudgetForInputs(inputs []input.Input) lfn.Result[btcutil.Amount] {
 	inputsWithBlobs := fn.Filter(inputs, func(i input.Input) bool {
 		return i.ResolutionBlob().IsSome()
 	})
@@ -2578,6 +2576,14 @@
 	return lfn.Ok(extraBudget)
 }
 
+// ExtraBudgetForInputs takes a set of inputs and maybe returns an extra budget
+// that should be added to the sweep transaction.
+func (a *AuxSweeper) ExtraBudgetForInputs(
+	inputs []input.Input) lfn.Result[btcutil.Amount] {
+
+	return ExtraBudgetForInputs(inputs)
+}
+
 // NotifyBroadcast is used to notify external callers of the broadcast of a
 // sweep transaction, generated by the passed BumpRequest.
 func (a *AuxSweeper) NotifyBroadcast(req *sweep.BumpRequest,
Index: server.go
IDEA additional info:
Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP
<+>UTF-8
===================================================================
diff --git a/server.go b/server.go
--- a/server.go	(revision b706a8d28c015191ffdcaae5496ab4b91692ca82)
+++ b/server.go	(date 1756895601593)
@@ -1265,11 +1265,7 @@
 	srvrLog.Tracef("ExtraBudgetForInputs called, inputs=%v",
 		lnutils.SpewLogClosure(inputs))
 
-	if err := s.waitForReady(); err != nil {
-		return lfn.Err[btcutil.Amount](err)
-	}
-
-	return s.cfg.AuxSweeper.ExtraBudgetForInputs(inputs)
+	return tapchannel.ExtraBudgetForInputs(inputs)
 }
 
 // NotifyBroadcast is used to notify external callers of the broadcast of a

@Roasbeef
Copy link
Member Author

Roasbeef commented Sep 3, 2025

@ffranr great suggestion, will apply that

@Roasbeef Roasbeef force-pushed the sweep-budget-non-blocking branch from 237313a to ff1cddb Compare September 3, 2025 23:00
@Roasbeef
Copy link
Member Author

Roasbeef commented Sep 3, 2025

PTAL.

…tart 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.
@Roasbeef Roasbeef force-pushed the sweep-budget-non-blocking branch from ff1cddb to 4f18d5b Compare September 3, 2025 23:03
@Roasbeef Roasbeef requested review from a team, jtobin and ffranr and removed request for a team September 3, 2025 23:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: 👀 In review
Development

Successfully merging this pull request may close these issues.

3 participants