-
Notifications
You must be signed in to change notification settings - Fork 403
Pre-scoring test clean-ups #1120
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
Pre-scoring test clean-ups #1120
Conversation
I left a few TODO comments in the primary commit where I was unsure of the change. So please take a close look at those. Everything else should be fairly mechanical. |
Codecov Report
@@ Coverage Diff @@
## main #1120 +/- ##
==========================================
+ Coverage 90.67% 90.73% +0.06%
==========================================
Files 66 66
Lines 34732 34808 +76
==========================================
+ Hits 31494 31584 +90
+ Misses 3238 3224 -14
Continue to review full report at Codecov.
|
The "Fix need for #[allow(unused_mut)] in tests" commit is largely duplicative with "Use Persister to return errors in tests not chain::Watch " in #1108, is it possible to drop that commit here and use the one from 1108? |
49e7016
to
7719633
Compare
Dropped the commit.
Reverted the marked changes to use |
lightning/src/ln/shutdown_tests.rs
Outdated
@@ -71,6 +71,9 @@ fn pre_funding_lock_shutdown_test() { | |||
check_closed_event!(nodes[1], 1, ClosureReason::CooperativeClosure); | |||
} | |||
|
|||
// TODO: Determine why get_route fails when replacing get_payment_preimage_hash with |
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 have another todo here.
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.
Mainly to note why it may be that a simple replacement doesn't work here. Can drop it if you prefer.
|
lightning/src/ln/functional_tests.rs
Outdated
let (_, second_payment_hash, second_payment_secret) = get_payment_preimage_hash!(nodes[2]); | ||
let sending_node = if forwarded_htlc { &nodes[0] } else { &nodes[1] }; | ||
let (route, second_payment_hash, _, second_payment_secret) = get_route_and_payment_hash!(sending_node, nodes[2], 100000); | ||
// TODO: Why use a different payment secret here? |
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.
Cause there's two different payments?
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.
Was unsure because they both used second_payment_hash
but a different secret.
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.
Ah, I was comparing it to the first send event further up, its just a typo I believe, feel free to drop it if the test still passes and always use the second secret.
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.
Updated to use the second secret.
lightning/src/ln/functional_tests.rs
Outdated
@@ -7906,6 +7740,8 @@ fn test_bump_penalty_txn_on_revoked_htlcs() { | |||
assert_ne!(node_txn[0].input[0].previous_output, node_txn[2].input[0].previous_output); | |||
assert_ne!(node_txn[1].input[0].previous_output, node_txn[2].input[0].previous_output); | |||
|
|||
// TODO: Determine why replacing get_route with get_route_and_payment_hash above causes |
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.
Because the tx ordering is based on the payment hash and we end up with a different hash, I assume? Or something like that, but maybe we should just drop the TODO and open a general "move the remaining explicit route calls to the routing macro" issue?
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.
SGTM
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.
ACK mod removing the todos in favor of an issue + squash
7719633
to
b6a3f5c
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.
Needs squash.
b6a3f5c
to
d700faa
Compare
@@ -9376,11 +9189,7 @@ fn test_keysend_payments_to_private_node() { | |||
nodes[1].node.peer_connected(&payer_pubkey, &msgs::Init { features: InitFeatures::known() }); | |||
|
|||
let _chan = create_chan_between_nodes(&nodes[0], &nodes[1], InitFeatures::known(), InitFeatures::known()); | |||
let network_graph = &nodes[0].net_graph_msg_handler.network_graph; | |||
let first_hops = nodes[0].node.list_usable_channels(); | |||
let route = get_keysend_route(&payer_pubkey, &network_graph, &payee_pubkey, |
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.
This seems to be the only place we call get_keysend_route
in tests through a private channel, so I think best to keep it.
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.
Reverted and updated the other keysend test to use get_keysend_route
.
d700faa
to
3e9678c
Compare
The interface for get_route will change to take a scorer. Using get_route_and_payment_hash whenever possible allows for keeping the scorer inside get_route_and_payment_hash rather than at every call site. Replace get_route with get_route_and_payment_hash wherever possible. Additionally, update get_route_and_payment_hash to use the known invoice features and the sending node's logger.
3e9678c
to
d4ec090
Compare
Replaces
get_route
withget_route_and_payment_hash
in tests wherever possible, since a scorer will need to be passed toget_route
. Also includes some fairly trivial test clean ups.