From b201efe0546120c14bf154ce5f4e18da7243fe7a Mon Sep 17 00:00:00 2001 From: araspitzu <2931875+araspitzu@users.noreply.github.com> Date: Fri, 5 Mar 2021 09:10:26 +0100 Subject: [PATCH] BOLT 3: add test vectors for htlc-transactions in case where CLTV is used as tie-breaker for sorting (#539) 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 . --- 03-transactions.md | 431 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 429 insertions(+), 2 deletions(-) diff --git a/03-transactions.md b/03-transactions.md index 43b7ed1cd..29a98853e 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -1011,7 +1011,8 @@ In the following: - Transaction signatures are all deterministic, using RFC6979 (using HMAC-SHA256). To start, common basic parameters for each test vector are defined: the -HTLCs are not used for the first "simple commitment tx with no HTLCs" test. +HTLCs are not used for the first "simple commitment tx with no HTLCs" test, +and HTLCs 5 and 6 are only used in the "same amount and preimage" test. funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be funding_output_index: 0 @@ -1039,6 +1040,14 @@ HTLCs are not used for the first "simple commitment tx with no HTLCs" test. htlc 4 amount_msat: 4000000 htlc 4 expiry: 504 htlc 4 payment_preimage: 0404040404040404040404040404040404040404040404040404040404040404 + htlc 5 direction: local->remote + htlc 5 amount_msat: 5000000 + htlc 5 expiry: 505 + htlc 5 payment_preimage: 0505050505050505050505050505050505050505050505050505050505050505 + htlc 6 direction: local->remote + htlc 6 amount_msat: 5000000 + htlc 6 expiry: 506 + htlc 6 payment_preimage: 0505050505050505050505050505050505050505050505050505050505050505