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
Refactor channelmanager tests into more appropriate submodule tests #2977
base: main
Are you sure you want to change the base?
Refactor channelmanager tests into more appropriate submodule tests #2977
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## main #2977 +/- ##
==========================================
- Coverage 89.82% 89.76% -0.07%
==========================================
Files 116 119 +3
Lines 96466 96480 +14
Branches 96466 96480 +14
==========================================
- Hits 86655 86602 -53
- Misses 7264 7314 +50
- Partials 2547 2564 +17 ☔ View full report in Codecov by Sentry. |
8eda436
to
388e6bc
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.
Note that you'll probably have to rebase this after #2731 adds a new test.
388e6bc
to
e75b405
Compare
Will take care of that for sure 👍 |
e75b405
to
30dcf01
Compare
@TheBlueMatt updated changes from main after the merge of #2731 Took care of added test |
30dcf01
to
f585d35
Compare
e50313f
to
77fc367
Compare
#[test] | ||
fn bad_inbound_payment_hash() { | ||
// Add coverage for checking that a user-provided payment hash matches the payment secret. | ||
let chanmon_cfgs = create_chanmon_cfgs(2); | ||
let node_cfgs = create_node_cfgs(2, &chanmon_cfgs); | ||
let node_chanmgrs = create_node_chanmgrs(2, &node_cfgs, &[None, None]); | ||
let nodes = create_network(2, &node_cfgs, &node_chanmgrs); | ||
node_cfgs[0].keys_manager.get_inbound_payment_key_material(); | ||
|
||
let highest_seen_timestamp = bitcoin::blockdata::constants::genesis_block(bitcoin::Network::Testnet).header.time; | ||
let node_signer = node_cfgs[0].keys_manager; | ||
let inbound_pmt_key_material = node_signer.get_inbound_payment_key_material(); | ||
let expanded_inbound_key = inbound_payment::ExpandedKey::new(&inbound_pmt_key_material); | ||
|
||
let (_, payment_hash, payment_secret) = get_payment_preimage_hash!(&nodes[0]); | ||
let payment_data = msgs::FinalOnionHopData { | ||
payment_secret, | ||
total_msat: 100_000, | ||
}; | ||
|
||
|
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.
@TheBlueMatt I have refactored this test, can you go through this whether this behaves as expected ?
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.
Basically I tried to untie the dependency between the channelmanagers internal state, let me know if there is better way
// Should we drop this check ? | ||
// Assert that ChannelUpdate message has been added to node[0] pending broadcast messages | ||
// let pending_broadcast_messages = nodes[0].node.get_and_clear_pending_msg_events(); | ||
// assert_eq!(pending_broadcast_messages.len(), 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.
@TheBlueMatt I had to remove this check, because this effects the at the 703-704 and fails
I am not able to figure out the reason why this is happening
This might need a rebase by now - sorry! |
Thanks, will rebase with main. |
If you do the move-only parts in a separate move-only commit it'll be pretty easy to see with |
77fc367
to
e4dfd72
Compare
Rebased with main |
* Few tests were dependent on channelmanagers internal state, refactored that them to publicly visible apis
e4dfd72
to
162ddea
Compare
Fix #2958
Previously
channelmanager
had a single test module withintchannelmanager.rs
This changes introduces moving refactoring
23
tests ofchannelmanager
into following test groupsGroup 1: Key Send and Payment Verification
Group 2: Channel Management and Limits
Group 3: Anchor Channel and Configuration Tests