Skip to content
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

lnwallet: update Bolt3 test vectors #7439

Merged

Conversation

ellemouton
Copy link
Collaborator

@ellemouton ellemouton commented Feb 22, 2023

This PR updates adds the option-zero-fee-htlc-tx test vectors.
It also adds the new "same amount and preimage" tests that were missing from the existing legacy and anchor tests.

Fixes #7407

@ellemouton ellemouton force-pushed the bolt3-test-vectors branch 2 times, most recently from 7701631 to 3977c35 Compare February 22, 2023 20:37
Copy link
Collaborator

@sputn1ck sputn1ck left a comment

Choose a reason for hiding this comment

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

tACK and LGTM! 🚀

lnwallet/test_vectors_anchors.json Show resolved Hide resolved
@ellemouton
Copy link
Collaborator Author

Just FYI: the Bolts PR got merged. Can confirm that LDK & Eclair match with these vectors

Copy link
Member

@yyforyongyu yyforyongyu left a comment

Choose a reason for hiding this comment

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

LGTM🥳 Thanks for taking care of the format fixes!

test := test
for _, test := range testCases {
test := test
name := fmt.Sprintf("%s-%s", set.name, test.Name)
Copy link
Member

Choose a reason for hiding this comment

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

niiiice

@@ -251,6 +303,18 @@ func addTestHtlcs(t *testing.T, remote,
func testVectors(t *testing.T, chanType channeldb.ChannelType, test testCase) {
tc := newTestContext(t)

// Determine which htlc set to use.
testHtlcs := testHtlcsSet1
if strings.Contains(test.Name, "same amount and preimage") {
Copy link
Member

Choose a reason for hiding this comment

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

🧐

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

yeah - weird I know 🙃 but the spec does actually define this test like this 🙈

@guggero guggero added this to the v0.16.1 milestone Mar 6, 2023
@saubyk saubyk changed the base branch from master to 0-16-1-staging March 16, 2023 15:23
In this commit, an assertion is added to the bolt 3 commitment tx tests
that ensures that the local and remote balances add up to the expected
funding amount. Adding this assertion uncovered a borked test vector
which is also fixed in this commit.
Add a new test htlc set comprised of htlc 1 from the original set and
two new htlcs, 5 and 6, that use the same preimage and have the same
output value (in sats). This htlc set is used in tests that assert the
ordering of htlcs  that have the same preimage and output value.
@guggero guggero merged commit 2e8dc7b into lightningnetwork:0-16-1-staging Mar 16, 2023
@ellemouton ellemouton deleted the bolt3-test-vectors branch March 16, 2023 17:47
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.

spec: add new anchor tx test vectors
4 participants