-
Notifications
You must be signed in to change notification settings - Fork 132
server: enable ExtraBudgetForInputs to be called before full server start up #1780
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
Roasbeef
wants to merge
1
commit into
lightninglabs:main
Choose a base branch
from
Roasbeef:sweep-budget-non-blocking
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Pull Request Test Coverage Report for Build 17448261145Details
💛 - Coveralls |
ffranr
reviewed
Sep 3, 2025
There was a problem hiding this 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
@ffranr great suggestion, will apply that |
237313a
to
ff1cddb
Compare
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.
ff1cddb
to
4f18d5b
Compare
ffranr
approved these changes
Sep 3, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.