From dcb50b5e06ce685cb3401188a4e9627bfda800bb Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 11 Nov 2020 21:12:27 +0100 Subject: [PATCH 1/4] BOLT#3: use 4 bytes for cltv_expiry in accepted_htlc_script --- 03-transactions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/03-transactions.md b/03-transactions.md index d2ef02037..3aa647a71 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -829,7 +829,7 @@ Multiplying non-witness data by 4 results in a weight of: The *expected weight* of an HTLC transaction is calculated as follows: - accepted_htlc_script: 139 bytes (142 bytes with option_anchor_outputs) + accepted_htlc_script: 140 bytes (143 bytes with option_anchor_outputs) - OP_DUP: 1 byte - OP_HASH160: 1 byte - OP_DATA: 1 byte (RIPEMD160(SHA256(revocationpubkey)) length) @@ -859,7 +859,7 @@ The *expected weight* of an HTLC transaction is calculated as follows: - OP_ELSE: 1 byte - OP_DROP: 1 byte - OP_DATA: 1 byte (cltv_expiry length) - - cltv_expiry: 3 bytes + - cltv_expiry: 4 bytes - OP_CHECKLOCKTIMEVERIFY: 1 byte - OP_DROP: 1 byte - OP_CHECKSIG: 1 byte From a9e064d04f313032d38407f75c3f1c53e32ad562 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 11 Nov 2020 21:13:03 +0100 Subject: [PATCH 2/4] BOLT#3: correct success_witness size Regardless of the previous commit, this didn't add up --- 03-transactions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/03-transactions.md b/03-transactions.md index 3aa647a71..39800f7be 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -916,7 +916,7 @@ The *expected weight* of an HTLC transaction is calculated as follows: - witness_script_length: 1 byte - witness_script (offered_htlc_script) - success_witness: 325 bytes (328 bytes with option_anchor_outputs) + success_witness: 324 bytes (327 bytes with option_anchor_outputs) - number_of_witness_elements: 1 byte - nil_length: 1 byte - sig_alice_length: 1 byte From 9fdee1ead4c7a4fc61c7a44995d6beeae08d3dee Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Wed, 11 Nov 2020 21:13:35 +0100 Subject: [PATCH 3/4] BOLT#3: note HTLC tx wieghts differ a bit from actual weights --- 03-transactions.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/03-transactions.md b/03-transactions.md index 39800f7be..633ceaddd 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -954,11 +954,12 @@ The *expected weight* of an HTLC transaction is calculated as follows: - lock_time: 4 bytes Multiplying non-witness data by 4 results in a weight of 376. Adding -the witness data for each case (285 or 288 + 2 for HTLC-timeout, 325 or 328 + 2 for +the witness data for each case (285 or 288 + 2 for HTLC-timeout, 324 or 327 + 2 for HTLC-success) results in weights of: 663 (HTLC-timeout) (666 with with option_anchor_outputs)) - 703 (HTLC-success) (706 with with option_anchor_outputs)) + 703 (HTLC-success) (706 with with option_anchor_outputs)) + - (really 702 and 705, but we use these numbers for historical reasons) # Appendix B: Funding Transaction Test Vectors From 2a8da1a3ef06f224a296c98e22c94db25ea41506 Mon Sep 17 00:00:00 2001 From: "Johan T. Halseth" Date: Fri, 27 Nov 2020 09:18:16 +0100 Subject: [PATCH 4/4] bolt3: remove double 'with' --- 03-transactions.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/03-transactions.md b/03-transactions.md index 633ceaddd..0a51e3bb8 100644 --- a/03-transactions.md +++ b/03-transactions.md @@ -957,8 +957,8 @@ Multiplying non-witness data by 4 results in a weight of 376. Adding the witness data for each case (285 or 288 + 2 for HTLC-timeout, 324 or 327 + 2 for HTLC-success) results in weights of: - 663 (HTLC-timeout) (666 with with option_anchor_outputs)) - 703 (HTLC-success) (706 with with option_anchor_outputs)) + 663 (HTLC-timeout) (666 with option_anchor_outputs)) + 703 (HTLC-success) (706 with option_anchor_outputs)) - (really 702 and 705, but we use these numbers for historical reasons) # Appendix B: Funding Transaction Test Vectors