Skip to content

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

Closed
wants to merge 3 commits into from

Conversation

ariard
Copy link

@ariard ariard commented Nov 21, 2018

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.

@@ -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")}},
Copy link
Collaborator

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?

Copy link
Author

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!

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
Copy link
Collaborator

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".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah yes, corrected

Antoine Riard added 3 commits November 22, 2018 19:44
In consequence, harden spendable outputs tests

Fix vocabulary abuse
Aims to ease tests writing/debugging
Copy link
Collaborator

@TheBlueMatt TheBlueMatt left a 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 {
Copy link
Collaborator

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]);
Copy link
Collaborator

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants