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

BOLT 3: add test vectors for htlc-transactions in case where CLTV is used as tie-breaker for sorting #539

Open
wants to merge 3 commits into
base: master
from

Conversation

Projects
None yet
2 participants
@araspitzu
Copy link
Contributor

araspitzu commented Jan 7, 2019

Add a serialized transactions test vector for the edge case of sorting htlc-timeout-tx when there are multiple offered htlc with the same amount and preimage. The test vector reuses previous preimages and creates a case scenario with 1 received htlc and 2 offered, the two offered will have same scriptPubKey and redeemScript, but different CLTV value. It is asserted the order in which the htlc transactions should be kept internally and we assume the same order is used to construct the commitment_signed message. This complements #491 .

@araspitzu araspitzu changed the title Add test vectors for htlc-transactions for the case when the CLTV is used as tie-breaker for sorting Add test vectors for htlc-transactions for the case when CLTV is used as tie-breaker for sorting Jan 7, 2019

@araspitzu araspitzu changed the title Add test vectors for htlc-transactions for the case when CLTV is used as tie-breaker for sorting BOLT 3: add test vectors for htlc-transactions in case where CLTV is used as tie-breaker for sorting Jan 7, 2019

# HTLC 1 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688ac6868
# HTLC 2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688ac6868
# HTLC 1 and 2 have CLTV 502 and 503, respectively, all htlc have preimage 0000000000000000000000000000000000000000000000000000000000000000
output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8005e80300000000000022002052bfef0479d7b293c27e0f1eb294bea154c63a3294ef092c19af51409bce0e2ad007000000000000220020b9826699af5c86f289a6fe059b0d541048c6c9299f52ba223305f0920d953759d007000000000000220020b9826699af5c86f289a6fe059b0d541048c6c9299f52ba223305f0920d953759c0c62d0000000000160014ccf1af2f2aabee14bb40fa3851ab2301de843110a79f6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e040047304402202254e1ab2b07e8c2c9a0108d7b547b6669ec4eccb2a19ebf68078eb54936ac4902203360cf0fa62315a1154428d34e8fe85133ea4d104ea9fccee57ffabe3aa337720147304402207fb2b0030a35d5ea93297fb87804b55fb43326c8e9f9f33cdd8417cb26a1d3ef02202de9f461f715ede216c03fdb8458dd4156e1d2cbf09e235055b9f72473abafcd01475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220

This comment has been minimized.

@rustyrussell

rustyrussell Feb 4, 2019

Collaborator

But these HTLCs are defined at the top. We should define HTLC 1a and HLTC 1b if we want to do this.

This comment has been minimized.

@rustyrussell

rustyrussell Feb 4, 2019

Collaborator

And the amounts here are in satoshis, elsewhere they're in msat. And you seem to have just substituted HTLC 1 and 2, which I guess works.

This comment has been minimized.

@araspitzu

araspitzu Feb 4, 2019

Author Contributor

Fixed the sat/msat in 130f421, but i''m not sure I understand the HTLC1 and HTLC2 substituted? I just decided to stick with the sequential naming (HTLC1, HTLC2 as opposed to HLTC1a, HTLC1b) but I can change that if it's a problem.

This comment has been minimized.

@araspitzu

araspitzu Feb 6, 2019

Author Contributor

Sorry for the delay, i misunderstood your comments at first. Now 8e8b4da defines at the top 2 new htlcs (#5 and #6) with a new preimage that is shared across them, the rest of the test remains unchanged.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment