-
Notifications
You must be signed in to change notification settings - Fork 412
Add an override optional UserConfig per new outbound channel #517
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
Add an override optional UserConfig per new outbound channel #517
Conversation
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.
Awesome, thanks for the PR! I think the testing could possibly be expanded a tad, but overall it's looking very good.
lightning/src/ln/functional_tests.rs
Outdated
|
||
// Node0 initiates a channel to node1 using the override config. | ||
let mut override_config = UserConfig::default(); | ||
override_config.own_channel_config.our_to_self_delay = 200; |
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 looks like the existing testing for bad UserConfig values is pretty light -- this test could be a good opportunity to add some more :)
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 this 1st PR, overall looks good to me, can you squash functional test and fuzzing fixes commit to avoid breaking git bisect
? Also rebase on master to avoid the fixup one.
lightning/src/ln/channelmanager.rs
Outdated
if channel_value_satoshis < 1000 { | ||
return Err(APIError::APIMisuseError { err: "channel_value must be at least 1000 satoshis" }); | ||
} | ||
|
||
let channel = Channel::new_outbound(&*self.fee_estimator, &self.keys_manager, their_network_key, channel_value_satoshis, push_msat, user_id, Arc::clone(&self.logger), &self.default_configuration)?; | ||
let channel = match override_config { |
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.
You may try
if override_config.is_some() { override_config.as_ref().unwrap() } else { &self.default_configuration }
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.
So in regards to the git jobs, I've squashed and dropped the fixup. My bad, looking back at the contribution guidelines I missed this:
Further, each commit, individually, should compile and pass tests, in order to ensure git bisect and other automated tools function properly.
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.
@ariard's suggested change here would probably make this more readable. Also, it looks like you replaced all the indentation here with spaces. Please don't mix indentation types in a 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.
thanks and appreciate the review @TheBlueMatt, I'll start work on the requested changes
thank for the review @valentinewallace and @ariard, I'll get started on the comments :) |
b4e7ec6
to
fe154c8
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.
Just needs a few nits addressed and the commits squashed.
lightning/src/ln/channelmanager.rs
Outdated
if channel_value_satoshis < 1000 { | ||
return Err(APIError::APIMisuseError { err: "channel_value must be at least 1000 satoshis" }); | ||
} | ||
|
||
let channel = Channel::new_outbound(&*self.fee_estimator, &self.keys_manager, their_network_key, channel_value_satoshis, push_msat, user_id, Arc::clone(&self.logger), &self.default_configuration)?; | ||
let channel = match override_config { |
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.
@ariard's suggested change here would probably make this more readable. Also, it looks like you replaced all the indentation here with spaces. Please don't mix indentation types in a file.
lightning/src/ln/functional_tests.rs
Outdated
|
||
#[test] | ||
fn test_override_channel_config() { | ||
let chanmon_cfgs = create_chanmon_cfgs(2); |
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: Same here, please use indentation characters instead of spaces.
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.
fixed both, perhaps better to work on the requested updates to the tests before squashing? - might be easier for everyone to match the review requested per commit
Looks good. Needs rebase but otherwise probably fine to go. I dont know that this needs more tests for the new functionality, only that our general config infrastructure likely does. |
0a08644
to
849c514
Compare
849c514
to
53c894b
Compare
Ok sounds good, maybe I could help review a PR or look into further testing on the config infrastructure. Squashed and rebased. |
fixes #485
This PR adds an optional
UserConfig
parameter when callingcreate_channel()
inChannelManager
.The idea is that if this option is None,
ChannelManager
will revert to thedefault_configuration
found in its own fields or the user can provide their own configuration for a particular channel.Also to add that in the original issue, there was some discussion about implementing a tracked peer-per channel config as in a "whitelist" of pubkeys. It seems like an interesting idea, but I thought that would deserve its own attempt at a PR - since I think we would still need to switch between a
default
and anoverride
config per channel.