-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Make MaxWaitNumBlocksFundingConf Configurable for itest #9562
base: master
Are you sure you want to change the base?
Make MaxWaitNumBlocksFundingConf Configurable for itest #9562
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
Did a quick pass: needs proper formatting, lines go to 80 chars. I think the style guide in the repo can help you fix most of these issues. Otherwise, the core change looks good
funding/manager.go
Outdated
// For the maxWaitNumBlocksFundingConf different values are set | ||
// in case we are in a dev environment so enhance test | ||
// capabilities. | ||
maxWaitNumBlocksFundingConf := MaxWaitNumBlocksFundingConf |
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.
variable name should not be reused, a bit confusing
funding/manager.go
Outdated
// MaxWaitNumBlocksFundingConf is the maximum number of blocks | ||
// to wait for the funding transaction to be confirmed before forgetting | ||
// channels that aren't initiated by us. | ||
MaxWaitNumBlocksFundingConf int |
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.
nit: can we uint32 this so we don't need the cast below? fine if not
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.
I can do that, but in that case, I need to update const MaxWaitNumBlocksFundingConf = 2016
to const MaxWaitNumBlocksFundingConf uint32 = 2016
. However, I'm not sure if this might cause any compatibility issues.
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.
It's not a big deal, just a nit so feel free to leave as-is
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.
Constants don't have a type, if you don't explicitly set one. So it can be determined at compile time. So you can easily make this uint32
and then below just do: var waitBlocksForFundingConf uint32 = MaxWaitNumBlocksFundingConf
.
funding/manager.go
Outdated
// Get the maxWaitNumBlocksFundingConf. If we are not in | ||
// development mode, this would be nil. | ||
if lncfg.IsDevBuild() { | ||
maxWaitNumBlocksFundingConf = f.cfg.Dev. |
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.
nit: one line
9e4b8e1
to
98e91b7
Compare
Hey @Crypt-iQ, I checked my code and believe I've already adhered to the 80-character limit. Could you let me know where the issue might be? (In some cases, more than 80 characters is necessary—such as in description) Also, should I add release notes for 0.19.0? |
You need to configure your IDE to use 8 chars for the tab character, otherwise the 80 character limit is hard to adhere to. |
funding/manager.go
Outdated
@@ -339,6 +340,11 @@ type DevConfig struct { | |||
// remote node's channel ready message once the channel as been marked | |||
// as `channelReadySent`. | |||
ProcessChannelReadyWait time.Duration | |||
|
|||
// MaxWaitNumBlocksFundingConf is the maximum number of blocks |
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.
For example, here the comment can go up to 80 characters but then you wrap-around
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.
Thanks, it's fixed. PTAL.
9752395
to
a8efc7e
Compare
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.
Thanks for the PR.
funding/manager.go
Outdated
// MaxWaitNumBlocksFundingConf is the maximum number of blocks | ||
// to wait for the funding transaction to be confirmed before forgetting | ||
// channels that aren't initiated by us. | ||
MaxWaitNumBlocksFundingConf int |
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.
Constants don't have a type, if you don't explicitly set one. So it can be determined at compile time. So you can easily make this uint32
and then below just do: var waitBlocksForFundingConf uint32 = MaxWaitNumBlocksFundingConf
.
funding/manager.go
Outdated
waitBlocksForFundingConf := MaxWaitNumBlocksFundingConf | ||
|
||
// Get the waitBlocksForFundingConf. If we are not in development mode, | ||
// this would be nil. |
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.
The default value of an int type is actually 0, not nil.
itest/lnd_open_channel_test.go
Outdated
ht.OpenChannelAssertPending(alice, bob, | ||
lntest.OpenChannelParams{ | ||
Amt: 500000, | ||
PushAmt: 0, | ||
}) |
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.
nit: inconsistent formatting. Should either be:
ht.OpenChannelAssertPending(alice, bob, lntest.OpenChannelParams{
Amt: 500000,
PushAmt: 0,
})
or
ht.OpenChannelAssertPending(
alice, bob, lntest.OpenChannelParams{
Amt: 500000,
PushAmt: 0,
},
)
depending on what fits with the line length limit.
// DefaultMaxWaitNumBlocksFundingConf is the maximum number of blocks to | ||
// wait for the funding transaction to confirm before forgetting | ||
// channels that aren't initiated by us. 2016 blocks is ~2 weeks. | ||
DefaultMaxWaitNumBlocksFundingConf = 2016 |
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.
Isn't this defined twice now? I think we should just use this value everywhere now and remove the one in funding
. Unless that will cause a circular package dependency, in which case we need to find a good place for it.
This commit adds an integration test that verifies the funding timeout behavior in the funding manager, in dev/integration test. Signed-off-by: Nishant Bansal <[email protected]>
Signed-off-by: Nishant Bansal <[email protected]>
a8efc7e
to
f06f0aa
Compare
Change Description
Fixes: #9511
This PR introduces a configurable parameter for the constant
MaxWaitNumBlocksFundingConf
used in funding manager. The change allows developers and integration environments to override the default value (2016 blocks) via a build tag, enabling the mining of fewer blocks to trigger timeout scenarios during testing. In production builds, the default value remains unchanged to ensure stability.Key Changes:
Steps to Test
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.