-
Notifications
You must be signed in to change notification settings - Fork 411
Add test_claim_on_remote_revoked_sizeable_push_msat #256
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
Conversation
src/ln/channelmanager.rs
Outdated
@@ -7673,7 +7673,7 @@ mod tests { | |||
spend_tx.input[0].witness.push(remotepubkey.serialize().to_vec()); | |||
txn.push(spend_tx); | |||
}, | |||
_ => panic!("Unexpected event"), | |||
_ => { if $expected == true {} else { panic!("Unexpected event")}}, |
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.
Ouch, I really hate throwing away events. Can you instead refactor the macros to test all of the outputs notified?
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.
Done, merge all into one, should have been done at #230 but was already big!
src/ln/channelmanager.rs
Outdated
assert_eq!(spend_txn.len(), 2); | ||
assert_eq!(spend_txn[0], spend_txn[1]); | ||
check_spends!(spend_txn[0], node_txn[0].clone()); | ||
} | ||
|
||
#[test] | ||
fn test_claim_on_remote_revoked_sizeable_push_msat() { | ||
// Same test as precedent, just test on remote revoked commitment tx, as per_commitment_point registration changes following you're funder/fundee and |
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.
Heh, I guess I didn't catch this in #230, but I think you want "previous" not "precedent".
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 yes, corrected
In consequence, harden spendable outputs tests Fix vocabulary abuse
Aims to ease tests writing/debugging
69cef7b
to
ba0549f
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.
Will take as #259 with the changes listed here (skipping the last commit, feel free to slip it in somewhere else if you really want it, or if I'm wrong).
@@ -4167,6 +4167,27 @@ mod tests { | |||
nodes | |||
} | |||
|
|||
macro_rules! display_txn { |
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.
Hmm, why bother adding this (it looks unused atm)? Can't we just "{:?}" the transaction itself, or did you write this and accidentally commit it?
check_spends!(spend_tx, node_txn[3].clone()); | ||
let spend_txn = check_spendable_outputs!(nodes[0], 1); | ||
assert_eq!(spend_txn.len(), 5); | ||
assert_eq!(spend_txn[1], spend_txn[3]); |
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 think you meant to assert spend_txn[0] == spend_txn[2] here, too.
Just add a test for the sizeable push_msat branch on revoked tx in check_spend_remote_tx that I forgot in #230
Note : may combine check_output macros into a generic one the future if there is more tests with multiplication of cases.