bolt3

Lightning transaction and script formats, per BOLT #3 (docs.ppad.tech/bolt3).
git clone git://git.ppad.tech/bolt3.git
Log | Files | Refs | README | LICENSE

03-transactions.md (194359B)


      1 # BOLT #3: Bitcoin Transaction and Script Formats
      2 
      3 This details the exact format of on-chain transactions, which both sides need to agree on to ensure signatures are valid. This consists of the funding transaction output script, the commitment transactions, and the HTLC transactions.
      4 
      5 # Table of Contents
      6 
      7   * [Transactions](#transactions)
      8     * [Transaction Output Ordering](#transaction-output-ordering)
      9     * [Use of Segwit](#use-of-segwit)
     10     * [Funding Transaction Output](#funding-transaction-output)
     11     * [Commitment Transaction](#commitment-transaction)
     12         * [Commitment Transaction Outputs](#commitment-transaction-outputs)
     13           * [`to_local` Output](#to_local-output)
     14           * [`to_remote` Output](#to_remote-output)
     15           * [`to_local_anchor` and `to_remote_anchor`](#to_local_anchor-and-to_remote_anchor-output-option_anchors)
     16           * [`shared_anchor`](#shared_anchor-output-zero_fee_commitments)
     17           * [Offered HTLC Outputs](#offered-htlc-outputs)
     18           * [Received HTLC Outputs](#received-htlc-outputs)
     19         * [Trimmed Outputs](#trimmed-outputs)
     20     * [HTLC-timeout and HTLC-success Transactions](#htlc-timeout-and-htlc-success-transactions)
     21     * [Legacy Closing Transaction](#legacy-closing-transaction)
     22 	* [Closing Transaction](#closing-transaction)
     23     * [Fees](#fees)
     24         * [Fee Calculation](#fee-calculation)
     25         * [Fee Payment](#fee-payment)
     26         * [Calculating Fees for Collaborative Transactions](#calculating-fees-for-collaborative-transactions)
     27     * [Dust Limits](#dust-limits)
     28     * [Commitment Transaction Construction](#commitment-transaction-construction)
     29   * [Keys](#keys)
     30     * [Key Derivation](#key-derivation)
     31         * [`localpubkey`, `local_htlcpubkey`, `remote_htlcpubkey`, `local_delayedpubkey`, and `remote_delayedpubkey` Derivation](#localpubkey-local_htlcpubkey-remote_htlcpubkey-local_delayedpubkey-and-remote_delayedpubkey-derivation)
     32         * [`remotepubkey` Derivation](#remotepubkey-derivation)
     33         * [`revocationpubkey` Derivation](#revocationpubkey-derivation)
     34         * [Per-commitment Secret Requirements](#per-commitment-secret-requirements)
     35     * [Efficient Per-commitment Secret Storage](#efficient-per-commitment-secret-storage)
     36   * [Appendix A: Expected Weights](#appendix-a-expected-weights)
     37       * [Expected Weight of the Funding Transaction (v2 Channel Establishment)](#expected-weight-of-the-funding-transaction-v2-channel-establishment)
     38       * [Expected Weight of the Commitment Transaction](#expected-weight-of-the-commitment-transaction)
     39       * [Expected Weight of HTLC-timeout and HTLC-success Transactions](#expected-weight-of-htlc-timeout-and-htlc-success-transactions)
     40   * [Appendix B: Funding Transaction Test Vectors](#appendix-b-funding-transaction-test-vectors)
     41   * [Appendix C: Commitment and HTLC Transaction Test Vectors](#appendix-c-commitment-and-htlc-transaction-test-vectors)
     42   * [Appendix D: Per-commitment Secret Generation Test Vectors](#appendix-d-per-commitment-secret-generation-test-vectors)
     43     * [Generation Tests](#generation-tests)
     44     * [Storage Tests](#storage-tests)
     45   * [Appendix E: Key Derivation Test Vectors](#appendix-e-key-derivation-test-vectors)
     46   * [Appendix F: Commitment and HTLC Transaction Test Vectors (anchors)](#appendix-f-commitment-and-htlc-transaction-test-vectors-anchors)
     47   * [Appendix G: Dual Funded Transaction Test Vectors](#appendix-g-dual-funded-transaction-test-vectors)
     48   * [Appendix H: Commitment and HTLC Transaction Test Vectors (zero-fee-commitments)](#appendix-h-commitment-and-htlc-transaction-test-vectors-zero-fee-commitments)
     49   * [References](#references)
     50   * [Authors](#authors)
     51 
     52 # Transactions
     53 
     54 ## Transaction Output Ordering
     55 
     56 Outputs in transactions are always sorted according to:
     57  * first according to their value, smallest first (in whole satoshis, note that for HTLC outputs, the millisatoshi part must be ignored)
     58  * followed by `scriptpubkey`, comparing the common-length prefix lexicographically as if by `memcmp`, then selecting the shorter script (if they differ in length),
     59  * finally, for HTLC outputs, in increasing `cltv_expiry` order.
     60 
     61 ## Rationale
     62 
     63 Two offered HTLCs which have the same `amount` (rounded from `amount_msat`) and
     64 `payment_hash` will have identical outputs, even if their `cltv_expiry`
     65 differs.  This only matters because the same ordering is used to send
     66 `htlc_signatures` and the HTLC transactions themselves are different, thus the
     67 two peers must agree on the canonical ordering for this case.
     68 
     69 ## Use of Segwit
     70 
     71 Most transaction outputs used here are pay-to-witness-script-hash<sup>[BIP141](https://github.com/bitcoin/bips/blob/master/bip-0141.mediawiki#witness-program)</sup> (P2WSH) outputs: the Segwit version of P2SH. To spend such outputs, the last item on the witness stack must be the actual script that was used to generate the P2WSH output that is being spent. This last item has been omitted for brevity in the rest of this document.
     72 
     73 A `<>` designates an empty vector as required for compliance with MINIMALIF-standard rule.<sup>[MINIMALIF](https://lists.linuxfoundation.org/pipermail/bitcoin-dev/2016-August/013014.html)</sup>
     74 
     75 ## Funding Transaction Output
     76 
     77 * The funding output script is a P2WSH to:
     78 
     79 `2 <pubkey1> <pubkey2> 2 OP_CHECKMULTISIG`
     80 
     81 * Where `pubkey1` is the lexicographically lesser of the two `funding_pubkey` in compressed format, and where `pubkey2` is the lexicographically greater of the two.
     82 
     83 ## Commitment Transaction
     84 
     85 * version: 3 when using `zero_fee_commitments`, otherwise 2
     86 * locktime: upper 8 bits are 0x20, lower 24 bits are the lower 24 bits of the obscured commitment number
     87 * txin count: 1
     88    * `txin[0]` outpoint: `txid` and `output_index` from `funding_created` message
     89    * `txin[0]` sequence: upper 8 bits are 0x80, lower 24 bits are upper 24 bits of the obscured commitment number
     90    * `txin[0]` script bytes: 0
     91    * `txin[0]` witness: `0 <signature_for_pubkey1> <signature_for_pubkey2>`
     92 
     93 The 48-bit commitment number is obscured by `XOR` with the lower 48 bits of:
     94 
     95     SHA256(payment_basepoint from open_channel || payment_basepoint from accept_channel)
     96 
     97 This obscures the number of commitments made on the channel in the
     98 case of unilateral close, yet still provides a useful index for both
     99 nodes (who know the `payment_basepoint`s) to quickly find a revoked
    100 commitment transaction.
    101 
    102 ### Commitment Transaction Outputs
    103 
    104 To allow an opportunity for penalty transactions, in case of a revoked commitment transaction, all outputs that return funds to the owner of the commitment transaction (a.k.a. the "local node") must be delayed for `to_self_delay` blocks. For HTLCs this delay is done in a second-stage HTLC transaction (HTLC-success for HTLCs accepted by the local node, HTLC-timeout for HTLCs offered by the local node).
    105 
    106 The reason for the separate transaction stage for HTLC outputs is so that HTLCs can timeout or be fulfilled even though they are within the `to_self_delay` delay.
    107 Otherwise, the required minimum timeout on HTLCs is lengthened by this delay, causing longer timeouts for HTLCs traversing the network.
    108 
    109 The amounts for each output MUST be rounded down to whole satoshis.
    110 If this amount, minus the fees for the HTLC transaction, is less than the `dust_limit_satoshis` set by the owner of the commitment transaction, the output MUST NOT be produced (thus the funds add to fees).
    111 If `zero_fee_commitments` is used, the amount may be partially added to the `shared_anchor` as detailed [here](#shared_anchor-output-zero_fee_commitments).
    112 
    113 #### `to_local` Output
    114 
    115 This output sends funds back to the owner of this commitment transaction and thus must be timelocked using `OP_CHECKSEQUENCEVERIFY`. It can be claimed, without delay, by the other party if they know the revocation private key. The output is a version-0 P2WSH, with a witness script:
    116 
    117     OP_IF
    118         # Penalty transaction
    119         <revocationpubkey>
    120     OP_ELSE
    121         `to_self_delay`
    122         OP_CHECKSEQUENCEVERIFY
    123         OP_DROP
    124         <local_delayedpubkey>
    125     OP_ENDIF
    126     OP_CHECKSIG
    127 
    128 The output is spent by an input with `nSequence` field set to `to_self_delay` (which can only be valid after that duration has passed) and witness:
    129 
    130     <local_delayedsig> <>
    131 
    132 If a revoked commitment transaction is published, the other party can spend this output immediately with the following witness:
    133 
    134     <revocation_sig> 1
    135 
    136 #### `to_remote` Output
    137 
    138 If `option_anchors` applies to the commitment transaction, the `to_remote` output is encumbered by a one block csv lock.
    139 
    140     <remotepubkey> OP_CHECKSIGVERIFY 1 OP_CHECKSEQUENCEVERIFY
    141 
    142 The output is spent by an input with `nSequence` field set to `1` and witness:
    143 
    144     <remote_sig>
    145 
    146 Otherwise, this output is a simple P2WPKH to `remotepubkey`.
    147 
    148 #### `to_local_anchor` and `to_remote_anchor` Output (option_anchors)
    149 
    150 This output can be spent by the local and remote nodes respectively to provide incentive to mine the transaction, using child-pays-for-parent. Both
    151 anchor outputs are always added, except for the case where there are no htlcs and one of the parties has a commitment output that is below the dust limit.
    152 In that case only an anchor is added for the commitment output that does materialize. This typically happens if the initiator closes right after opening
    153 (no `to_remote` output).
    154 
    155     <local_funding_pubkey/remote_funding_pubkey> OP_CHECKSIG OP_IFDUP
    156     OP_NOTIF
    157         OP_16 OP_CHECKSEQUENCEVERIFY
    158     OP_ENDIF
    159 
    160 Each party has its own anchor output that locks to their funding key. This is to prevent a malicious peer from attaching child transactions with a low fee
    161 density to an anchor and thereby blocking the victim from getting the commit tx confirmed in time. This defense is supported by a change in Bitcoin core 0.19:
    162 https://github.com/bitcoin/bitcoin/pull/15681. This is also the reason that every non-anchor output on the commit tx is CSV locked.
    163 
    164 To prevent utxo set pollution, any anchor that remains unspent can be spent by anyone after the commitment tx confirms. This is also the reason to lock
    165 the anchor outputs to the funding key. Third parties can observe this key and reconstruct the spend script, even if none of the commitment outputs would
    166 be spent. This does assume that at some point the fee market goes down to a level where sweeping the anchors is economical.
    167 
    168 The amount of the output is fixed at 330 sats, the default dust limit for P2WSH.
    169 
    170 Spending of the output requires the following witness:
    171 
    172     <local_sig/remote_sig>
    173 
    174 After 16 blocks, anyone can sweep the anchor with witness:
    175 
    176     <>
    177 
    178 #### `shared_anchor` Output (zero_fee_commitments)
    179 
    180 This output can be spent by anyone to provide incentive to mine the transaction, using child-pays-for-parent.
    181 This output is only added when the commitment transaction is using version 3 (`zero_fee_commitments`) and prevents pinning attacks on the commitment transaction.
    182 
    183 It is using the following standard P2A (pay-to-anchor) script:
    184 
    185     OP_1 <0x4e73>
    186 
    187 The standard dust limit for this type of script is `240 sat`.
    188 However, if the parent transaction doesn't pay any on-chain fees, using values below this dust limit is allowed under the "ephemeral dust" rule.
    189 
    190 If the difference between the commitment transaction input and the sum of all other commitment transaction outputs is smaller than `240 sat`, we set the anchor amount to this value.
    191 This ensures that the commitment transaction doesn't pay any on-chain fees whenever the anchor amount is smaller than `240 sat`.
    192 
    193 Otherwise, we set the anchor amount to `240 sat`, and the remaining difference between the commitment transaction input and its outputs directly contributes to the transaction's mining fees (which is standard since the `shared_anchor` has reached its dust limit).
    194 
    195 Spending of the output requires the following (empty) witness:
    196 
    197     <>
    198 
    199 #### Offered HTLC Outputs
    200 
    201 This output sends funds to either an HTLC-timeout transaction after the HTLC-timeout or to the remote node using the payment preimage or the revocation key. The output is a P2WSH, with a witness script (no `option_anchors`):
    202 
    203     # To remote node with revocation key
    204     OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
    205     OP_IF
    206         OP_CHECKSIG
    207     OP_ELSE
    208         <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
    209         OP_NOTIF
    210             # To local node via HTLC-timeout transaction (timelocked).
    211             OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
    212         OP_ELSE
    213             # To remote node with preimage.
    214             OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
    215             OP_CHECKSIG
    216         OP_ENDIF
    217     OP_ENDIF
    218 
    219 Or, with `option_anchors`:
    220 
    221     # To remote node with revocation key
    222     OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
    223     OP_IF
    224         OP_CHECKSIG
    225     OP_ELSE
    226         <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
    227         OP_NOTIF
    228             # To local node via HTLC-timeout transaction (timelocked).
    229             OP_DROP 2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
    230         OP_ELSE
    231             # To remote node with preimage.
    232             OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
    233             OP_CHECKSIG
    234         OP_ENDIF
    235         1 OP_CHECKSEQUENCEVERIFY OP_DROP
    236     OP_ENDIF
    237 
    238 The remote node can redeem the HTLC with the witness:
    239 
    240     <remotehtlcsig> <payment_preimage>
    241 
    242 Note that if `option_anchors` applies, the nSequence field of
    243 the spending input must be `1`.
    244 
    245 If a revoked commitment transaction is published, the remote node can spend this output immediately with the following witness:
    246 
    247     <revocation_sig> <revocationpubkey>
    248 
    249 The sending node can use the HTLC-timeout transaction to timeout the HTLC once the HTLC is expired, as shown below. This is the only way that the local node can timeout the HTLC, and this branch requires `<remotehtlcsig>`, which ensures that the local node cannot prematurely timeout the HTLC since the HTLC-timeout transaction has `cltv_expiry` as its specified `locktime`. The local node must also wait `to_self_delay` before accessing these funds, allowing for the remote node to claim these funds if the transaction has been revoked.
    250 
    251 #### Received HTLC Outputs
    252 
    253 This output sends funds to either the remote node after the HTLC-timeout or using the revocation key, or to an HTLC-success transaction with a successful payment preimage. The output is a P2WSH, with a witness script (no `option_anchors`):
    254 
    255     # To remote node with revocation key
    256     OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
    257     OP_IF
    258         OP_CHECKSIG
    259     OP_ELSE
    260         <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
    261         OP_IF
    262             # To local node via HTLC-success transaction.
    263             OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
    264             2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
    265         OP_ELSE
    266             # To remote node after timeout.
    267             OP_DROP <cltv_expiry> OP_CHECKLOCKTIMEVERIFY OP_DROP
    268             OP_CHECKSIG
    269         OP_ENDIF
    270     OP_ENDIF
    271 
    272 Or, with `option_anchors`:
    273 
    274     # To remote node with revocation key
    275     OP_DUP OP_HASH160 <RIPEMD160(SHA256(revocationpubkey))> OP_EQUAL
    276     OP_IF
    277         OP_CHECKSIG
    278     OP_ELSE
    279         <remote_htlcpubkey> OP_SWAP OP_SIZE 32 OP_EQUAL
    280         OP_IF
    281             # To local node via HTLC-success transaction.
    282             OP_HASH160 <RIPEMD160(payment_hash)> OP_EQUALVERIFY
    283             2 OP_SWAP <local_htlcpubkey> 2 OP_CHECKMULTISIG
    284         OP_ELSE
    285             # To remote node after timeout.
    286             OP_DROP <cltv_expiry> OP_CHECKLOCKTIMEVERIFY OP_DROP
    287             OP_CHECKSIG
    288         OP_ENDIF
    289         1 OP_CHECKSEQUENCEVERIFY OP_DROP
    290     OP_ENDIF
    291 
    292 To timeout the HTLC, the remote node spends it with the witness:
    293 
    294     <remotehtlcsig> <>
    295 
    296 Note that if `option_anchors` applies, the nSequence field of
    297 the spending input must be `1`.
    298 
    299 If a revoked commitment transaction is published, the remote node can spend this output immediately with the following witness:
    300 
    301     <revocation_sig> <revocationpubkey>
    302 
    303 To redeem the HTLC, the HTLC-success transaction is used as detailed below. This is the only way that the local node can spend the HTLC, since this branch requires `<remotehtlcsig>`, which ensures that the local node must wait `to_self_delay` before accessing these funds allowing for the remote node to claim these funds if the transaction has been revoked.
    304 
    305 ### Trimmed Outputs
    306 
    307 Each peer specifies a `dust_limit_satoshis` below which outputs should
    308 not be produced; these outputs that are not produced are termed "trimmed".
    309 A trimmed output is considered too small to be worth creating: it is instead
    310 either added to the commitment transaction fee or, if `zero_fee_commitments`
    311 applies, to the [shared anchor output](#shared_anchor-output-zero_fee_commitments).
    312 
    313 For HTLCs, it needs to be taken into account that the second-stage HTLC
    314 transaction may also be below the limit. Note that when using `option_anchors`
    315 or `zero_fee_commitments`, HTLC transactions don't include a fee and thus
    316 don't contribute to trimming: setting a higher `dust_limit_satoshis` makes
    317 sense for those channels to ensure that outputs are economical to spend.
    318 
    319 #### Requirements
    320 
    321 Before the commitment transaction outputs are determined:
    322   - the base fee MUST be subtracted from the `to_local` or `to_remote` output,
    323     as specified in [Fee Calculation](#fee-calculation).
    324   - if `option_anchors` applies:
    325     - the `to_local_anchor` output value MUST be subtracted from the funder's output.
    326     - the `to_remote_anchor` output value MUST be subtracted from the funder's output.
    327 
    328 The commitment transaction:
    329   - if the amount of the commitment transaction `to_local` output would be
    330     less than `dust_limit_satoshis` set by the transaction owner:
    331     - MUST NOT contain that output.
    332   - otherwise:
    333     - MUST be generated as specified in [`to_local` Output](#to_local-output).
    334   - if the amount of the commitment transaction `to_remote` output would be
    335     less than `dust_limit_satoshis` set by the transaction owner:
    336     - MUST NOT contain that output.
    337   - otherwise:
    338     - MUST be generated as specified in [`to_remote` Output](#to_remote-output).
    339   - for every offered HTLC:
    340     - if the HTLC amount minus the HTLC-timeout fee would be less than
    341       `dust_limit_satoshis` set by the transaction owner:
    342       - MUST NOT contain that output.
    343     - otherwise:
    344       - MUST be generated as specified in [Offered HTLC Outputs](#offered-htlc-outputs).
    345   - for every received HTLC:
    346     - if the HTLC amount minus the HTLC-success fee would be less than
    347       `dust_limit_satoshis` set by the transaction owner:
    348       - MUST NOT contain that output.
    349     - otherwise:
    350       - MUST be generated as specified in [Received HTLC Outputs](#received-htlc-outputs).
    351   - if `zero_fee_commitments` applies:
    352     - MUST add a `shared_anchor` output with an amount computed as detailed in
    353       [the `shared_anchor` section](#shared_anchor-output-zero_fee_commitments).
    354 
    355 ## HTLC-Timeout and HTLC-Success Transactions
    356 
    357 These HTLC transactions are almost identical, except the HTLC-timeout transaction is timelocked. Both HTLC-timeout/HTLC-success transactions can be spent by a valid penalty transaction.
    358 
    359 * version: 3 when using `zero_fee_commitments`, otherwise 2
    360 * locktime: `0` for HTLC-success, `cltv_expiry` for HTLC-timeout
    361 * txin count: 1
    362    * `txin[0]` outpoint: `txid` of the commitment transaction and `output_index` of the matching HTLC output for the HTLC transaction
    363    * `txin[0]` sequence: `1` for `option_anchors`, `0` otherwise
    364    * `txin[0]` script bytes: `0`
    365    * `txin[0]` witness stack: `0 <remotehtlcsig> <localhtlcsig>  <payment_preimage>` for HTLC-success, `0 <remotehtlcsig> <localhtlcsig> <>` for HTLC-timeout
    366 * txout count: 1
    367    * `txout[0]` amount: the HTLC `amount_msat` divided by 1000 (rounding down) minus fees in satoshis (see [Fee Calculation](#fee-calculation))
    368    * `txout[0]` script: version-0 P2WSH with witness script as shown below
    369 * if `option_anchors` or `zero_fee_commitments` applies to this commitment transaction, `SIGHASH_SINGLE|SIGHASH_ANYONECANPAY` is used as described in [BOLT #5](05-onchain.md#generation-of-htlc-transactions).
    370 
    371 The witness script for the output is:
    372 
    373     OP_IF
    374         # Penalty transaction
    375         <revocationpubkey>
    376     OP_ELSE
    377         `to_self_delay`
    378         OP_CHECKSEQUENCEVERIFY
    379         OP_DROP
    380         <local_delayedpubkey>
    381     OP_ENDIF
    382     OP_CHECKSIG
    383 
    384 To spend this via penalty, the remote node uses a witness stack `<revocationsig> 1`, and to collect the output, the local node uses an input with nSequence `to_self_delay` and a witness stack `<local_delayedsig> 0`.
    385 
    386 ## Legacy Closing Transaction
    387 
    388 This variant is used for `closing_signed` messages (i.e. where `option_simple_close` is not negotiated).
    389 
    390 Note that there are two possible variants for each node.
    391 
    392 * version: 2
    393 * locktime: 0
    394 * txin count: 1
    395    * `txin[0]` outpoint: `txid` and `output_index` from `funding_created` message
    396    * `txin[0]` sequence: 0xFFFFFFFF
    397    * `txin[0]` script bytes: 0
    398    * `txin[0]` witness: `0 <signature_for_pubkey1> <signature_for_pubkey2>`
    399 * txout count: 1 or 2
    400    * `txout` amount: final balance to be paid to one node (minus `fee_satoshis` from `closing_signed`, if this peer funded the channel)
    401    * `txout` script: as specified in that node's `scriptpubkey` in its `shutdown` message
    402 
    403 ### Requirements
    404 
    405 Each node offering a signature:
    406   - MUST round each output down to whole satoshis.
    407   - MUST subtract the fee given by `fee_satoshis` from the output to the funder.
    408   - MUST remove any output below its own `dust_limit_satoshis`.
    409   - MAY eliminate its own output.
    410 
    411 ### Rationale
    412 
    413 There is a possibility of irreparable differences on closing if one
    414 node considers the other's output too small to allow propagation on
    415 the Bitcoin network (a.k.a. "dust"), and that other node instead
    416 considers that output too valuable to discard. This is why each
    417 side uses its own `dust_limit_satoshis`, and the result can be a
    418 signature validation failure, if they disagree on what the closing
    419 transaction should look like.
    420 
    421 However, if one side chooses to eliminate its own output, there's no
    422 reason for the other side to fail the closing protocol; so this is
    423 explicitly allowed. The signature indicates which variant
    424 has been used.
    425 
    426 There will be at least one output, if the funding amount is greater
    427 than twice `dust_limit_satoshis`.
    428 
    429 ## Closing Transaction
    430 
    431 This variant is used for `closing_complete` and `closing_sig` messages (i.e. where `option_simple_close` is negotiated).
    432 
    433 In this case, the node sending `closing_complete` ("the closer") pays the fees.
    434 The outputs are ordered as detailed in [Transaction Output Ordering](#transaction-output-ordering).
    435 
    436 The side with lesser funds can opt to omit their own output.
    437 
    438 * version: 2
    439 * locktime: `locktime` from the `closing_complete` message
    440 * txin count: 1
    441    * `txin[0]` outpoint: `txid` and `output_index` of the channel output
    442    * `txin[0]` sequence: 0xFFFFFFFD
    443    * `txin[0]` script bytes: 0
    444    * `txin[0]` witness: `0 <signature_for_pubkey1> <signature_for_pubkey2>`
    445 * txout count: 1 or 2
    446   * The closer output:
    447     * `txout` amount:
    448       * 0 if the `scriptpubkey` starts with `OP_RETURN`
    449       * otherwise the final balance for the closer, minus `closing_complete.fee_satoshis`, rounded down to whole satoshis
    450 	* `txout` script: as specified in `closer_scriptpubkey` from the `closing_complete` message
    451   * The closee output:
    452     * `txout` amount:
    453       * 0 if the `scriptpubkey` starts with `OP_RETURN`
    454       * otherwise the final balance for the closee, rounded down to whole satoshis
    455 	* `txout` script: as specified in `closee_scriptpubkey` from the `closing_complete` message
    456 
    457 ### Requirements
    458 
    459 Each node offering a signature:
    460   - MUST round each output down to whole satoshis.
    461   - MUST subtract the fee given by `fee_satoshis` from the closer output.
    462   - MUST set the output amount to 0 if the `scriptpubkey` is `OP_RETURN`.
    463 
    464 ## Fees
    465 
    466 ### Fee Calculation
    467 
    468 The fee calculation for both commitment transactions and HTLC
    469 transactions is based on the current `feerate_per_kw` and the
    470 *expected weight* of the transaction. Note that `feerate_per_kw`
    471 is set to `0` when using `zero_fee_commitments`: in that case
    472 the commitment transactions and HTLC transactions don't pay any
    473 fee, which must be paid using child-pays-for-parent (for the
    474 commitment transactions) or by adding inputs (for the HTLC
    475 transactions).
    476 
    477 The actual and expected weights vary for several reasons:
    478 
    479 * Bitcoin uses DER-encoded signatures, which vary in size.
    480 * Bitcoin also uses variable-length integers, so a large number of outputs will take 3 bytes to encode rather than 1.
    481 * The `to_remote` output may be below the dust limit.
    482 * The `to_local` output may be below the dust limit once fees are extracted.
    483 
    484 Thus, a simplified formula for *expected weight* is used, which assumes:
    485 
    486 * Signatures are 73 bytes long (the maximum length).
    487 * There are a small number of outputs (thus 1 byte to count them).
    488 * There are always both a `to_local` output and a `to_remote` output.
    489 * (if `option_anchors`) there are always both a `to_local_anchor` and `to_remote_anchor` output.
    490 
    491 This yields the following *expected weights* (details of the computation in [Appendix A](#appendix-a-expected-weights)):
    492 
    493     Commitment weight (no option_anchors):   724 + 172 * num-untrimmed-htlc-outputs
    494     Commitment weight (option_anchors):     1124 + 172 * num-untrimmed-htlc-outputs
    495     HTLC-timeout weight (no option_anchors): 663
    496     HTLC-timeout weight (option_anchors): 666
    497     HTLC-success weight (no option_anchors): 703
    498     HTLC-success weight (option_anchors): 706
    499 
    500 Note the reference to the "base fee" for a commitment transaction in the requirements below, which is what the funder pays.
    501 The actual fee may be higher than the amount calculated here, due to rounding and trimmed outputs.
    502 
    503 #### Requirements
    504 
    505 The fee for an HTLC-timeout transaction:
    506   - If `option_anchors` or `zero_fee_commitments` applies:
    507     1. MUST be 0.
    508   - Otherwise, MUST be calculated to match:
    509     1. Multiply `feerate_per_kw` by 663 and divide by 1000 (rounding down).
    510 
    511 The fee for an HTLC-success transaction:
    512   - If `option_anchors` or `zero_fee_commitments` applies:
    513     1. MUST be 0.
    514   - Otherwise, MUST be calculated to match:
    515     1. Multiply `feerate_per_kw` by 703 and divide by 1000 (rounding down).
    516 
    517 The base fee for a commitment transaction:
    518   - If `zero_fee_commitments` applies:
    519     1. MUST be 0.
    520   - Otherwise, MUST be calculated to match:
    521     1. Start with `weight` = 724 (1124 if `option_anchors` applies).
    522     2. For each committed HTLC, if that output is not trimmed as specified in
    523     [Trimmed Outputs](#trimmed-outputs), add 172 to `weight`.
    524     3. Multiply `feerate_per_kw` by `weight`, divide by 1000 (rounding down).
    525 
    526 #### Example
    527 
    528 For example, suppose there is a `feerate_per_kw` of 5000, a `dust_limit_satoshis` of 546 satoshis, and a commitment transaction with:
    529 * two offered HTLCs of 5000000 and 1000000 millisatoshis (5000 and 1000 satoshis)
    530 * two received HTLCs of 7000000 and 800000 millisatoshis (7000 and 800 satoshis)
    531 
    532 The HTLC-timeout transaction `weight` is 663, and thus the fee is 3315 satoshis.
    533 The HTLC-success transaction `weight` is 703, and thus the fee is 3515 satoshis
    534 
    535 The commitment transaction `weight` is calculated as follows:
    536 
    537 * `weight` starts at 724.
    538 
    539 * The offered HTLC of 5000 satoshis is above 546 + 3315 and results in:
    540   * an output of 5000 satoshi in the commitment transaction
    541   * an HTLC-timeout transaction of 5000 - 3315 satoshis that spends this output
    542   * `weight` increases to 896
    543 
    544 * The offered HTLC of 1000 satoshis is below 546 + 3315 so it is trimmed.
    545 
    546 * The received HTLC of 7000 satoshis is above 546 + 3515 and results in:
    547   * an output of 7000 satoshi in the commitment transaction
    548   * an HTLC-success transaction of 7000 - 3515 satoshis that spends this output
    549   * `weight` increases to 1068
    550 
    551 * The received HTLC of 800 satoshis is below 546 + 3515 so it is trimmed.
    552 
    553 The base commitment transaction fee is 5340 satoshi; the actual
    554 fee (which adds the 1000 and 800 satoshi HTLCs that would make dust
    555 outputs) is 7140 satoshi. The final fee may be even higher if the
    556 `to_local` or `to_remote` outputs fall below `dust_limit_satoshis`.
    557 
    558 ### Fee Payment
    559 
    560 Base commitment transaction fees and amounts for `to_local_anchor` and
    561 `to_remote_anchor` outputs are extracted from the funder's amount.
    562 
    563 When using `zero_fee_commitments`, the `shared_anchor` output amount is
    564 taken from [trimmed outputs](#trimmed-outputs), as detailed in the
    565 [`shared_anchor` section](#shared_anchor-output-zero_fee_commitments).
    566 
    567 Note that after the fee amount is subtracted from the to-funder output,
    568 that output may be below `dust_limit_satoshis`, and thus will also
    569 contribute to fees (or, if `zero_fee_commitments` applies, to the
    570 `shared_anchor`).
    571 
    572 A node:
    573   - if `zero_fee_commitments` is not used and the resulting fee rate is too low:
    574     - MAY send a `warning` and close the connection, or send an
    575       `error` and fail the channel.
    576 
    577 ### Calculating Fees for Collaborative Transactions
    578 
    579 For transactions constructed using the [interactive protocol](02-peer-protocol.md#interactive-transaction-construction),
    580 fees are paid by each party to the transaction, at a `feerate` determined during the
    581 initiation, with the initiator covering the fees for the common transaction fields.
    582 
    583 ## Dust Limits
    584 
    585 The `dust_limit_satoshis` parameter is used to configure the threshold below
    586 which nodes will not produce on-chain transaction outputs.
    587 
    588 There is no consensus rule in Bitcoin that makes outputs below dust thresholds
    589 invalid or unspendable, but policy rules in popular implementations will prevent
    590 relaying transactions that contain such outputs.
    591 
    592 Bitcoin Core defines the following dust thresholds:
    593 
    594 - pay to pubkey hash (p2pkh): 546 satoshis
    595 - pay to script hash (p2sh): 540 satoshis
    596 - pay to witness pubkey hash (p2wpkh): 294 satoshis
    597 - pay to witness script hash (p2wsh): 330 satoshis
    598 - pay to anchor (p2a): 240 satoshis
    599 - unknown segwit versions: 354 satoshis
    600 - `OP_RETURN` outputs: these are never dust
    601 
    602 The rationale of this calculation (implemented [here](https://github.com/bitcoin/bitcoin/blob/2aff9a36c352640a263e8b5de469710f7e80eb54/src/policy/policy.cpp#L28))
    603 is explained in the following sections.
    604 
    605 In all these sections, the calculations are done with a feerate of 3000 sat/kB
    606 as per Bitcoin Core's implementation.
    607 
    608 Note that since the introduction of `option_anchors`, the second-stage HTLC
    609 transaction's weight is not taken into account when deciding whether outputs
    610 should be included in the commitment transaction or not. It thus makes sense
    611 to use a `dust_limit_satoshis` that takes into account the cost of those
    612 second-stage HTLC transactions, to ensure that outputs added to the commitment
    613 transaction can actually be claimed on-chain, otherwise they may pollute the
    614 utxo set indefinitely. At a minimum, nodes should allow their peer to use a
    615 `dust_limit_satoshis` that is higher than the values defined by Bitcoin Core.
    616 We cannot predict future feerates, so this will not always work and can still
    617 result in HTLC outputs that are unspendable if the on-chain fees are too high.
    618 We cannot use very large `dust_limit_satoshis` values either since it would
    619 create too much dust exposure in the commitment transaction (more details
    620 [here](/02-peer-protocol.md#bounding-exposure-to-trimmed-in-flight-htlcs-max_dust_htlc_exposure_msat)).
    621 
    622 ### Pay to pubkey hash (p2pkh)
    623 
    624 A p2pkh output is 34 bytes:
    625 
    626 - 8 bytes for the output amount
    627 - 1 byte for the script length
    628 - 25 bytes for the script (`OP_DUP` `OP_HASH160` `20` 20-bytes `OP_EQUALVERIFY` `OP_CHECKSIG`)
    629 
    630 A p2pkh input is at least 148 bytes:
    631 
    632 - 36 bytes for the previous output (32 bytes hash + 4 bytes index)
    633 - 4 bytes for the sequence
    634 - 1 byte for the script sig length
    635 - 107 bytes for the script sig:
    636   - 1 byte for the items count
    637   - 1 byte for the signature length
    638   - 71 bytes for the signature
    639   - 1 byte for the public key length
    640   - 33 bytes for the public key
    641 
    642 The p2pkh dust threshold is then `(34 + 148) * 3000 / 1000 = 546 satoshis`
    643 
    644 ### Pay to script hash (p2sh)
    645 
    646 A p2sh output is 32 bytes:
    647 
    648 - 8 bytes for the output amount
    649 - 1 byte for the script length
    650 - 23 bytes for the script (`OP_HASH160` `20` 20-bytes `OP_EQUAL`)
    651 
    652 A p2sh input doesn't have a fixed size, since it depends on the underlying
    653 script, so we use 148 bytes as a lower bound.
    654 
    655 The p2sh dust threshold is then `(32 + 148) * 3000 / 1000 = 540 satoshis`
    656 
    657 ### Pay to witness pubkey hash (p2wpkh)
    658 
    659 A p2wpkh output is 31 bytes:
    660 
    661 - 8 bytes for the output amount
    662 - 1 byte for the script length
    663 - 22 bytes for the script (`OP_0` `20` 20-bytes)
    664 
    665 A p2wpkh input is at least 67 bytes (depending on the signature length):
    666 
    667 - 36 bytes for the previous output (32 bytes hash + 4 bytes index)
    668 - 4 bytes for the sequence
    669 - 1 byte for the script sig length
    670 - 26 bytes for the witness (rounded down from 26.75, with the 75% segwit discount applied):
    671   - 1 byte for the items count
    672   - 1 byte for the signature length
    673   - 71 bytes for the signature
    674   - 1 byte for the public key length
    675   - 33 bytes for the public key
    676 
    677 The p2wpkh dust threshold is then `(31 + 67) * 3000 / 1000 = 294 satoshis`
    678 
    679 ### Pay to witness script hash (p2wsh)
    680 
    681 A p2wsh output is 43 bytes:
    682 
    683 - 8 bytes for the output amount
    684 - 1 byte for the script length
    685 - 34 bytes for the script (`OP_0` `32` 32-bytes)
    686 
    687 A p2wsh input doesn't have a fixed size, since it depends on the underlying
    688 script, so we use 67 bytes as a lower bound.
    689 
    690 The p2wsh dust threshold is then `(43 + 67) * 3000 / 1000 = 330 satoshis`
    691 
    692 ### Unknown segwit versions
    693 
    694 Unknown segwit outputs are at most 51 bytes:
    695 
    696 - 8 bytes for the output amount
    697 - 1 byte for the script length
    698 - 42 bytes for the script (`OP_1` through `OP_16` inclusive, followed by a single push of 2 to 40 bytes)
    699 
    700 The input doesn't have a fixed size, since it depends on the underlying
    701 script, so we use 67 bytes as a lower bound.
    702 
    703 The unknown segwit version dust threshold is then `(51 + 67) * 3000 / 1000 = 354 satoshis`
    704 
    705 ## Commitment Transaction Construction
    706 
    707 This section ties the previous sections together to detail the
    708 algorithm for constructing the commitment transaction for one peer:
    709 given that peer's `dust_limit_satoshis`, the current `feerate_per_kw`,
    710 the amounts due to each peer (`to_local` and `to_remote`), and all
    711 committed HTLCs:
    712 
    713 * Initialize the commitment transaction input and locktime, as specified
    714   in [Commitment Transaction](#commitment-transaction).
    715 * Calculate which committed HTLCs need to be trimmed (see [Trimmed Outputs](#trimmed-outputs)).
    716 * Calculate the base [commitment transaction fee](#fee-calculation).
    717 * Subtract this base fee from the funder (either `to_local` or `to_remote`).
    718   If `option_anchors` applies to the commitment transaction,
    719   also subtract two times the fixed anchor size of 330 sats from the funder
    720   (either `to_local` or `to_remote`).
    721 * For every offered HTLC, if it is not trimmed, add an
    722   [offered HTLC output](#offered-htlc-outputs).
    723 * For every received HTLC, if it is not trimmed, add a
    724   [received HTLC output](#received-htlc-outputs).
    725 * If the `to_local` amount is greater or equal to `dust_limit_satoshis`,
    726   add a [`to_local` output](#to_local-output).
    727 * If the `to_remote` amount is greater or equal to `dust_limit_satoshis`,
    728   add a [`to_remote` output](#to_remote-output).
    729 * If `option_anchors` applies to the commitment transaction:
    730   * if `to_local` exists or there are untrimmed HTLCs, add a [`to_local_anchor` output](#to_local_anchor-and-to_remote_anchor-output-option_anchors).
    731   * if `to_remote` exists or there are untrimmed HTLCs, add a [`to_remote_anchor` output](#to_local_anchor-and-to_remote_anchor-output-option_anchors).
    732 * If `zero_fee_commitments` applies to the commitment transaction:
    733   * add a [`shared_anchor` output](#shared_anchor-output-zero_fee_commitments).
    734 * Sort the outputs into [BIP 69+CLTV order](#transaction-output-ordering).
    735 
    736 # Keys
    737 
    738 ## Key Derivation
    739 
    740 Each commitment transaction uses a unique `localpubkey`.
    741 The HTLC-success and HTLC-timeout transactions use `local_delayedpubkey` and `revocationpubkey`.
    742 These are changed for every transaction based on the `per_commitment_point`.
    743 
    744 The reason for key change is so that trustless watching for revoked
    745 transactions can be outsourced. Such a _watcher_ should not be able to
    746 determine the contents of a commitment transaction — even if the _watcher_ knows
    747 which transaction ID to watch for and can make a reasonable guess
    748 as to which HTLCs and balances may be included. Nonetheless, to
    749 avoid storage of every commitment transaction, a _watcher_ can be given the
    750 `per_commitment_secret` values (which can be stored compactly) and the
    751 `revocation_basepoint` and `delayed_payment_basepoint` used to regenerate
    752 the scripts required for the penalty transaction; thus, a _watcher_ need only be
    753 given (and store) the signatures for each penalty input.
    754 
    755 Changing the `localpubkey` every time ensures that commitment
    756 transaction ID cannot be guessed except in the trivial case where there is no
    757 `to_local` output, as every commitment transaction uses an ID
    758 in its output script. Splitting the `local_delayedpubkey`, which is required for
    759 the penalty transaction, allows it to be shared with the _watcher_ without
    760 revealing `localpubkey`; even if both peers use the same _watcher_, nothing is revealed.
    761 
    762 Finally, even in the case of normal unilateral close, the HTLC-success
    763 and/or HTLC-timeout transactions do not reveal anything to the
    764 _watcher_, as it does not know the corresponding `per_commitment_secret` and
    765 cannot relate the `local_delayedpubkey` or `revocationpubkey` with their bases.
    766 
    767 For efficiency, keys are generated from a series of per-commitment secrets
    768 that are generated from a single seed, which allows the receiver to compactly
    769 store them (see [below](#efficient-per-commitment-secret-storage)).
    770 
    771 ### `localpubkey`, `local_htlcpubkey`, `remote_htlcpubkey`, `local_delayedpubkey`, and `remote_delayedpubkey` Derivation
    772 
    773 These pubkeys are simply generated by addition from their base points:
    774 
    775 	pubkey = basepoint + SHA256(per_commitment_point || basepoint) * G
    776 
    777 - The `localpubkey` uses the local node's `payment_basepoint`;
    778 - The `local_htlcpubkey` uses the local node's `htlc_basepoint`;
    779 - The `remote_htlcpubkey` uses the remote node's `htlc_basepoint`;
    780 - The `local_delayedpubkey` uses the local node's `delayed_payment_basepoint`;
    781 - The `remote_delayedpubkey` uses the remote node's `delayed_payment_basepoint`.
    782 
    783 The corresponding private keys can be similarly derived, if the basepoint
    784 secrets are known (i.e. the private keys corresponding to `localpubkey`, `local_htlcpubkey`, and `local_delayedpubkey` only):
    785 
    786     privkey = basepoint_secret + SHA256(per_commitment_point || basepoint)
    787 
    788 ### `remotepubkey` Derivation
    789 
    790 The `remotepubkey` is simply the remote node's `payment_basepoint`.
    791 
    792 This means that a node can spend a commitment
    793 transaction even if it has lost data and doesn't know the
    794 corresponding `per_commitment_point`.  A watchtower could correlate
    795 transactions given to it which only have a `to_remote` output if it
    796 sees one of them onchain, but such transactions do not need any
    797 enforcement and should not be handed to a watchtower.
    798 
    799 ### `revocationpubkey` Derivation
    800 
    801 The `revocationpubkey` is a blinded key: when the local node wishes to create a new
    802 commitment for the remote node, it uses its own `revocation_basepoint` and the remote
    803 node's `per_commitment_point` to derive a new `revocationpubkey` for the
    804 commitment. After the remote node reveals the
    805 `per_commitment_secret` used (thereby revoking that commitment), the local node
    806 can then derive the `revocationprivkey`, as it now knows the two secrets
    807 necessary to derive the key (`revocation_basepoint_secret` and
    808 `per_commitment_secret`).
    809 
    810 The `per_commitment_point` is generated using elliptic-curve multiplication:
    811 
    812 	per_commitment_point = per_commitment_secret * G
    813 
    814 And this is used to derive the revocation pubkey from the remote node's
    815 `revocation_basepoint`:
    816 
    817 	revocationpubkey = revocation_basepoint * SHA256(revocation_basepoint || per_commitment_point) + per_commitment_point * SHA256(per_commitment_point || revocation_basepoint)
    818 
    819 This construction ensures that neither the node providing the
    820 basepoint nor the node providing the `per_commitment_point` can know the
    821 private key without the other node's secret.
    822 
    823 The corresponding private key can be derived once the `per_commitment_secret`
    824 is known:
    825 
    826     revocationprivkey = revocation_basepoint_secret * SHA256(revocation_basepoint || per_commitment_point) + per_commitment_secret * SHA256(per_commitment_point || revocation_basepoint)
    827 
    828 ### Per-commitment Secret Requirements
    829 
    830 A node:
    831   - MUST select an unguessable 256-bit seed for each connection,
    832   - MUST NOT reveal the seed.
    833 
    834 Up to (2^48 - 1) per-commitment secrets can be generated.
    835 
    836 The first secret used:
    837   - MUST be index 281474976710655,
    838     - and from there, the index is decremented.
    839 
    840 The I'th secret P:
    841   - MUST match the output of this algorithm:
    842 ```
    843 generate_from_seed(seed, I):
    844     P = seed
    845     for B in 47 down to 0:
    846         if B set in I:
    847             flip(B) in P
    848             P = SHA256(P)
    849     return P
    850 ```
    851 
    852 Where "flip(B)" alternates the (B mod 8) bit of the (B div 8)
    853 byte of the value.  So, "flip(0) in e3b0..." is "e2b0...", and
    854 "flip(10) in "e3b0..." is "e3b4...".
    855 
    856 The receiving node:
    857   - MAY store all previous per-commitment secrets.
    858   - MAY calculate them from a compact representation, as described below.
    859 
    860 ## Efficient Per-commitment Secret Storage
    861 
    862 The receiver of a series of secrets can store them compactly in an
    863 array of 49 (value,index) pairs. Because, for a given secret on a
    864 2^X boundary, all secrets up to the next 2^X boundary can be derived;
    865 and secrets are always received in descending order starting at
    866 `0xFFFFFFFFFFFF`.
    867 
    868 In binary, it's helpful to think of any index in terms of a *prefix*,
    869 followed by some trailing 0s. You can derive the secret for any
    870 index that matches this *prefix*.
    871 
    872 For example, secret `0xFFFFFFFFFFF0` allows the secrets to be derived for
    873 `0xFFFFFFFFFFF1` through `0xFFFFFFFFFFFF`, inclusive; and secret `0xFFFFFFFFFF08`
    874 allows the secrets to be derived for `0xFFFFFFFFFF09` through `0xFFFFFFFFFF0F`,
    875 inclusive.
    876 
    877 This is done using a slight generalization of `generate_from_seed` above:
    878 
    879     # Return I'th secret given base secret whose index has bits..47 the same.
    880     derive_secret(base, bits, I):
    881         P = base
    882         for B in bits - 1 down to 0:
    883             if B set in I:
    884                 flip(B) in P
    885                 P = SHA256(P)
    886         return P
    887 
    888 Only one secret for each unique prefix need be saved; in effect, the number of
    889 trailing 0s is counted, and this determines where in the storage array the
    890 secret is stored:
    891 
    892     # a.k.a. count trailing 0s
    893     where_to_put_secret(I):
    894         for B in 0 to 47:
    895             if testbit(I) in B == 1:
    896                 return B
    897         # I = 0, this is the seed.
    898         return 48
    899 
    900 A double-check, that all previous secrets derive correctly, is needed;
    901 if this check fails, the secrets were not generated from the same seed:
    902 
    903     insert_secret(secret, I):
    904         B = where_to_put_secret(I)
    905 
    906         # This tracks the index of the secret in each bucket across the traversal.
    907         for b in 0 to B:
    908             if derive_secret(secret, B, known[b].index) != known[b].secret:
    909                 error The secret for I is incorrect
    910                 return
    911 
    912         # Assuming this automatically extends known[] as required.
    913         known[B].index = I
    914         known[B].secret = secret
    915 
    916 Finally, if an unknown secret at index `I` needs be derived, it must be
    917 discovered which known secret can be used to derive it. The simplest
    918 method is iterating over all the known secrets, and testing if each
    919 can be used to derive the unknown secret:
    920 
    921     derive_old_secret(I):
    922         for b in 0 to len(secrets):
    923             # Mask off the non-zero prefix of the index.
    924             MASK = ~((1 << b) - 1)
    925             if (I & MASK) == secrets[b].index:
    926                 return derive_secret(known, i, I)
    927         error Index 'I' hasn't been received yet.
    928 
    929 This looks complicated, but remember that the index in entry `b` has
    930 `b` trailing 0s; the mask and compare simply checks if the index
    931 at each bucket is a prefix of the desired index.
    932 
    933 # Appendix A: Expected Weights
    934 
    935 ## Expected Weight of the Funding Transaction (v2 Channel Establishment)
    936 
    937 The *expected weight* of a funding transaction is calculated as follows:
    938 
    939       inputs: 41 bytes
    940         - previous_out_point: 36 bytes
    941           - hash: 32 bytes
    942           - index: 4 bytes
    943         - var_int: 1 byte
    944         - script_sig: 0 bytes
    945         - witness <---- Cost for "witness" data calculated separately.
    946         - sequence: 4 bytes
    947 
    948       non_funding_outputs: 9 bytes + `scriptlen`
    949         - value: 8 bytes
    950         - var_int: 1 byte <---- assuming a standard output script
    951         - script: `scriptlen`
    952 
    953       funding_output: 43 bytes
    954         - value: 8 bytes
    955         - var_int: 1 byte
    956         - script: 34 bytes
    957           - OP_0: 1 byte
    958           - PUSHDATA(32-byte-hash): 33 bytes
    959 
    960 Multiplying non-witness data by 4 results in a weight of:
    961 
    962       // transaction_fields = 10 (version, input count, output count, locktime)
    963       // segwit_fields = 2 (marker + flag)
    964       // funding_transaction = 43 + num_inputs * 41 + num_outputs * 9 + sum(scriptlen)
    965       funding_transaction_weight = 4 * (funding_transaction + transaction_fields) + segwit_fields
    966 
    967       witness_weight = sum(witness_len)
    968 
    969       overall_weight = funding_transaction_weight + witness_weight
    970 
    971 ## Expected Weight of the Commitment Transaction
    972 
    973 The *expected weight* of a commitment transaction is calculated as follows:
    974 
    975 	p2wsh: 34 bytes
    976 		- OP_0: 1 byte
    977 		- OP_DATA: 1 byte (witness_script_SHA256 length)
    978 		- witness_script_SHA256: 32 bytes
    979 
    980 	p2wpkh: 22 bytes
    981 		- OP_0: 1 byte
    982 		- OP_DATA: 1 byte (public_key_HASH160 length)
    983 		- public_key_HASH160: 20 bytes
    984 
    985 	multi_sig: 71 bytes
    986 		- OP_2: 1 byte
    987 		- OP_DATA: 1 byte (pub_key_alice length)
    988 		- pub_key_alice: 33 bytes
    989 		- OP_DATA: 1 byte (pub_key_bob length)
    990 		- pub_key_bob: 33 bytes
    991 		- OP_2: 1 byte
    992 		- OP_CHECKMULTISIG: 1 byte
    993 
    994 	witness: 222 bytes
    995 		- number_of_witness_elements: 1 byte
    996 		- nil_length: 1 byte
    997 		- sig_alice_length: 1 byte
    998 		- sig_alice: 73 bytes
    999 		- sig_bob_length: 1 byte
   1000 		- sig_bob: 73 bytes
   1001 		- witness_script_length: 1 byte
   1002 		- witness_script (multi_sig)
   1003 
   1004 	funding_input: 41 bytes
   1005 		- previous_out_point: 36 bytes
   1006 			- hash: 32 bytes
   1007 			- index: 4 bytes
   1008 		- var_int: 1 byte (script_sig length)
   1009 		- script_sig: 0 bytes
   1010 		- witness <----	"witness" is used instead of "script_sig" for
   1011 	 			transaction validation; however, "witness" is stored
   1012 	 			separately, and the cost for its size is smaller. So,
   1013 	 		    the calculation of ordinary data is separated
   1014 	 			from the witness data.
   1015 		- sequence: 4 bytes
   1016 
   1017 	output_paying_to_local: 43 bytes
   1018 		- value: 8 bytes
   1019 		- var_int: 1 byte (pk_script length)
   1020 		- pk_script (p2wsh): 34 bytes
   1021 
   1022 	output_paying_to_remote (no option_anchors): 31 bytes
   1023 		- value: 8 bytes
   1024 		- var_int: 1 byte (pk_script length)
   1025 		- pk_script (p2wpkh): 22 bytes
   1026 
   1027 	output_paying_to_remote (option_anchors): 43 bytes
   1028 		- value: 8 bytes
   1029 		- var_int: 1 byte (pk_script length)
   1030 		- pk_script (p2wsh): 34 bytes
   1031 
   1032 	output_anchor (option_anchors): 43 bytes
   1033 		- value: 8 bytes
   1034 		- var_int: 1 byte (pk_script length)
   1035 		- pk_script (p2wsh): 34 bytes
   1036 
   1037     htlc_output: 43 bytes
   1038 		- value: 8 bytes
   1039 		- var_int: 1 byte (pk_script length)
   1040 		- pk_script (p2wsh): 34 bytes
   1041 
   1042 	 witness_header: 2 bytes
   1043 		- flag: 1 byte
   1044 		- marker: 1 byte
   1045 
   1046 	 commitment_transaction (no option_anchors): 125 + 43 * num-htlc-outputs bytes
   1047 		- version: 4 bytes
   1048 		- witness_header <---- part of the witness data
   1049 		- count_tx_in: 1 byte
   1050 		- tx_in: 41 bytes
   1051 			funding_input
   1052 		- count_tx_out: 1 byte
   1053 		- tx_out: 74 + 43 * num-htlc-outputs bytes
   1054 			output_paying_to_remote,
   1055 			output_paying_to_local,
   1056 			....htlc_output's...
   1057 		- lock_time: 4 bytes
   1058 
   1059 	 commitment_transaction (option_anchors): 225 + 43 * num-htlc-outputs bytes
   1060 		- version: 4 bytes
   1061 		- witness_header <---- part of the witness data
   1062 		- count_tx_in: 1 byte
   1063 		- tx_in: 41 bytes
   1064 			funding_input
   1065 		- count_tx_out: 3 byte
   1066 		- tx_out: 172 + 43 * num-htlc-outputs bytes
   1067 			output_paying_to_remote,
   1068 			output_paying_to_local,
   1069 			output_anchor,
   1070 			output_anchor,
   1071 			....htlc_output's...
   1072 		- lock_time: 4 bytes
   1073 
   1074 Multiplying non-witness data by 4 results in a weight of:
   1075 
   1076 	// 500 + 172 * num-htlc-outputs weight (no option_anchors)
   1077 	// 900 + 172 * num-htlc-outputs weight (option_anchors)
   1078 	commitment_transaction_weight = 4 * commitment_transaction
   1079 
   1080 	// 224 weight
   1081 	witness_weight = witness_header + witness
   1082 
   1083 	overall_weight (no option_anchors) = 500 + 172 * num-htlc-outputs + 224 weight
   1084 	overall_weight (option_anchors) = 900 + 172 * num-htlc-outputs + 224 weight
   1085 
   1086 ## Expected Weight of HTLC-timeout and HTLC-success Transactions
   1087 
   1088 The *expected weight* of an HTLC transaction is calculated as follows:
   1089 
   1090     accepted_htlc_script: 140 bytes (143 bytes with option_anchors)
   1091         - OP_DUP: 1 byte
   1092         - OP_HASH160: 1 byte
   1093         - OP_DATA: 1 byte (RIPEMD160(SHA256(revocationpubkey)) length)
   1094         - RIPEMD160(SHA256(revocationpubkey)): 20 bytes
   1095         - OP_EQUAL: 1 byte
   1096         - OP_IF: 1 byte
   1097         - OP_CHECKSIG: 1 byte
   1098         - OP_ELSE: 1 byte
   1099         - OP_DATA: 1 byte (remote_htlcpubkey length)
   1100         - remote_htlcpubkey: 33 bytes
   1101         - OP_SWAP: 1 byte
   1102         - OP_SIZE: 1 byte
   1103         - OP_DATA: 1 byte (32 length)
   1104         - 32: 1 byte
   1105         - OP_EQUAL: 1 byte
   1106         - OP_IF: 1 byte
   1107         - OP_HASH160: 1 byte
   1108 		- OP_DATA: 1 byte (RIPEMD160(payment_hash) length)
   1109 		- RIPEMD160(payment_hash): 20 bytes
   1110         - OP_EQUALVERIFY: 1 byte
   1111         - 2: 1 byte
   1112         - OP_SWAP: 1 byte
   1113 		- OP_DATA: 1 byte (local_htlcpubkey length)
   1114 		- local_htlcpubkey: 33 bytes
   1115         - 2: 1 byte
   1116         - OP_CHECKMULTISIG: 1 byte
   1117         - OP_ELSE: 1 byte
   1118         - OP_DROP: 1 byte
   1119 		- OP_DATA: 1 byte (cltv_expiry length)
   1120 		- cltv_expiry: 4 bytes
   1121         - OP_CHECKLOCKTIMEVERIFY: 1 byte
   1122         - OP_DROP: 1 byte
   1123         - OP_CHECKSIG: 1 byte
   1124         - OP_ENDIF: 1 byte
   1125         - OP_1: 1 byte (option_anchors)
   1126         - OP_CHECKSEQUENCEVERIFY: 1 byte (option_anchors)
   1127         - OP_DROP: 1 byte (option_anchors)
   1128         - OP_ENDIF: 1 byte
   1129 
   1130     offered_htlc_script: 133 bytes (136 bytes with option_anchors)
   1131         - OP_DUP: 1 byte
   1132         - OP_HASH160: 1 byte
   1133         - OP_DATA: 1 byte (RIPEMD160(SHA256(revocationpubkey)) length)
   1134         - RIPEMD160(SHA256(revocationpubkey)): 20 bytes
   1135         - OP_EQUAL: 1 byte
   1136         - OP_IF: 1 byte
   1137         - OP_CHECKSIG: 1 byte
   1138         - OP_ELSE: 1 byte
   1139 		- OP_DATA: 1 byte (remote_htlcpubkey length)
   1140 		- remote_htlcpubkey: 33 bytes
   1141 		- OP_SWAP: 1 byte
   1142 		- OP_SIZE: 1 byte
   1143 		- OP_DATA: 1 byte (32 length)
   1144 		- 32: 1 byte
   1145 		- OP_EQUAL: 1 byte
   1146 		- OP_NOTIF: 1 byte
   1147 		- OP_DROP: 1 byte
   1148 		- 2: 1 byte
   1149 		- OP_SWAP: 1 byte
   1150 		- OP_DATA: 1 byte (local_htlcpubkey length)
   1151 		- local_htlcpubkey: 33 bytes
   1152 		- 2: 1 byte
   1153 		- OP_CHECKMULTISIG: 1 byte
   1154 		- OP_ELSE: 1 byte
   1155 		- OP_HASH160: 1 byte
   1156 		- OP_DATA: 1 byte (RIPEMD160(payment_hash) length)
   1157 		- RIPEMD160(payment_hash): 20 bytes
   1158 		- OP_EQUALVERIFY: 1 byte
   1159 		- OP_CHECKSIG: 1 byte
   1160 		- OP_ENDIF: 1 byte
   1161         - OP_1: 1 byte (option_anchors)
   1162         - OP_CHECKSEQUENCEVERIFY: 1 byte (option_anchors)
   1163         - OP_DROP: 1 byte (option_anchors)
   1164         - OP_ENDIF: 1 byte
   1165 
   1166     timeout_witness: 285 bytes (288 bytes with option_anchors)
   1167 		- number_of_witness_elements: 1 byte
   1168 		- nil_length: 1 byte
   1169 		- sig_alice_length: 1 byte
   1170 		- sig_alice: 73 bytes
   1171 		- sig_bob_length: 1 byte
   1172 		- sig_bob: 73 bytes
   1173 		- nil_length: 1 byte
   1174 		- witness_script_length: 1 byte
   1175 		- witness_script (offered_htlc_script)
   1176 
   1177     success_witness: 324 bytes (327 bytes with option_anchors)
   1178 		- number_of_witness_elements: 1 byte
   1179 		- nil_length: 1 byte
   1180 		- sig_alice_length: 1 byte
   1181 		- sig_alice: 73 bytes
   1182 		- sig_bob_length: 1 byte
   1183 		- sig_bob: 73 bytes
   1184 		- preimage_length: 1 byte
   1185 		- preimage: 32 bytes
   1186 		- witness_script_length: 1 byte
   1187 		- witness_script (accepted_htlc_script)
   1188 
   1189     commitment_input: 41 bytes
   1190 		- previous_out_point: 36 bytes
   1191 			- hash: 32 bytes
   1192 			- index: 4 bytes
   1193 		- var_int: 1 byte (script_sig length)
   1194 		- script_sig: 0 bytes
   1195 		- witness (success_witness or timeout_witness)
   1196 		- sequence: 4 bytes
   1197 
   1198     htlc_output: 43 bytes
   1199 		- value: 8 bytes
   1200 		- var_int: 1 byte (pk_script length)
   1201 		- pk_script (p2wsh): 34 bytes
   1202 
   1203 	htlc_transaction:
   1204 		- version: 4 bytes
   1205 		- witness_header <---- part of the witness data
   1206 		- count_tx_in: 1 byte
   1207 		- tx_in: 41 bytes
   1208 			commitment_input
   1209 		- count_tx_out: 1 byte
   1210 		- tx_out: 43
   1211 			htlc_output
   1212 		- lock_time: 4 bytes
   1213 
   1214 Multiplying non-witness data by 4 results in a weight of 376. Adding
   1215 the witness data for each case (285 or 288 + 2 for HTLC-timeout, 324 or 327 + 2 for
   1216 HTLC-success) results in weights of:
   1217 
   1218 	663 (HTLC-timeout) (666 with option_anchors)
   1219 	703 (HTLC-success) (706 with option_anchors)
   1220         - (really 702 and 705, but we use these numbers for historical reasons)
   1221 
   1222 # Appendix B: Funding Transaction Test Vectors
   1223 
   1224 In the following:
   1225  - It's assumed that *local* is the funder.
   1226  - Private keys are displayed as 32 bytes plus a trailing 1 (Bitcoin's convention for "compressed" private keys, i.e. keys for which the public key is compressed).
   1227  - Transaction signatures are all deterministic, using RFC6979 (using HMAC-SHA256). A valid signature MUST sign all inputs and outputs of the relevant transaction (i.e. MUST be created with a `SIGHASH_ALL` [signature hash](https://bitcoin.org/en/glossary/signature-hash)), unless explicitly stated otherwise. Note that clients MUST send the signature in compact encoding and not in Bitcoin-script format, thus the signature hash byte is not transmitted.
   1228 
   1229 The input for the funding transaction was created using a test chain
   1230 with the following first two blocks; the second block contains a spendable
   1231 coinbase (note that such a P2PKH input is inadvisable, as detailed in [BOLT #2](02-peer-protocol.md#the-funding_created-message), but provides the simplest example):
   1232 
   1233     Block 0 (genesis): 0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff7f20020000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000
   1234     Block 1: 0000002006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910fadbb20ea41a8423ea937e76e8151636bf6093b70eaff942930d20576600521fdc30f9858ffff7f20000000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0100f2052a010000001976a9143ca33c2e4446f4a305f23c80df8ad1afdcf652f988ac00000000
   1235     Block 1 coinbase transaction: 01000000010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0100f2052a010000001976a9143ca33c2e4446f4a305f23c80df8ad1afdcf652f988ac00000000
   1236     Block 1 coinbase privkey: 6bd078650fcee8444e4e09825227b801a1ca928debb750eb36e6d56124bb20e801
   1237     # privkey in base58: cRCH7YNcarfvaiY1GWUKQrRGmoezvfAiqHtdRvxe16shzbd7LDMz
   1238     # pubkey in base68: mm3aPLSv9fBrbS68JzurAMp4xGoddJ6pSf
   1239 
   1240 The funding transaction is paid to the following pubkeys:
   1241 
   1242     local_funding_pubkey: 023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb
   1243     remote_funding_pubkey: 030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1
   1244     # funding witness script = 5221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae
   1245 
   1246 The funding transaction has a single input and a change output (order
   1247 determined by BIP69 in this case):
   1248 
   1249     input txid: fd2105607605d2302994ffea703b09f66b6351816ee737a93e42a841ea20bbad
   1250     input index: 0
   1251     input satoshis: 5000000000
   1252     funding satoshis: 10000000
   1253     # funding witness script = 5221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae
   1254     # feerate_per_kw: 15000
   1255     change satoshis: 4989986080
   1256     funding output: 0
   1257 
   1258 The resulting funding transaction is:
   1259 
   1260     funding tx: 0200000001adbb20ea41a8423ea937e76e8151636bf6093b70eaff942930d20576600521fd000000006b48304502210090587b6201e166ad6af0227d3036a9454223d49a1f11839c1a362184340ef0240220577f7cd5cca78719405cbf1de7414ac027f0239ef6e214c90fcaab0454d84b3b012103535b32d5eb0a6ed0982a0479bbadc9868d9836f6ba94dd5a63be16d875069184ffffffff028096980000000000220020c015c4a6be010e21657068fc2e6a9d02b27ebe4d490a25846f7237f104d1a3cd20256d29010000001600143ca33c2e4446f4a305f23c80df8ad1afdcf652f900000000
   1261     # txid: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
   1262 
   1263 # Appendix C: Commitment and HTLC Transaction Test Vectors
   1264 
   1265 In the following:
   1266  - *local* transactions are considered, which implies that all payments to *local* are delayed.
   1267  - It's assumed that *local* is the opener.
   1268  - Private keys are displayed as 32 bytes plus a trailing 1 (Bitcoin's convention for "compressed" private keys, i.e. keys for which the public key is compressed).
   1269  - Transaction signatures are all deterministic, using RFC6979 (using HMAC-SHA256).
   1270 
   1271 To start, common basic parameters for each test vector are defined: the
   1272 HTLCs are not used for the first "simple commitment tx with no HTLCs" test,
   1273 and HTLCs 5 and 6 are only used in the "same amount and preimage" test.
   1274 
   1275     funding_tx_id: 8984484a580b825b9972d7adb15050b3ab624ccd731946b3eeddb92f4e7ef6be
   1276     funding_output_index: 0
   1277     funding_amount_satoshi: 10000000
   1278     commitment_number: 42
   1279     local_delay: 144
   1280     local_dust_limit_satoshi: 546
   1281     htlc 0 direction: remote->local
   1282     htlc 0 amount_msat: 1000000
   1283     htlc 0 expiry: 500
   1284     htlc 0 payment_preimage: 0000000000000000000000000000000000000000000000000000000000000000
   1285     htlc 1 direction: remote->local
   1286     htlc 1 amount_msat: 2000000
   1287     htlc 1 expiry: 501
   1288     htlc 1 payment_preimage: 0101010101010101010101010101010101010101010101010101010101010101
   1289     htlc 2 direction: local->remote
   1290     htlc 2 amount_msat: 2000000
   1291     htlc 2 expiry: 502
   1292     htlc 2 payment_preimage: 0202020202020202020202020202020202020202020202020202020202020202
   1293     htlc 3 direction: local->remote
   1294     htlc 3 amount_msat: 3000000
   1295     htlc 3 expiry: 503
   1296     htlc 3 payment_preimage: 0303030303030303030303030303030303030303030303030303030303030303
   1297     htlc 4 direction: remote->local
   1298     htlc 4 amount_msat: 4000000
   1299     htlc 4 expiry: 504
   1300     htlc 4 payment_preimage: 0404040404040404040404040404040404040404040404040404040404040404
   1301     htlc 5 direction: local->remote
   1302     htlc 5 amount_msat: 5000000
   1303     htlc 5 expiry: 506
   1304     htlc 5 payment_preimage: 0505050505050505050505050505050505050505050505050505050505050505
   1305     htlc 6 direction: local->remote
   1306     htlc 6 amount_msat: 5000001
   1307     htlc 6 expiry: 505
   1308     htlc 6 payment_preimage: 0505050505050505050505050505050505050505050505050505050505050505
   1309 
   1310 <!-- The test vector values are derived, as per Key Derivation, though it's not
   1311      required for this test. They're included here for completeness and
   1312 	 in case someone wants to reproduce the test vectors themselves:
   1313 
   1314 INTERNAL: remote_funding_privkey: 1552dfba4f6cf29a62a0af13c8d6981d36d0ef8d61ba10fb0fe90da7634d7e1301
   1315 INTERNAL: local_payment_basepoint_secret: 111111111111111111111111111111111111111111111111111111111111111101
   1316 INTERNAL: remote_revocation_basepoint_secret: 222222222222222222222222222222222222222222222222222222222222222201
   1317 INTERNAL: local_delayed_payment_basepoint_secret: 333333333333333333333333333333333333333333333333333333333333333301
   1318 INTERNAL: remote_payment_basepoint_secret: 444444444444444444444444444444444444444444444444444444444444444401
   1319 x_local_per_commitment_secret: 1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a0908070605040302010001
   1320 # From remote_revocation_basepoint_secret
   1321 INTERNAL: remote_revocation_basepoint: 02466d7fcae563e5cb09a0d1870bb580344804617879a14949cf22285f1bae3f27
   1322 # From local_delayed_payment_basepoint_secret
   1323 INTERNAL: local_delayed_payment_basepoint: 023c72addb4fdf09af94f0c94d7fe92a386a7e70cf8a1d85916386bb2535c7b1b1
   1324 INTERNAL: local_per_commitment_point: 025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486
   1325 INTERNAL: remote_privkey: 8deba327a7cc6d638ab0eb025770400a6184afcba6713c210d8d10e199ff2fda01
   1326 # From local_delayed_payment_basepoint_secret, local_per_commitment_point and local_delayed_payment_basepoint
   1327 INTERNAL: local_delayed_privkey: adf3464ce9c2f230fd2582fda4c6965e4993ca5524e8c9580e3df0cf226981ad01
   1328 -->
   1329 
   1330 Here are the points used to derive the obscuring factor for the commitment number:
   1331 
   1332     local_payment_basepoint: 034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa
   1333     remote_payment_basepoint: 032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991
   1334     # obscured commitment number = 0x2bb038521914 ^ 42
   1335 
   1336 We use the same values for the HTLC basepoints:
   1337 
   1338     local_htlc_basepoint: 034f355bdcb7cc0af728ef3cceb9615d90684bb5b2ca5f859ab0f0b704075871aa
   1339     remote_htlc_basepoint: 032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991
   1340 
   1341 And, here are the keys needed to create the transactions:
   1342 
   1343     local_funding_privkey: 30ff4956bbdd3222d44cc5e8a1261dab1e07957bdac5ae88fe3261ef321f374901
   1344     local_funding_pubkey: 023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb
   1345     remote_funding_pubkey: 030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c1
   1346     local_privkey: bb13b121cdc357cd2e608b0aea294afca36e2b34cf958e2e6451a2f27469449101
   1347     local_htlcpubkey: 030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e7
   1348     remote_htlcpubkey: 0394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b
   1349     local_delayedpubkey: 03fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c
   1350     local_revocation_pubkey: 0212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b19
   1351     # funding wscript = 5221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae
   1352 
   1353 And, here are the test vectors themselves:
   1354 
   1355     name: simple commitment tx with no HTLCs
   1356     to_local_msat: 7000000000
   1357     to_remote_msat: 3000000000
   1358     local_feerate_per_kw: 15000
   1359     # base commitment transaction fee = 10860
   1360     # actual commitment transaction fee = 10860
   1361     # to_local amount 6989140 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1362     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1363     remote_signature = 3045022100c3127b33dcc741dd6b05b1e63cbd1a9a7d816f37af9b6756fa2376b056f032370220408b96279808fe57eb7e463710804cdf4f108388bc5cf722d8c848d2c7f9f3b0
   1364     # local_signature = 30440220616210b2cc4d3afb601013c373bbd8aac54febd9f15400379a8cb65ce7deca60022034236c010991beb7ff770510561ae8dc885b8d38d1947248c38f2ae055647142
   1365     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8002c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e48454a56a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e04004730440220616210b2cc4d3afb601013c373bbd8aac54febd9f15400379a8cb65ce7deca60022034236c010991beb7ff770510561ae8dc885b8d38d1947248c38f2ae05564714201483045022100c3127b33dcc741dd6b05b1e63cbd1a9a7d816f37af9b6756fa2376b056f032370220408b96279808fe57eb7e463710804cdf4f108388bc5cf722d8c848d2c7f9f3b001475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1366     num_htlcs: 0
   1367 
   1368     name: commitment tx with all five HTLCs untrimmed (minimum feerate)
   1369     to_local_msat: 6988000000
   1370     to_remote_msat: 3000000000
   1371     local_feerate_per_kw: 0
   1372     # base commitment transaction fee = 0
   1373     # actual commitment transaction fee = 0
   1374     # HTLC #2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868
   1375     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1376     # HTLC #0 received amount 1000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac6868
   1377     # HTLC #1 received amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6868
   1378     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1379     # to_local amount 6988000 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1380     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1381     remote_signature = 3044022009b048187705a8cbc9ad73adbe5af148c3d012e1f067961486c822c7af08158c022006d66f3704cfab3eb2dc49dae24e4aa22a6910fc9b424007583204e3621af2e5
   1382     # local_signature = 304402206fc2d1f10ea59951eefac0b4b7c396a3c3d87b71ff0b019796ef4535beaf36f902201765b0181e514d04f4c8ad75659d7037be26cdb3f8bb6f78fe61decef484c3ea
   1383     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8007e80300000000000022002052bfef0479d7b293c27e0f1eb294bea154c63a3294ef092c19af51409bce0e2ad007000000000000220020403d394747cae42e98ff01734ad5c08f82ba123d3d9a620abda88989651e2ab5d007000000000000220020748eba944fedc8827f6b06bc44678f93c0f9e6078b35c6331ed31e75f8ce0c2db80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484e0a06a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e040047304402206fc2d1f10ea59951eefac0b4b7c396a3c3d87b71ff0b019796ef4535beaf36f902201765b0181e514d04f4c8ad75659d7037be26cdb3f8bb6f78fe61decef484c3ea01473044022009b048187705a8cbc9ad73adbe5af148c3d012e1f067961486c822c7af08158c022006d66f3704cfab3eb2dc49dae24e4aa22a6910fc9b424007583204e3621af2e501475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1384     num_htlcs: 5
   1385     # signature for output #0 (htlc-success for htlc #0)
   1386     remote_htlc_signature = 3045022100d9e29616b8f3959f1d3d7f7ce893ffedcdc407717d0de8e37d808c91d3a7c50d022078c3033f6d00095c8720a4bc943c1b45727818c082e4e3ddbc6d3116435b624b
   1387     # local_htlc_signature = 30440220636de5682ef0c5b61f124ec74e8aa2461a69777521d6998295dcea36bc3338110220165285594b23c50b28b82df200234566628a27bcd17f7f14404bd865354eb3ce
   1388     htlc_success_tx (htlc #0): 02000000000101ab84ff284f162cfbfef241f853b47d4368d171f9e2a1445160cd591c4c7d882b00000000000000000001e8030000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100d9e29616b8f3959f1d3d7f7ce893ffedcdc407717d0de8e37d808c91d3a7c50d022078c3033f6d00095c8720a4bc943c1b45727818c082e4e3ddbc6d3116435b624b014730440220636de5682ef0c5b61f124ec74e8aa2461a69777521d6998295dcea36bc3338110220165285594b23c50b28b82df200234566628a27bcd17f7f14404bd865354eb3ce012000000000000000000000000000000000000000000000000000000000000000008a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac686800000000
   1389     # signature for output #1 (htlc-timeout for htlc #2)
   1390     remote_htlc_signature = 30440220649fe8b20e67e46cbb0d09b4acea87dbec001b39b08dee7bdd0b1f03922a8640022037c462dff79df501cecfdb12ea7f4de91f99230bb544726f6e04527b1f896004
   1391     # local_htlc_signature = 3045022100803159dee7935dba4a1d36a61055ce8fd62caa528573cc221ae288515405a252022029c59e7cffce374fe860100a4a63787e105c3cf5156d40b12dd53ff55ac8cf3f
   1392     htlc_timeout_tx (htlc #2): 02000000000101ab84ff284f162cfbfef241f853b47d4368d171f9e2a1445160cd591c4c7d882b01000000000000000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220649fe8b20e67e46cbb0d09b4acea87dbec001b39b08dee7bdd0b1f03922a8640022037c462dff79df501cecfdb12ea7f4de91f99230bb544726f6e04527b1f89600401483045022100803159dee7935dba4a1d36a61055ce8fd62caa528573cc221ae288515405a252022029c59e7cffce374fe860100a4a63787e105c3cf5156d40b12dd53ff55ac8cf3f01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000
   1393     # signature for output #2 (htlc-success for htlc #1)
   1394     remote_htlc_signature = 30440220770fc321e97a19f38985f2e7732dd9fe08d16a2efa4bcbc0429400a447faf49102204d40b417f3113e1b0944ae0986f517564ab4acd3d190503faf97a6e420d43352
   1395     # local_htlc_signature = 3045022100a437cc2ce77400ecde441b3398fea3c3ad8bdad8132be818227fe3c5b8345989022069d45e7fa0ae551ec37240845e2c561ceb2567eacf3076a6a43a502d05865faa
   1396     htlc_success_tx (htlc #1): 02000000000101ab84ff284f162cfbfef241f853b47d4368d171f9e2a1445160cd591c4c7d882b02000000000000000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220770fc321e97a19f38985f2e7732dd9fe08d16a2efa4bcbc0429400a447faf49102204d40b417f3113e1b0944ae0986f517564ab4acd3d190503faf97a6e420d4335201483045022100a437cc2ce77400ecde441b3398fea3c3ad8bdad8132be818227fe3c5b8345989022069d45e7fa0ae551ec37240845e2c561ceb2567eacf3076a6a43a502d05865faa012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000
   1397     # signature for output #3 (htlc-timeout for htlc #3)
   1398     remote_htlc_signature = 304402207bcbf4f60a9829b05d2dbab84ed593e0291836be715dc7db6b72a64caf646af802201e489a5a84f7c5cc130398b841d138d031a5137ac8f4c49c770a4959dc3c1363
   1399     # local_htlc_signature = 304402203121d9b9c055f354304b016a36662ee99e1110d9501cb271b087ddb6f382c2c80220549882f3f3b78d9c492de47543cb9a697cecc493174726146536c5954dac7487
   1400     htlc_timeout_tx (htlc #3): 02000000000101ab84ff284f162cfbfef241f853b47d4368d171f9e2a1445160cd591c4c7d882b03000000000000000001b80b0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402207bcbf4f60a9829b05d2dbab84ed593e0291836be715dc7db6b72a64caf646af802201e489a5a84f7c5cc130398b841d138d031a5137ac8f4c49c770a4959dc3c13630147304402203121d9b9c055f354304b016a36662ee99e1110d9501cb271b087ddb6f382c2c80220549882f3f3b78d9c492de47543cb9a697cecc493174726146536c5954dac748701008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1401     # signature for output #4 (htlc-success for htlc #4)
   1402     remote_htlc_signature = 3044022076dca5cb81ba7e466e349b7128cdba216d4d01659e29b96025b9524aaf0d1899022060de85697b88b21c749702b7d2cfa7dfeaa1f472c8f1d7d9c23f2bf968464b87
   1403     # local_htlc_signature = 3045022100d9080f103cc92bac15ec42464a95f070c7fb6925014e673ee2ea1374d36a7f7502200c65294d22eb20d48564954d5afe04a385551919d8b2ddb4ae2459daaeee1d95
   1404     htlc_success_tx (htlc #4): 02000000000101ab84ff284f162cfbfef241f853b47d4368d171f9e2a1445160cd591c4c7d882b04000000000000000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022076dca5cb81ba7e466e349b7128cdba216d4d01659e29b96025b9524aaf0d1899022060de85697b88b21c749702b7d2cfa7dfeaa1f472c8f1d7d9c23f2bf968464b8701483045022100d9080f103cc92bac15ec42464a95f070c7fb6925014e673ee2ea1374d36a7f7502200c65294d22eb20d48564954d5afe04a385551919d8b2ddb4ae2459daaeee1d95012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1405 
   1406     name: commitment tx with seven outputs untrimmed (maximum feerate)
   1407     to_local_msat: 6988000000
   1408     to_remote_msat: 3000000000
   1409     local_feerate_per_kw: 647
   1410     # base commitment transaction fee = 1024
   1411     # actual commitment transaction fee = 1024
   1412     # HTLC #2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868
   1413     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1414     # HTLC #0 received amount 1000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac6868
   1415     # HTLC #1 received amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6868
   1416     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1417     # to_local amount 6986976 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1418     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1419     remote_signature = 3045022100a135f9e8a5ed25f7277446c67956b00ce6f610ead2bdec2c2f686155b7814772022059f1f6e1a8b336a68efcc1af3fe4d422d4827332b5b067501b099c47b7b5b5ee
   1420     # local_signature = 30450221009ec15c687898bb4da8b3a833e5ab8bfc51ec6e9202aaa8e66611edfd4a85ed1102203d7183e45078b9735c93450bc3415d3e5a8c576141a711ec6ddcb4a893926bb7
   1421     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8007e80300000000000022002052bfef0479d7b293c27e0f1eb294bea154c63a3294ef092c19af51409bce0e2ad007000000000000220020403d394747cae42e98ff01734ad5c08f82ba123d3d9a620abda88989651e2ab5d007000000000000220020748eba944fedc8827f6b06bc44678f93c0f9e6078b35c6331ed31e75f8ce0c2db80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484e09c6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e04004830450221009ec15c687898bb4da8b3a833e5ab8bfc51ec6e9202aaa8e66611edfd4a85ed1102203d7183e45078b9735c93450bc3415d3e5a8c576141a711ec6ddcb4a893926bb701483045022100a135f9e8a5ed25f7277446c67956b00ce6f610ead2bdec2c2f686155b7814772022059f1f6e1a8b336a68efcc1af3fe4d422d4827332b5b067501b099c47b7b5b5ee01475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1422     num_htlcs: 5
   1423     # signature for output #0 (htlc-success for htlc #0)
   1424     remote_htlc_signature = 30450221008437627f9ad84ac67052e2a414a4367b8556fd1f94d8b02590f89f50525cd33502205b9c21ff6e7fc864f2352746ad8ba59182510819acb644e25b8a12fc37bbf24f
   1425     # local_htlc_signature = 30440220344b0deb055230d01703e6c7acd45853c4af2328b49b5d8af4f88a060733406602202ea64f2a43d5751edfe75503cbc35a62e3141b5ed032fa03360faf4ca66f670b
   1426     htlc_success_tx (htlc #0): 020000000001012cfb3e4788c206881d38f2996b6cb2109b5935acb527d14bdaa7b908afa9b2fe0000000000000000000122020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004830450221008437627f9ad84ac67052e2a414a4367b8556fd1f94d8b02590f89f50525cd33502205b9c21ff6e7fc864f2352746ad8ba59182510819acb644e25b8a12fc37bbf24f014730440220344b0deb055230d01703e6c7acd45853c4af2328b49b5d8af4f88a060733406602202ea64f2a43d5751edfe75503cbc35a62e3141b5ed032fa03360faf4ca66f670b012000000000000000000000000000000000000000000000000000000000000000008a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac686800000000
   1427     # signature for output #1 (htlc-timeout for htlc #2)
   1428     remote_htlc_signature = 304402205a67f92bf6845cf2892b48d874ac1daf88a36495cf8a06f93d83180d930a6f75022031da1621d95c3f335cc06a3056cf960199dae600b7cf89088f65fc53cdbef28c
   1429     # local_htlc_signature = 30450221009e5e3822b0185c6799a95288c597b671d6cc69ab80f43740f00c6c3d0752bdda02206da947a74bd98f3175324dc56fdba86cc783703a120a6f0297537e60632f4c7f
   1430     htlc_timeout_tx (htlc #2): 020000000001012cfb3e4788c206881d38f2996b6cb2109b5935acb527d14bdaa7b908afa9b2fe0100000000000000000124060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402205a67f92bf6845cf2892b48d874ac1daf88a36495cf8a06f93d83180d930a6f75022031da1621d95c3f335cc06a3056cf960199dae600b7cf89088f65fc53cdbef28c014830450221009e5e3822b0185c6799a95288c597b671d6cc69ab80f43740f00c6c3d0752bdda02206da947a74bd98f3175324dc56fdba86cc783703a120a6f0297537e60632f4c7f01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000
   1431     # signature for output #2 (htlc-success for htlc #1)
   1432     remote_htlc_signature = 30440220437e21766054a3eef7f65690c5bcfa9920babbc5af92b819f772f6ea96df6c7402207173622024bd97328cfb26c6665e25c2f5d67c319443ccdc60c903217005d8c8
   1433     # local_htlc_signature = 3045022100fcfc47e36b712624677626cef3dc1d67f6583bd46926a6398fe6b00b0c9a37760220525788257b187fc775c6370d04eadf34d06f3650a63f8df851cee0ecb47a1673
   1434     htlc_success_tx (htlc #1): 020000000001012cfb3e4788c206881d38f2996b6cb2109b5935acb527d14bdaa7b908afa9b2fe020000000000000000010a060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220437e21766054a3eef7f65690c5bcfa9920babbc5af92b819f772f6ea96df6c7402207173622024bd97328cfb26c6665e25c2f5d67c319443ccdc60c903217005d8c801483045022100fcfc47e36b712624677626cef3dc1d67f6583bd46926a6398fe6b00b0c9a37760220525788257b187fc775c6370d04eadf34d06f3650a63f8df851cee0ecb47a1673012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000
   1435     # signature for output #3 (htlc-timeout for htlc #3)
   1436     remote_htlc_signature = 304402207436e10737e4df499fc051686d3e11a5bb2310e4d1f1e691d287cef66514791202207cb58e71a6b7a42dd001b7e3ae672ea4f71ea3e1cd412b742e9124abb0739c64
   1437     # local_htlc_signature = 3045022100e78211b8409afb7255ffe37337da87f38646f1faebbdd61bc1920d69e3ead67a02201a626305adfcd16bfb7e9340928d9b6305464eab4aa4c4a3af6646e9b9f69dee
   1438     htlc_timeout_tx (htlc #3): 020000000001012cfb3e4788c206881d38f2996b6cb2109b5935acb527d14bdaa7b908afa9b2fe030000000000000000010c0a0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402207436e10737e4df499fc051686d3e11a5bb2310e4d1f1e691d287cef66514791202207cb58e71a6b7a42dd001b7e3ae672ea4f71ea3e1cd412b742e9124abb0739c6401483045022100e78211b8409afb7255ffe37337da87f38646f1faebbdd61bc1920d69e3ead67a02201a626305adfcd16bfb7e9340928d9b6305464eab4aa4c4a3af6646e9b9f69dee01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1439     # signature for output #4 (htlc-success for htlc #4)
   1440     remote_htlc_signature = 30450221009acd6a827a76bfee50806178dfe0495cd4e1d9c58279c194c7b01520fe68cb8d022024d439047c368883e570997a7d40f0b430cb5a742f507965e7d3063ae3feccca
   1441     # local_htlc_signature = 3044022048762cf546bbfe474f1536365ea7c416e3c0389d60558bc9412cb148fb6ab68202207215d7083b75c96ff9d2b08c59c34e287b66820f530b486a9aa4cdd9c347d5b9
   1442     htlc_success_tx (htlc #4): 020000000001012cfb3e4788c206881d38f2996b6cb2109b5935acb527d14bdaa7b908afa9b2fe04000000000000000001da0d0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004830450221009acd6a827a76bfee50806178dfe0495cd4e1d9c58279c194c7b01520fe68cb8d022024d439047c368883e570997a7d40f0b430cb5a742f507965e7d3063ae3feccca01473044022048762cf546bbfe474f1536365ea7c416e3c0389d60558bc9412cb148fb6ab68202207215d7083b75c96ff9d2b08c59c34e287b66820f530b486a9aa4cdd9c347d5b9012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1443 
   1444     name: commitment tx with six outputs untrimmed (minimum feerate)
   1445     to_local_msat: 6988000000
   1446     to_remote_msat: 3000000000
   1447     local_feerate_per_kw: 648
   1448     # base commitment transaction fee = 914
   1449     # actual commitment transaction fee = 1914
   1450     # HTLC #2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868
   1451     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1452     # HTLC #1 received amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6868
   1453     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1454     # to_local amount 6987086 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1455     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1456     remote_signature = 304402203948f900a5506b8de36a4d8502f94f21dd84fd9c2314ab427d52feaa7a0a19f2022059b6a37a4adaa2c5419dc8aea63c6e2a2ec4c4bde46207f6dc1fcd22152fc6e5
   1457     # local_signature = 3045022100b15f72908ba3382a34ca5b32519240a22300cc6015b6f9418635fb41f3d01d8802207adb331b9ed1575383dca0f2355e86c173802feecf8298fbea53b9d4610583e9
   1458     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8006d007000000000000220020403d394747cae42e98ff01734ad5c08f82ba123d3d9a620abda88989651e2ab5d007000000000000220020748eba944fedc8827f6b06bc44678f93c0f9e6078b35c6331ed31e75f8ce0c2db80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e4844e9d6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100b15f72908ba3382a34ca5b32519240a22300cc6015b6f9418635fb41f3d01d8802207adb331b9ed1575383dca0f2355e86c173802feecf8298fbea53b9d4610583e90147304402203948f900a5506b8de36a4d8502f94f21dd84fd9c2314ab427d52feaa7a0a19f2022059b6a37a4adaa2c5419dc8aea63c6e2a2ec4c4bde46207f6dc1fcd22152fc6e501475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1459     num_htlcs: 4
   1460     # signature for output #0 (htlc-timeout for htlc #2)
   1461     remote_htlc_signature = 3045022100a031202f3be94678f0e998622ee95ebb6ada8da1e9a5110228b5e04a747351e4022010ca6a21e18314ed53cfaae3b1f51998552a61a468e596368829a50ce40110e0
   1462     # local_htlc_signature = 304502210097e1873b57267730154595187a34949d3744f52933070c74757005e61ce2112e02204ecfba2aa42d4f14bdf8bad4206bb97217b702e6c433e0e1b0ce6587e6d46ec6
   1463     htlc_timeout_tx (htlc #2): 020000000001010f44041fdfba175987cf4e6135ba2a154e3b7fb96483dc0ed5efc0678e5b6bf10000000000000000000123060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100a031202f3be94678f0e998622ee95ebb6ada8da1e9a5110228b5e04a747351e4022010ca6a21e18314ed53cfaae3b1f51998552a61a468e596368829a50ce40110e00148304502210097e1873b57267730154595187a34949d3744f52933070c74757005e61ce2112e02204ecfba2aa42d4f14bdf8bad4206bb97217b702e6c433e0e1b0ce6587e6d46ec601008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000
   1464     # signature for output #1 (htlc-success for htlc #1)
   1465     remote_htlc_signature = 304402202361012a634aee7835c5ecdd6413dcffa8f404b7e77364c792cff984e4ee71e90220715c5e90baa08daa45a7439b1ee4fa4843ed77b19c058240b69406606d384124
   1466     # local_htlc_signature = 3044022019de73b00f1d818fb388e83b2c8c31f6bce35ac624e215bc12f88f9dc33edf48022006ff814bb9f700ee6abc3294e146fac3efd4f13f0005236b41c0a946ee00c9ae
   1467     htlc_success_tx (htlc #1): 020000000001010f44041fdfba175987cf4e6135ba2a154e3b7fb96483dc0ed5efc0678e5b6bf10100000000000000000109060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402202361012a634aee7835c5ecdd6413dcffa8f404b7e77364c792cff984e4ee71e90220715c5e90baa08daa45a7439b1ee4fa4843ed77b19c058240b69406606d38412401473044022019de73b00f1d818fb388e83b2c8c31f6bce35ac624e215bc12f88f9dc33edf48022006ff814bb9f700ee6abc3294e146fac3efd4f13f0005236b41c0a946ee00c9ae012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000
   1468     # signature for output #2 (htlc-timeout for htlc #3)
   1469     remote_htlc_signature = 304402207e8e82cd71ed4febeb593732c260456836e97d81896153ecd2b3cf320ca6861702202dd4a30f68f98ced7cc56a36369ac1fdd978248c5ff4ed204fc00cc625532989
   1470     # local_htlc_signature = 3045022100bd0be6100c4fd8f102ec220e1b053e4c4e2ecca25615490150007b40d314dc3902201a1e0ea266965b43164d9e6576f58fa6726d42883dd1c3996d2925c2e2260796
   1471     htlc_timeout_tx (htlc #3): 020000000001010f44041fdfba175987cf4e6135ba2a154e3b7fb96483dc0ed5efc0678e5b6bf1020000000000000000010b0a0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402207e8e82cd71ed4febeb593732c260456836e97d81896153ecd2b3cf320ca6861702202dd4a30f68f98ced7cc56a36369ac1fdd978248c5ff4ed204fc00cc62553298901483045022100bd0be6100c4fd8f102ec220e1b053e4c4e2ecca25615490150007b40d314dc3902201a1e0ea266965b43164d9e6576f58fa6726d42883dd1c3996d2925c2e226079601008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1472     # signature for output #3 (htlc-success for htlc #4)
   1473     remote_htlc_signature = 3044022024cd52e4198c8ae0e414a86d86b5a65ea7450f2eb4e783096736d93395eca5ce022078f0094745b45be4d4b2b04dd5978c9e66ba49109e5704403e84aaf5f387d6be
   1474     # local_htlc_signature = 3045022100bbfb9d0a946d420807c86e985d636cceb16e71c3694ed186316251a00cbd807202207773223f9a337e145f64673825be9b30d07ef1542c82188b264bedcf7cda78c6
   1475     htlc_success_tx (htlc #4): 020000000001010f44041fdfba175987cf4e6135ba2a154e3b7fb96483dc0ed5efc0678e5b6bf103000000000000000001d90d0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022024cd52e4198c8ae0e414a86d86b5a65ea7450f2eb4e783096736d93395eca5ce022078f0094745b45be4d4b2b04dd5978c9e66ba49109e5704403e84aaf5f387d6be01483045022100bbfb9d0a946d420807c86e985d636cceb16e71c3694ed186316251a00cbd807202207773223f9a337e145f64673825be9b30d07ef1542c82188b264bedcf7cda78c6012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1476 
   1477     name: commitment tx with six outputs untrimmed (maximum feerate)
   1478     to_local_msat: 6988000000
   1479     to_remote_msat: 3000000000
   1480     local_feerate_per_kw: 2069
   1481     # base commitment transaction fee = 2921
   1482     # actual commitment transaction fee = 3921
   1483     # HTLC #2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868
   1484     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1485     # HTLC #1 received amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6868
   1486     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1487     # to_local amount 6985079 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1488     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1489     remote_signature = 304502210090b96a2498ce0c0f2fadbec2aab278fed54c1a7838df793ec4d2c78d96ec096202204fdd439c50f90d483baa7b68feeef4bd33bc277695405447bcd0bfb2ca34d7bc
   1490     # local_signature = 3045022100ad9a9bbbb75d506ca3b716b336ee3cf975dd7834fcf129d7dd188146eb58a8b4022061a759ee417339f7fe2ea1e8deb83abb6a74db31a09b7648a932a639cda23e33
   1491     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8006d007000000000000220020403d394747cae42e98ff01734ad5c08f82ba123d3d9a620abda88989651e2ab5d007000000000000220020748eba944fedc8827f6b06bc44678f93c0f9e6078b35c6331ed31e75f8ce0c2db80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e48477956a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100ad9a9bbbb75d506ca3b716b336ee3cf975dd7834fcf129d7dd188146eb58a8b4022061a759ee417339f7fe2ea1e8deb83abb6a74db31a09b7648a932a639cda23e330148304502210090b96a2498ce0c0f2fadbec2aab278fed54c1a7838df793ec4d2c78d96ec096202204fdd439c50f90d483baa7b68feeef4bd33bc277695405447bcd0bfb2ca34d7bc01475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1492     num_htlcs: 4
   1493     # signature for output #0 (htlc-timeout for htlc #2)
   1494     remote_htlc_signature = 3045022100f33513ee38abf1c582876f921f8fddc06acff48e04515532a32d3938de938ffd02203aa308a2c1863b7d6fdf53159a1465bf2e115c13152546cc5d74483ceaa7f699
   1495     # local_htlc_signature = 3045022100a637902a5d4c9ba9e7c472a225337d5aac9e2e3f6744f76e237132e7619ba0400220035c60d784a031c0d9f6df66b7eab8726a5c25397399ee4aa960842059eb3f9d
   1496     htlc_timeout_tx (htlc #2): 02000000000101adbe717a63fb658add30ada1e6e12ed257637581898abe475c11d7bbcd65bd4d0000000000000000000175020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100f33513ee38abf1c582876f921f8fddc06acff48e04515532a32d3938de938ffd02203aa308a2c1863b7d6fdf53159a1465bf2e115c13152546cc5d74483ceaa7f69901483045022100a637902a5d4c9ba9e7c472a225337d5aac9e2e3f6744f76e237132e7619ba0400220035c60d784a031c0d9f6df66b7eab8726a5c25397399ee4aa960842059eb3f9d01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000
   1497     # signature for output #1 (htlc-success for htlc #1)
   1498     remote_htlc_signature = 3045022100ce07682cf4b90093c22dc2d9ab2a77ad6803526b655ef857221cc96af5c9e0bf02200f501cee22e7a268af40b555d15a8237c9f36ad67ef1841daf9f6a0267b1e6df
   1499     # local_htlc_signature = 3045022100e57e46234f8782d3ff7aa593b4f7446fb5316c842e693dc63ee324fd49f6a1c302204a2f7b44c48bd26e1554422afae13153eb94b29d3687b733d18930615fb2db61
   1500     htlc_success_tx (htlc #1): 02000000000101adbe717a63fb658add30ada1e6e12ed257637581898abe475c11d7bbcd65bd4d0100000000000000000122020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100ce07682cf4b90093c22dc2d9ab2a77ad6803526b655ef857221cc96af5c9e0bf02200f501cee22e7a268af40b555d15a8237c9f36ad67ef1841daf9f6a0267b1e6df01483045022100e57e46234f8782d3ff7aa593b4f7446fb5316c842e693dc63ee324fd49f6a1c302204a2f7b44c48bd26e1554422afae13153eb94b29d3687b733d18930615fb2db61012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000
   1501     # signature for output #2 (htlc-timeout for htlc #3)
   1502     remote_htlc_signature = 3045022100e3e35492e55f82ec0bc2f317ffd7a486d1f7024330fe9743c3559fc39f32ef0c02203d1d4db651fc388a91d5ad8ecdd8e83673063bc8eefe27cfd8c189090e3a23e0
   1503     # local_htlc_signature = 3044022068613fb1b98eb3aec7f44c5b115b12343c2f066c4277c82b5f873dfe68f37f50022028109b4650f3f528ca4bfe9a467aff2e3e43893b61b5159157119d5d95cf1c18
   1504     htlc_timeout_tx (htlc #3): 02000000000101adbe717a63fb658add30ada1e6e12ed257637581898abe475c11d7bbcd65bd4d020000000000000000015d060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100e3e35492e55f82ec0bc2f317ffd7a486d1f7024330fe9743c3559fc39f32ef0c02203d1d4db651fc388a91d5ad8ecdd8e83673063bc8eefe27cfd8c189090e3a23e001473044022068613fb1b98eb3aec7f44c5b115b12343c2f066c4277c82b5f873dfe68f37f50022028109b4650f3f528ca4bfe9a467aff2e3e43893b61b5159157119d5d95cf1c1801008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1505     # signature for output #3 (htlc-success for htlc #4)
   1506     remote_htlc_signature = 304402207475aeb0212ef9bf5130b60937817ad88c9a87976988ef1f323f026148cc4a850220739fea17ad3257dcad72e509c73eebe86bee30b178467b9fdab213d631b109df
   1507     # local_htlc_signature = 3045022100d315522e09e7d53d2a659a79cb67fef56d6c4bddf3f46df6772d0d20a7beb7c8022070bcc17e288607b6a72be0bd83368bb6d53488db266c1cdb4d72214e4f02ac33
   1508     htlc_success_tx (htlc #4): 02000000000101adbe717a63fb658add30ada1e6e12ed257637581898abe475c11d7bbcd65bd4d03000000000000000001f2090000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402207475aeb0212ef9bf5130b60937817ad88c9a87976988ef1f323f026148cc4a850220739fea17ad3257dcad72e509c73eebe86bee30b178467b9fdab213d631b109df01483045022100d315522e09e7d53d2a659a79cb67fef56d6c4bddf3f46df6772d0d20a7beb7c8022070bcc17e288607b6a72be0bd83368bb6d53488db266c1cdb4d72214e4f02ac33012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1509 
   1510     name: commitment tx with five outputs untrimmed (minimum feerate)
   1511     to_local_msat: 6988000000
   1512     to_remote_msat: 3000000000
   1513     local_feerate_per_kw: 2070
   1514     # base commitment transaction fee = 2566
   1515     # actual commitment transaction fee = 5566
   1516     # HTLC #2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868
   1517     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1518     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1519     # to_local amount 6985434 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1520     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1521     remote_signature = 304402204ca1ba260dee913d318271d86e10ca0f5883026fb5653155cff600fb40895223022037b145204b7054a40e08bb1fefbd826f827b40838d3e501423bcc57924bcb50c
   1522     # local_signature = 3044022001014419b5ba00e083ac4e0a85f19afc848aacac2d483b4b525d15e2ae5adbfe022015ebddad6ee1e72b47cb09f3e78459da5be01ccccd95dceca0e056a00cc773c1
   1523     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8005d007000000000000220020403d394747cae42e98ff01734ad5c08f82ba123d3d9a620abda88989651e2ab5b80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484da966a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400473044022001014419b5ba00e083ac4e0a85f19afc848aacac2d483b4b525d15e2ae5adbfe022015ebddad6ee1e72b47cb09f3e78459da5be01ccccd95dceca0e056a00cc773c10147304402204ca1ba260dee913d318271d86e10ca0f5883026fb5653155cff600fb40895223022037b145204b7054a40e08bb1fefbd826f827b40838d3e501423bcc57924bcb50c01475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1524     num_htlcs: 3
   1525     # signature for output #0 (htlc-timeout for htlc #2)
   1526     remote_htlc_signature = 304402205f6b6d12d8d2529fb24f4445630566cf4abbd0f9330ab6c2bdb94222d6a2a0c502202f556258ae6f05b193749e4c541dfcc13b525a5422f6291f073f15617ba8579b
   1527     # local_htlc_signature = 30440220150b11069454da70caf2492ded9e0065c9a57f25ac2a4c52657b1d15b6c6ed85022068a38833b603c8892717206383611bad210f1cbb4b1f87ea29c6c65b9e1cb3e5
   1528     htlc_timeout_tx (htlc #2): 02000000000101403ad7602b43293497a3a2235a12ecefda4f3a1f1d06e49b1786d945685de1ff0000000000000000000174020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402205f6b6d12d8d2529fb24f4445630566cf4abbd0f9330ab6c2bdb94222d6a2a0c502202f556258ae6f05b193749e4c541dfcc13b525a5422f6291f073f15617ba8579b014730440220150b11069454da70caf2492ded9e0065c9a57f25ac2a4c52657b1d15b6c6ed85022068a38833b603c8892717206383611bad210f1cbb4b1f87ea29c6c65b9e1cb3e501008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000
   1529     # signature for output #1 (htlc-timeout for htlc #3)
   1530     remote_htlc_signature = 3045022100f960dfb1c9aee7ce1437efa65b523e399383e8149790e05d8fed27ff6e42fe0002202fe8613e062ffe0b0c518cc4101fba1c6de70f64a5bcc7ae663f2efae43b8546
   1531     # local_htlc_signature = 30450221009a6ed18e6873bc3644332a6ee21c152a5b102821865350df7a8c74451a51f9f2022050d801fb4895d7d7fbf452824c0168347f5c0cbe821cf6a97a63af5b8b2563c6
   1532     htlc_timeout_tx (htlc #3): 02000000000101403ad7602b43293497a3a2235a12ecefda4f3a1f1d06e49b1786d945685de1ff010000000000000000015c060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100f960dfb1c9aee7ce1437efa65b523e399383e8149790e05d8fed27ff6e42fe0002202fe8613e062ffe0b0c518cc4101fba1c6de70f64a5bcc7ae663f2efae43b8546014830450221009a6ed18e6873bc3644332a6ee21c152a5b102821865350df7a8c74451a51f9f2022050d801fb4895d7d7fbf452824c0168347f5c0cbe821cf6a97a63af5b8b2563c601008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1533     # signature for output #2 (htlc-success for htlc #4)
   1534     remote_htlc_signature = 3045022100ae5fc7717ae684bc1fcf9020854e5dbe9842c9e7472879ac06ff95ac2bb10e4e022057728ada4c00083a3e65493fb5d50a232165948a1a0f530ef63185c2c8c56504
   1535     # local_htlc_signature = 30440220408ad3009827a8fccf774cb285587686bfb2ed041f89a89453c311ce9c8ee0f902203c7392d9f8306d3a46522a66bd2723a7eb2628cb2d9b34d4c104f1766bf37502
   1536     htlc_success_tx (htlc #4): 02000000000101403ad7602b43293497a3a2235a12ecefda4f3a1f1d06e49b1786d945685de1ff02000000000000000001f1090000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100ae5fc7717ae684bc1fcf9020854e5dbe9842c9e7472879ac06ff95ac2bb10e4e022057728ada4c00083a3e65493fb5d50a232165948a1a0f530ef63185c2c8c56504014730440220408ad3009827a8fccf774cb285587686bfb2ed041f89a89453c311ce9c8ee0f902203c7392d9f8306d3a46522a66bd2723a7eb2628cb2d9b34d4c104f1766bf37502012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1537 
   1538     name: commitment tx with five outputs untrimmed (maximum feerate)
   1539     to_local_msat: 6988000000
   1540     to_remote_msat: 3000000000
   1541     local_feerate_per_kw: 2194
   1542     # base commitment transaction fee = 2720
   1543     # actual commitment transaction fee = 5720
   1544     # HTLC #2 offered amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868
   1545     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1546     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1547     # to_local amount 6985280 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1548     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1549     remote_signature = 304402204bb3d6e279d71d9da414c82de42f1f954267c762b2e2eb8b76bc3be4ea07d4b0022014febc009c5edc8c3fc5d94015de163200f780046f1c293bfed8568f08b70fb3
   1550     # local_signature = 3044022072c2e2b1c899b2242656a537dde2892fa3801be0d6df0a87836c550137acde8302201654aa1974d37a829083c3ba15088689f30b56d6a4f6cb14c7bad0ee3116d398
   1551     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8005d007000000000000220020403d394747cae42e98ff01734ad5c08f82ba123d3d9a620abda88989651e2ab5b80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e48440966a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400473044022072c2e2b1c899b2242656a537dde2892fa3801be0d6df0a87836c550137acde8302201654aa1974d37a829083c3ba15088689f30b56d6a4f6cb14c7bad0ee3116d3980147304402204bb3d6e279d71d9da414c82de42f1f954267c762b2e2eb8b76bc3be4ea07d4b0022014febc009c5edc8c3fc5d94015de163200f780046f1c293bfed8568f08b70fb301475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1552     num_htlcs: 3
   1553     # signature for output #0 (htlc-timeout for htlc #2)
   1554     remote_htlc_signature = 3045022100939726680351a7856c1bc386d4a1f422c7d29bd7b56afc139570f508474e6c40022023175a799ccf44c017fbaadb924c40b2a12115a5b7d0dfd3228df803a2de8450
   1555     # local_htlc_signature = 304502210099c98c2edeeee6ec0fb5f3bea8b79bb016a2717afa9b5072370f34382de281d302206f5e2980a995e045cf90a547f0752a7ee99d48547bc135258fe7bc07e0154301
   1556     htlc_timeout_tx (htlc #2): 02000000000101153cd825fdb3aa624bfe513e8031d5d08c5e582fb3d1d1fe8faf27d3eed410cd0000000000000000000122020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100939726680351a7856c1bc386d4a1f422c7d29bd7b56afc139570f508474e6c40022023175a799ccf44c017fbaadb924c40b2a12115a5b7d0dfd3228df803a2de84500148304502210099c98c2edeeee6ec0fb5f3bea8b79bb016a2717afa9b5072370f34382de281d302206f5e2980a995e045cf90a547f0752a7ee99d48547bc135258fe7bc07e015430101008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6868f6010000
   1557     # signature for output #1 (htlc-timeout for htlc #3)
   1558     remote_htlc_signature = 3044022021bb883bf324553d085ba2e821cad80c28ef8b303dbead8f98e548783c02d1600220638f9ef2a9bba25869afc923f4b5dc38be3bb459f9efa5d869392d5f7779a4a0
   1559     # local_htlc_signature = 3045022100fd85bd7697b89c08ec12acc8ba89b23090637d83abd26ca37e01ae93e67c367302202b551fe69386116c47f984aab9c8dfd25d864dcde5d3389cfbef2447a85c4b77
   1560     htlc_timeout_tx (htlc #3): 02000000000101153cd825fdb3aa624bfe513e8031d5d08c5e582fb3d1d1fe8faf27d3eed410cd010000000000000000010a060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022021bb883bf324553d085ba2e821cad80c28ef8b303dbead8f98e548783c02d1600220638f9ef2a9bba25869afc923f4b5dc38be3bb459f9efa5d869392d5f7779a4a001483045022100fd85bd7697b89c08ec12acc8ba89b23090637d83abd26ca37e01ae93e67c367302202b551fe69386116c47f984aab9c8dfd25d864dcde5d3389cfbef2447a85c4b7701008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1561     # signature for output #2 (htlc-success for htlc #4)
   1562     remote_htlc_signature = 3045022100c9e6f0454aa598b905a35e641a70cc9f67b5f38cc4b00843a041238c4a9f1c4a0220260a2822a62da97e44583e837245995ca2e36781769c52f19e498efbdcca262b
   1563     # local_htlc_signature = 30450221008a9f2ea24cd455c2b64c1472a5fa83865b0a5f49a62b661801e884cf2849af8302204d44180e50bf6adfcf1c1e581d75af91aba4e28681ce4a5ee5f3cbf65eca10f3
   1564     htlc_success_tx (htlc #4): 02000000000101153cd825fdb3aa624bfe513e8031d5d08c5e582fb3d1d1fe8faf27d3eed410cd020000000000000000019a090000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100c9e6f0454aa598b905a35e641a70cc9f67b5f38cc4b00843a041238c4a9f1c4a0220260a2822a62da97e44583e837245995ca2e36781769c52f19e498efbdcca262b014830450221008a9f2ea24cd455c2b64c1472a5fa83865b0a5f49a62b661801e884cf2849af8302204d44180e50bf6adfcf1c1e581d75af91aba4e28681ce4a5ee5f3cbf65eca10f3012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1565 
   1566     name: commitment tx with four outputs untrimmed (minimum feerate)
   1567     to_local_msat: 6988000000
   1568     to_remote_msat: 3000000000
   1569     local_feerate_per_kw: 2195
   1570     # base commitment transaction fee = 2344
   1571     # actual commitment transaction fee = 7344
   1572     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1573     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1574     # to_local amount 6985656 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1575     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1576     remote_signature = 304402201a8c1b1f9671cd9e46c7323a104d7047cc48d3ee80d40d4512e0c72b8dc65666022066d7f9a2ce18c9eb22d2739ffcce05721c767f9b607622a31b6ea5793ddce403
   1577     # local_signature = 3044022044d592025b610c0d678f65032e87035cdfe89d1598c522cc32524ae8172417c30220749fef9d5b2ae8cdd91ece442ba8809bc891efedae2291e578475f97715d1767
   1578     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8004b80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484b8976a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400473044022044d592025b610c0d678f65032e87035cdfe89d1598c522cc32524ae8172417c30220749fef9d5b2ae8cdd91ece442ba8809bc891efedae2291e578475f97715d17670147304402201a8c1b1f9671cd9e46c7323a104d7047cc48d3ee80d40d4512e0c72b8dc65666022066d7f9a2ce18c9eb22d2739ffcce05721c767f9b607622a31b6ea5793ddce40301475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1579     num_htlcs: 2
   1580     # signature for output #0 (htlc-timeout for htlc #3)
   1581     remote_htlc_signature = 3045022100e57b845066a06ee7c2cbfc29eabffe52daa9bf6f6de760066d04df9f9b250e0002202ffb197f0e6e0a77a75a9aff27014bd3de83b7f748d7efef986abe655e1dd50e
   1582     # local_htlc_signature = 3045022100ecc8c6529d0b2316d046f0f0757c1e1c25a636db168ec4f3aa1b9278df685dc0022067ae6b65e936f1337091f7b18a15935b608c5f2cdddb2f892ed0babfdd376d76
   1583     htlc_timeout_tx (htlc #3): 020000000001018130a10f09b13677ba2885a8bca32860f3a952e5912b829a473639b5a2c07b900000000000000000000109060000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100e57b845066a06ee7c2cbfc29eabffe52daa9bf6f6de760066d04df9f9b250e0002202ffb197f0e6e0a77a75a9aff27014bd3de83b7f748d7efef986abe655e1dd50e01483045022100ecc8c6529d0b2316d046f0f0757c1e1c25a636db168ec4f3aa1b9278df685dc0022067ae6b65e936f1337091f7b18a15935b608c5f2cdddb2f892ed0babfdd376d7601008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1584     # signature for output #1 (htlc-success for htlc #4)
   1585     remote_htlc_signature = 3045022100d193b7ecccad8057571620a0b1ffa6c48e9483311723b59cf536043b20bc51550220546d4bd37b3b101ecda14f6c907af46ec391abce1cd9c7ce22b1a62b534f2f2a
   1586     # local_htlc_signature = 3044022014d66f11f9cacf923807eba49542076c5fe5cccf252fb08fe98c78ef3ca6ab5402201b290dbe043cc512d9d78de074a5a129b8759bc6a6c546b190d120b690bd6e82
   1587     htlc_success_tx (htlc #4): 020000000001018130a10f09b13677ba2885a8bca32860f3a952e5912b829a473639b5a2c07b900100000000000000000199090000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100d193b7ecccad8057571620a0b1ffa6c48e9483311723b59cf536043b20bc51550220546d4bd37b3b101ecda14f6c907af46ec391abce1cd9c7ce22b1a62b534f2f2a01473044022014d66f11f9cacf923807eba49542076c5fe5cccf252fb08fe98c78ef3ca6ab5402201b290dbe043cc512d9d78de074a5a129b8759bc6a6c546b190d120b690bd6e82012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1588 
   1589     name: commitment tx with four outputs untrimmed (maximum feerate)
   1590     to_local_msat: 6988000000
   1591     to_remote_msat: 3000000000
   1592     local_feerate_per_kw: 3702
   1593     # base commitment transaction fee = 3953
   1594     # actual commitment transaction fee = 8953
   1595     # HTLC #3 offered amount 3000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868
   1596     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1597     # to_local amount 6984047 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1598     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1599     remote_signature = 304502210092a587aeb777f869e7ff0d7898ea619ee26a3dacd1f3672b945eea600be431100220077ee9eae3528d15251f2a52b607b189820e57a6ccfac8d1af502b132ee40169
   1600     # local_signature = 3045022100e5efb73c32d32da2d79702299b6317de6fb24a60476e3855926d78484dd1b3c802203557cb66a42c944ef06e00bcc4da35a5bcb2f185aab0f8e403e519e1d66aaf75
   1601     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8004b80b000000000000220020c20b5d1f8584fd90443e7b7b720136174fa4b9333c261d04dbbd012635c0f419a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e4846f916a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100e5efb73c32d32da2d79702299b6317de6fb24a60476e3855926d78484dd1b3c802203557cb66a42c944ef06e00bcc4da35a5bcb2f185aab0f8e403e519e1d66aaf750148304502210092a587aeb777f869e7ff0d7898ea619ee26a3dacd1f3672b945eea600be431100220077ee9eae3528d15251f2a52b607b189820e57a6ccfac8d1af502b132ee4016901475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1602     num_htlcs: 2
   1603     # signature for output #0 (htlc-timeout for htlc #3)
   1604     remote_htlc_signature = 304402206fa54c11f98c3bae1e93df43fc7affeb05b476bf8060c03e29c377c69bc08e8b0220672701cce50d5c379ff45a5d2cfe48ac44973adb066ac32608e21221d869bb89
   1605     # local_htlc_signature = 304402206e36c683ebf2cb16bcef3d5439cf8b53cd97280a365ed8acd7abb85a8ba5f21c02206e8621edfc2a5766cbc96eb67fd501127ff163eb6b85518a39f7d4974aef126f
   1606     htlc_timeout_tx (htlc #3): 020000000001018db483bff65c70ee71d8282aeec5a880e2e2b39e45772bda5460403095c62e3f0000000000000000000122020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402206fa54c11f98c3bae1e93df43fc7affeb05b476bf8060c03e29c377c69bc08e8b0220672701cce50d5c379ff45a5d2cfe48ac44973adb066ac32608e21221d869bb890147304402206e36c683ebf2cb16bcef3d5439cf8b53cd97280a365ed8acd7abb85a8ba5f21c02206e8621edfc2a5766cbc96eb67fd501127ff163eb6b85518a39f7d4974aef126f01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6868f7010000
   1607     # signature for output #1 (htlc-success for htlc #4)
   1608     remote_htlc_signature = 3044022057649739b0eb74d541ead0dfdb3d4b2c15aa192720031044c3434c67812e5ca902201e5ede42d960ae551707f4a6b34b09393cf4dee2418507daa022e3550dbb5817
   1609     # local_htlc_signature = 304402207faad26678c8850e01b4a0696d60841f7305e1832b786110ee9075cb92ed14a30220516ef8ee5dfa80824ea28cbcec0dd95f8b847146257c16960db98507db15ffdc
   1610     htlc_success_tx (htlc #4): 020000000001018db483bff65c70ee71d8282aeec5a880e2e2b39e45772bda5460403095c62e3f0100000000000000000176050000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022057649739b0eb74d541ead0dfdb3d4b2c15aa192720031044c3434c67812e5ca902201e5ede42d960ae551707f4a6b34b09393cf4dee2418507daa022e3550dbb58170147304402207faad26678c8850e01b4a0696d60841f7305e1832b786110ee9075cb92ed14a30220516ef8ee5dfa80824ea28cbcec0dd95f8b847146257c16960db98507db15ffdc012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1611 
   1612     name: commitment tx with three outputs untrimmed (minimum feerate)
   1613     to_local_msat: 6988000000
   1614     to_remote_msat: 3000000000
   1615     local_feerate_per_kw: 3703
   1616     # base commitment transaction fee = 3317
   1617     # actual commitment transaction fee = 11317
   1618     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1619     # to_local amount 6984683 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1620     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1621     remote_signature = 3045022100b495d239772a237ff2cf354b1b11be152fd852704cb184e7356d13f2fb1e5e430220723db5cdb9cbd6ead7bfd3deb419cf41053a932418cbb22a67b581f40bc1f13e
   1622     # local_signature = 304402201b736d1773a124c745586217a75bed5f66c05716fbe8c7db4fdb3c3069741cdd02205083f39c321c1bcadfc8d97e3c791a66273d936abac0c6a2fde2ed46019508e1
   1623     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8003a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484eb936a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e040047304402201b736d1773a124c745586217a75bed5f66c05716fbe8c7db4fdb3c3069741cdd02205083f39c321c1bcadfc8d97e3c791a66273d936abac0c6a2fde2ed46019508e101483045022100b495d239772a237ff2cf354b1b11be152fd852704cb184e7356d13f2fb1e5e430220723db5cdb9cbd6ead7bfd3deb419cf41053a932418cbb22a67b581f40bc1f13e01475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1624     num_htlcs: 1
   1625     # signature for output #0 (htlc-success for htlc #4)
   1626     remote_htlc_signature = 3045022100c34c61735f93f2e324cc873c3b248111ccf8f6db15d5969583757010d4ad2b4602207867bb919b2ddd6387873e425345c9b7fd18d1d66aba41f3607bc2896ef3c30a
   1627     # local_htlc_signature = 3045022100988c143e2110067117d2321bdd4bd16ca1734c98b29290d129384af0962b634e02206c1b02478878c5f547018b833986578f90c3e9be669fe5788ad0072a55acbb05
   1628     htlc_success_tx (htlc #4): 0200000000010120060e4a29579d429f0f27c17ee5f1ee282f20d706d6f90b63d35946d8f3029a0000000000000000000175050000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100c34c61735f93f2e324cc873c3b248111ccf8f6db15d5969583757010d4ad2b4602207867bb919b2ddd6387873e425345c9b7fd18d1d66aba41f3607bc2896ef3c30a01483045022100988c143e2110067117d2321bdd4bd16ca1734c98b29290d129384af0962b634e02206c1b02478878c5f547018b833986578f90c3e9be669fe5788ad0072a55acbb05012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1629 
   1630     name: commitment tx with three outputs untrimmed (maximum feerate)
   1631     to_local_msat: 6988000000
   1632     to_remote_msat: 3000000000
   1633     local_feerate_per_kw: 4914
   1634     # base commitment transaction fee = 4402
   1635     # actual commitment transaction fee = 12402
   1636     # HTLC #4 received amount 4000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6868
   1637     # to_local amount 6983598 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1638     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1639     remote_signature = 3045022100b4b16d5f8cc9fc4c1aff48831e832a0d8990e133978a66e302c133550954a44d022073573ce127e2200d316f6b612803a5c0c97b8d20e1e44dbe2ac0dd2fb8c95244
   1640     # local_signature = 3045022100d72638bc6308b88bb6d45861aae83e5b9ff6e10986546e13bce769c70036e2620220320be7c6d66d22f30b9fcd52af66531505b1310ca3b848c19285b38d8a1a8c19
   1641     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8003a00f0000000000002200208c48d15160397c9731df9bc3b236656efb6665fbfe92b4a6878e88a499f741c4c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484ae8f6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100d72638bc6308b88bb6d45861aae83e5b9ff6e10986546e13bce769c70036e2620220320be7c6d66d22f30b9fcd52af66531505b1310ca3b848c19285b38d8a1a8c1901483045022100b4b16d5f8cc9fc4c1aff48831e832a0d8990e133978a66e302c133550954a44d022073573ce127e2200d316f6b612803a5c0c97b8d20e1e44dbe2ac0dd2fb8c9524401475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1642     num_htlcs: 1
   1643     # signature for output #0 (htlc-success for htlc #4)
   1644     remote_htlc_signature = 3045022100f43591c156038ba217756006bb3c55f7d113a325cdd7d9303c82115372858d68022016355b5aadf222bc8d12e426c75f4a03423917b2443a103eb2a498a3a2234374
   1645     # local_htlc_signature = 30440220585dee80fafa264beac535c3c0bb5838ac348b156fdc982f86adc08dfc9bfd250220130abb82f9f295cc9ef423dcfef772fde2acd85d9df48cc538981d26a10a9c10
   1646     htlc_success_tx (htlc #4): 02000000000101a9172908eace869cc35128c31fc2ab502f72e4dff31aab23e0244c4b04b11ab00000000000000000000122020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100f43591c156038ba217756006bb3c55f7d113a325cdd7d9303c82115372858d68022016355b5aadf222bc8d12e426c75f4a03423917b2443a103eb2a498a3a2234374014730440220585dee80fafa264beac535c3c0bb5838ac348b156fdc982f86adc08dfc9bfd250220130abb82f9f295cc9ef423dcfef772fde2acd85d9df48cc538981d26a10a9c10012004040404040404040404040404040404040404040404040404040404040404048a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac686800000000
   1647 
   1648     name: commitment tx with two outputs untrimmed (minimum feerate)
   1649     to_local_msat: 6988000000
   1650     to_remote_msat: 3000000000
   1651     local_feerate_per_kw: 4915
   1652     # base commitment transaction fee = 3558
   1653     # actual commitment transaction fee = 15558
   1654     # to_local amount 6984442 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1655     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1656     remote_signature = 304402203a286936e74870ca1459c700c71202af0381910a6bfab687ef494ef1bc3e02c902202506c362d0e3bee15e802aa729bf378e051644648253513f1c085b264cc2a720
   1657     # local_signature = 30450221008a953551f4d67cb4df3037207fc082ddaf6be84d417b0bd14c80aab66f1b01a402207508796dc75034b2dee876fe01dc05a08b019f3e5d689ac8842ade2f1befccf5
   1658     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8002c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484fa926a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e04004830450221008a953551f4d67cb4df3037207fc082ddaf6be84d417b0bd14c80aab66f1b01a402207508796dc75034b2dee876fe01dc05a08b019f3e5d689ac8842ade2f1befccf50147304402203a286936e74870ca1459c700c71202af0381910a6bfab687ef494ef1bc3e02c902202506c362d0e3bee15e802aa729bf378e051644648253513f1c085b264cc2a72001475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1659     num_htlcs: 0
   1660 
   1661     name: commitment tx with two outputs untrimmed (maximum feerate)
   1662     to_local_msat: 6988000000
   1663     to_remote_msat: 3000000000
   1664     local_feerate_per_kw: 9651180
   1665     # base commitment transaction fee = 6987454
   1666     # actual commitment transaction fee = 6999454
   1667     # to_local amount 546 wscript 63210212a140cd0c6539d07cd08dfe09984dec3251ea808b892efeac3ede9402bf2b1967029000b2752103fd5960528dc152014952efdb702a88f71e3c1653b2314431701ec77e57fde83c68ac
   1668     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1669     remote_signature = 304402200a8544eba1d216f5c5e530597665fa9bec56943c0f66d98fc3d028df52d84f7002201e45fa5c6bc3a506cc2553e7d1c0043a9811313fc39c954692c0d47cfce2bbd3
   1670     # local_signature = 3045022100e11b638c05c650c2f63a421d36ef8756c5ce82f2184278643520311cdf50aa200220259565fb9c8e4a87ccaf17f27a3b9ca4f20625754a0920d9c6c239d8156a11de
   1671     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b800222020000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80ec0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e4840400483045022100e11b638c05c650c2f63a421d36ef8756c5ce82f2184278643520311cdf50aa200220259565fb9c8e4a87ccaf17f27a3b9ca4f20625754a0920d9c6c239d8156a11de0147304402200a8544eba1d216f5c5e530597665fa9bec56943c0f66d98fc3d028df52d84f7002201e45fa5c6bc3a506cc2553e7d1c0043a9811313fc39c954692c0d47cfce2bbd301475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1672     num_htlcs: 0
   1673 
   1674     name: commitment tx with one output untrimmed (minimum feerate)
   1675     to_local_msat: 6988000000
   1676     to_remote_msat: 3000000000
   1677     local_feerate_per_kw: 9651181
   1678     # base commitment transaction fee = 6987455
   1679     # actual commitment transaction fee = 7000000
   1680     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1681     remote_signature = 304402202ade0142008309eb376736575ad58d03e5b115499709c6db0b46e36ff394b492022037b63d78d66404d6504d4c4ac13be346f3d1802928a6d3ad95a6a944227161a2
   1682     # local_signature = 304402207e8d51e0c570a5868a78414f4e0cbfaed1106b171b9581542c30718ee4eb95ba02203af84194c97adf98898c9afe2f2ed4a7f8dba05a2dfab28ac9d9c604aa49a379
   1683     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8001c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484040047304402207e8d51e0c570a5868a78414f4e0cbfaed1106b171b9581542c30718ee4eb95ba02203af84194c97adf98898c9afe2f2ed4a7f8dba05a2dfab28ac9d9c604aa49a3790147304402202ade0142008309eb376736575ad58d03e5b115499709c6db0b46e36ff394b492022037b63d78d66404d6504d4c4ac13be346f3d1802928a6d3ad95a6a944227161a201475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1684     num_htlcs: 0
   1685 
   1686     name: commitment tx with fee greater than funder amount
   1687     to_local_msat: 6988000000
   1688     to_remote_msat: 3000000000
   1689     local_feerate_per_kw: 9651936
   1690     # base commitment transaction fee = 6988001
   1691     # actual commitment transaction fee = 7000000
   1692     # to_remote amount 3000000 P2WPKH(032c0b7cf95324a07d05398b240174dc0c2be444d96b159aa6c7f7b1e668680991)
   1693     remote_signature = 304402202ade0142008309eb376736575ad58d03e5b115499709c6db0b46e36ff394b492022037b63d78d66404d6504d4c4ac13be346f3d1802928a6d3ad95a6a944227161a2
   1694     # local_signature = 304402207e8d51e0c570a5868a78414f4e0cbfaed1106b171b9581542c30718ee4eb95ba02203af84194c97adf98898c9afe2f2ed4a7f8dba05a2dfab28ac9d9c604aa49a379
   1695     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8001c0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484040047304402207e8d51e0c570a5868a78414f4e0cbfaed1106b171b9581542c30718ee4eb95ba02203af84194c97adf98898c9afe2f2ed4a7f8dba05a2dfab28ac9d9c604aa49a3790147304402202ade0142008309eb376736575ad58d03e5b115499709c6db0b46e36ff394b492022037b63d78d66404d6504d4c4ac13be346f3d1802928a6d3ad95a6a944227161a201475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1696     num_htlcs: 0
   1697 
   1698     name: commitment tx with 3 htlc outputs, 2 offered having the same amount and preimage
   1699     to_local_msat: 6987999999
   1700     to_remote_msat: 3000000000
   1701     local_feerate_per_kw: 253
   1702     # HTLC #1 received amount 2000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6868
   1703     # HTLC #5 offered amount 5000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9142002cc93ebefbb1b73f0af055dcc27a0b504ad7688ac6868
   1704     # HTLC #6 offered amount 5000 wscript 76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9142002cc93ebefbb1b73f0af055dcc27a0b504ad7688ac6868
   1705     # HTLC #5 and 6 have CLTV 506 and 505, respectively, and preimage 0505050505050505050505050505050505050505050505050505050505050505
   1706     remote_signature = 304402207d0870964530f97b62497b11153c551dca0a1e226815ef0a336651158da0f82402200f5378beee0e77759147b8a0a284decd11bfd2bc55c8fafa41c134fe996d43c8
   1707     # local_signature = 304402200d10bf5bc5397fc59d7188ae438d80c77575595a2d488e41bd6363a810cc8d72022012b57e714fbbfdf7a28c47d5b370cb8ac37c8545f596216e5b21e9b236ef457c
   1708     output commit_tx: 02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b8005d007000000000000220020748eba944fedc8827f6b06bc44678f93c0f9e6078b35c6331ed31e75f8ce0c2d8813000000000000220020305c12e1a0bc21e283c131cea1c66d68857d28b7b2fce0a6fbc40c164852121b8813000000000000220020305c12e1a0bc21e283c131cea1c66d68857d28b7b2fce0a6fbc40c164852121bc0c62d0000000000160014cc1b07838e387deacd0e5232e1e8b49f4c29e484a69f6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e040047304402200d10bf5bc5397fc59d7188ae438d80c77575595a2d488e41bd6363a810cc8d72022012b57e714fbbfdf7a28c47d5b370cb8ac37c8545f596216e5b21e9b236ef457c0147304402207d0870964530f97b62497b11153c551dca0a1e226815ef0a336651158da0f82402200f5378beee0e77759147b8a0a284decd11bfd2bc55c8fafa41c134fe996d43c801475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220
   1709     num_htlcs: 3
   1710     # signature for output #0 (htlc-success for htlc #1)
   1711     remote_htlc_signature = 3045022100b470fe12e5b7fea9eccb8cbff1972cea4f96758041898982a02bcc7f9d56d50b0220338a75b2afaab4ec00cdd2d9273c68c7581ff5a28bcbb40c4d138b81f1d45ce5
   1712     # local_htlc_signature = 3044022017b90c65207522a907fb6a137f9dd528b3389465a8ae72308d9e1d564f512cf402204fc917b4f0e88604a3e994f85bfae7c7c1f9d9e9f78e8cd112e0889720d9405b
   1713     htlc_success_tx (htlc #1): 020000000001014bdccf28653066a2c554cafeffdfe1e678e64a69b056684deb0c4fba909423ec000000000000000000011f070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100b470fe12e5b7fea9eccb8cbff1972cea4f96758041898982a02bcc7f9d56d50b0220338a75b2afaab4ec00cdd2d9273c68c7581ff5a28bcbb40c4d138b81f1d45ce501473044022017b90c65207522a907fb6a137f9dd528b3389465a8ae72308d9e1d564f512cf402204fc917b4f0e88604a3e994f85bfae7c7c1f9d9e9f78e8cd112e0889720d9405b012001010101010101010101010101010101010101010101010101010101010101018a76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac686800000000
   1714     # signature for output #1 (htlc-timeout for htlc #6)
   1715     remote_htlc_signature = 3045022100b575379f6d8743cb0087648f81cfd82d17a97fbf8f67e058c65ce8b9d25df9500220554a210d65b02d9f36c6adf0f639430ca8293196ba5089bf67cc3a9813b7b00a
   1716     # local_htlc_signature = 3045022100ee2e16b90930a479b13f8823a7f14b600198c838161160b9436ed086d3fc57e002202a66fa2324f342a17129949c640bfe934cbc73a869ba7c06aa25c5a3d0bfb53d
   1717     htlc_timeout_tx (htlc #6): 020000000001014bdccf28653066a2c554cafeffdfe1e678e64a69b056684deb0c4fba909423ec01000000000000000001e1120000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100b575379f6d8743cb0087648f81cfd82d17a97fbf8f67e058c65ce8b9d25df9500220554a210d65b02d9f36c6adf0f639430ca8293196ba5089bf67cc3a9813b7b00a01483045022100ee2e16b90930a479b13f8823a7f14b600198c838161160b9436ed086d3fc57e002202a66fa2324f342a17129949c640bfe934cbc73a869ba7c06aa25c5a3d0bfb53d01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9142002cc93ebefbb1b73f0af055dcc27a0b504ad7688ac6868f9010000
   1718     # signature for output #2 (htlc-timeout for htlc #5)
   1719     remote_htlc_signature = 30440220471c9f3ad92e49b13b7b8059f43ecf8f7887b0dccbb9fdb54bfe23d62a8ae332022024bd22fae0740e86a44228c35330da9526fd7306dffb2b9dc362d5e78abef7cc
   1720     # local_htlc_signature = 304402207157f452f2506d73c315192311893800cfb3cc235cc1185b1cfcc136b55230db022014be242dbc6c5da141fec4034e7f387f74d6ff1899453d72ba957467540e1ecb
   1721     htlc_timeout_tx (htlc #5): 020000000001014bdccf28653066a2c554cafeffdfe1e678e64a69b056684deb0c4fba909423ec02000000000000000001e1120000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220471c9f3ad92e49b13b7b8059f43ecf8f7887b0dccbb9fdb54bfe23d62a8ae332022024bd22fae0740e86a44228c35330da9526fd7306dffb2b9dc362d5e78abef7cc0147304402207157f452f2506d73c315192311893800cfb3cc235cc1185b1cfcc136b55230db022014be242dbc6c5da141fec4034e7f387f74d6ff1899453d72ba957467540e1ecb01008576a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9142002cc93ebefbb1b73f0af055dcc27a0b504ad7688ac6868fa010000
   1722 
   1723 # Appendix D: Per-commitment Secret Generation Test Vectors
   1724 
   1725 These test the generation algorithm that all nodes use.
   1726 
   1727 ## Generation Tests
   1728 
   1729     name: generate_from_seed 0 final node
   1730 	seed: 0x0000000000000000000000000000000000000000000000000000000000000000
   1731 	I: 281474976710655
   1732 	output: 0x02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
   1733 
   1734 	name: generate_from_seed FF final node
   1735 	seed: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
   1736 	I: 281474976710655
   1737 	output: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1738 
   1739 	name: generate_from_seed FF alternate bits 1
   1740 	seed: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
   1741 	I: 0xaaaaaaaaaaa
   1742 	output: 0x56f4008fb007ca9acf0e15b054d5c9fd12ee06cea347914ddbaed70d1c13a528
   1743 
   1744 	name: generate_from_seed FF alternate bits 2
   1745 	seed: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
   1746 	I: 0x555555555555
   1747 	output: 0x9015daaeb06dba4ccc05b91b2f73bd54405f2be9f217fbacd3c5ac2e62327d31
   1748 
   1749 	name: generate_from_seed 01 last nontrivial node
   1750 	seed: 0x0101010101010101010101010101010101010101010101010101010101010101
   1751 	I: 1
   1752 	output: 0x915c75942a26bb3a433a8ce2cb0427c29ec6c1775cfc78328b57f6ba7bfeaa9c
   1753 
   1754 ## Storage Tests
   1755 
   1756 These test the optional compact storage system. In many cases, an
   1757 incorrect entry cannot be determined until its parent is revealed: an entry is
   1758 specifically corrupted, along with all its children.
   1759 
   1760 For
   1761 these tests a seed of `0xFFF...FF` is used, and incorrect entries are
   1762 seeded with `0x000...00`.
   1763 
   1764     name: insert_secret correct sequence
   1765 	I: 281474976710655
   1766 	secret: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1767 	output: OK
   1768 	I: 281474976710654
   1769 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1770 	output: OK
   1771 	I: 281474976710653
   1772 	secret: 0x2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8
   1773 	output: OK
   1774 	I: 281474976710652
   1775 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1776 	output: OK
   1777 	I: 281474976710651
   1778 	secret: 0xc65716add7aa98ba7acb236352d665cab17345fe45b55fb879ff80e6bd0c41dd
   1779 	output: OK
   1780 	I: 281474976710650
   1781 	secret: 0x969660042a28f32d9be17344e09374b379962d03db1574df5a8a5a47e19ce3f2
   1782 	output: OK
   1783 	I: 281474976710649
   1784 	secret: 0xa5a64476122ca0925fb344bdc1854c1c0a59fc614298e50a33e331980a220f32
   1785 	output: OK
   1786 	I: 281474976710648
   1787 	secret: 0x05cde6323d949933f7f7b78776bcc1ea6d9b31447732e3802e1f7ac44b650e17
   1788 	output: OK
   1789 
   1790     name: insert_secret #1 incorrect
   1791 	I: 281474976710655
   1792 	secret: 0x02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
   1793 	output: OK
   1794 	I: 281474976710654
   1795 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1796 	output: ERROR
   1797 
   1798     name: insert_secret #2 incorrect (#1 derived from incorrect)
   1799 	I: 281474976710655
   1800 	secret: 0x02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
   1801 	output: OK
   1802 	I: 281474976710654
   1803 	secret: 0xdddc3a8d14fddf2b68fa8c7fbad2748274937479dd0f8930d5ebb4ab6bd866a3
   1804 	output: OK
   1805 	I: 281474976710653
   1806 	secret: 0x2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8
   1807 	output: OK
   1808 	I: 281474976710652
   1809 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1810 	output: ERROR
   1811 
   1812     name: insert_secret #3 incorrect
   1813 	I: 281474976710655
   1814 	secret: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1815 	output: OK
   1816 	I: 281474976710654
   1817 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1818 	output: OK
   1819 	I: 281474976710653
   1820 	secret: 0xc51a18b13e8527e579ec56365482c62f180b7d5760b46e9477dae59e87ed423a
   1821 	output: OK
   1822 	I: 281474976710652
   1823 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1824 	output: ERROR
   1825 
   1826     name: insert_secret #4 incorrect (1,2,3 derived from incorrect)
   1827 	I: 281474976710655
   1828 	secret: 0x02a40c85b6f28da08dfdbe0926c53fab2de6d28c10301f8f7c4073d5e42e3148
   1829 	output: OK
   1830 	I: 281474976710654
   1831 	secret: 0xdddc3a8d14fddf2b68fa8c7fbad2748274937479dd0f8930d5ebb4ab6bd866a3
   1832 	output: OK
   1833 	I: 281474976710653
   1834 	secret: 0xc51a18b13e8527e579ec56365482c62f180b7d5760b46e9477dae59e87ed423a
   1835 	output: OK
   1836 	I: 281474976710652
   1837 	secret: 0xba65d7b0ef55a3ba300d4e87af29868f394f8f138d78a7011669c79b37b936f4
   1838 	output: OK
   1839 	I: 281474976710651
   1840 	secret: 0xc65716add7aa98ba7acb236352d665cab17345fe45b55fb879ff80e6bd0c41dd
   1841 	output: OK
   1842 	I: 281474976710650
   1843 	secret: 0x969660042a28f32d9be17344e09374b379962d03db1574df5a8a5a47e19ce3f2
   1844 	output: OK
   1845 	I: 281474976710649
   1846 	secret: 0xa5a64476122ca0925fb344bdc1854c1c0a59fc614298e50a33e331980a220f32
   1847 	output: OK
   1848 	I: 281474976710648
   1849 	secret: 0x05cde6323d949933f7f7b78776bcc1ea6d9b31447732e3802e1f7ac44b650e17
   1850 	output: ERROR
   1851 
   1852     name: insert_secret #5 incorrect
   1853 	I: 281474976710655
   1854 	secret: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1855 	output: OK
   1856 	I: 281474976710654
   1857 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1858 	output: OK
   1859 	I: 281474976710653
   1860 	secret: 0x2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8
   1861 	output: OK
   1862 	I: 281474976710652
   1863 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1864 	output: OK
   1865 	I: 281474976710651
   1866 	secret: 0x631373ad5f9ef654bb3dade742d09504c567edd24320d2fcd68e3cc47e2ff6a6
   1867 	output: OK
   1868 	I: 281474976710650
   1869 	secret: 0x969660042a28f32d9be17344e09374b379962d03db1574df5a8a5a47e19ce3f2
   1870 	output: ERROR
   1871 
   1872     name: insert_secret #6 incorrect (5 derived from incorrect)
   1873 	I: 281474976710655
   1874 	secret: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1875 	output: OK
   1876 	I: 281474976710654
   1877 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1878 	output: OK
   1879 	I: 281474976710653
   1880 	secret: 0x2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8
   1881 	output: OK
   1882 	I: 281474976710652
   1883 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1884 	output: OK
   1885 	I: 281474976710651
   1886 	secret: 0x631373ad5f9ef654bb3dade742d09504c567edd24320d2fcd68e3cc47e2ff6a6
   1887 	output: OK
   1888 	I: 281474976710650
   1889 	secret: 0xb7e76a83668bde38b373970155c868a653304308f9896692f904a23731224bb1
   1890 	output: OK
   1891 	I: 281474976710649
   1892 	secret: 0xa5a64476122ca0925fb344bdc1854c1c0a59fc614298e50a33e331980a220f32
   1893 	output: OK
   1894 	I: 281474976710648
   1895 	secret: 0x05cde6323d949933f7f7b78776bcc1ea6d9b31447732e3802e1f7ac44b650e17
   1896 	output: ERROR
   1897 
   1898     name: insert_secret #7 incorrect
   1899 	I: 281474976710655
   1900 	secret: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1901 	output: OK
   1902 	I: 281474976710654
   1903 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1904 	output: OK
   1905 	I: 281474976710653
   1906 	secret: 0x2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8
   1907 	output: OK
   1908 	I: 281474976710652
   1909 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1910 	output: OK
   1911 	I: 281474976710651
   1912 	secret: 0xc65716add7aa98ba7acb236352d665cab17345fe45b55fb879ff80e6bd0c41dd
   1913 	output: OK
   1914 	I: 281474976710650
   1915 	secret: 0x969660042a28f32d9be17344e09374b379962d03db1574df5a8a5a47e19ce3f2
   1916 	output: OK
   1917 	I: 281474976710649
   1918 	secret: 0xe7971de736e01da8ed58b94c2fc216cb1dca9e326f3a96e7194fe8ea8af6c0a3
   1919 	output: OK
   1920 	I: 281474976710648
   1921 	secret: 0x05cde6323d949933f7f7b78776bcc1ea6d9b31447732e3802e1f7ac44b650e17
   1922 	output: ERROR
   1923 
   1924     name: insert_secret #8 incorrect
   1925 	I: 281474976710655
   1926 	secret: 0x7cc854b54e3e0dcdb010d7a3fee464a9687be6e8db3be6854c475621e007a5dc
   1927 	output: OK
   1928 	I: 281474976710654
   1929 	secret: 0xc7518c8ae4660ed02894df8976fa1a3659c1a8b4b5bec0c4b872abeba4cb8964
   1930 	output: OK
   1931 	I: 281474976710653
   1932 	secret: 0x2273e227a5b7449b6e70f1fb4652864038b1cbf9cd7c043a7d6456b7fc275ad8
   1933 	output: OK
   1934 	I: 281474976710652
   1935 	secret: 0x27cddaa5624534cb6cb9d7da077cf2b22ab21e9b506fd4998a51d54502e99116
   1936 	output: OK
   1937 	I: 281474976710651
   1938 	secret: 0xc65716add7aa98ba7acb236352d665cab17345fe45b55fb879ff80e6bd0c41dd
   1939 	output: OK
   1940 	I: 281474976710650
   1941 	secret: 0x969660042a28f32d9be17344e09374b379962d03db1574df5a8a5a47e19ce3f2
   1942 	output: OK
   1943 	I: 281474976710649
   1944 	secret: 0xa5a64476122ca0925fb344bdc1854c1c0a59fc614298e50a33e331980a220f32
   1945 	output: OK
   1946 	I: 281474976710648
   1947 	secret: 0xa7efbc61aac46d34f77778bac22c8a20c6a46ca460addc49009bda875ec88fa4
   1948 	output: ERROR
   1949 
   1950 # Appendix E: Key Derivation Test Vectors
   1951 
   1952 These test the derivation for `localpubkey`, `remotepubkey`, `local_htlcpubkey`, `remote_htlcpubkey`, `local_delayedpubkey`, and
   1953 `remote_delayedpubkey` (which use the same formula), as well as the `revocationpubkey`.
   1954 
   1955 All of them use the following secrets (and thus the derived points):
   1956 
   1957     base_secret: 0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f
   1958     per_commitment_secret: 0x1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100
   1959     base_point: 0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2
   1960     per_commitment_point: 0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486
   1961 
   1962     name: derivation of pubkey from basepoint and per_commitment_point
   1963     # SHA256(per_commitment_point || basepoint)
   1964     # => SHA256(0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486 || 0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2)
   1965     # = 0xcbcdd70fcfad15ea8e9e5c5a12365cf00912504f08ce01593689dd426bca9ff0
   1966     # + basepoint (0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2)
   1967     # = 0x0235f2dbfaa89b57ec7b055afe29849ef7ddfeb1cefdb9ebdc43f5494984db29e5
   1968     localpubkey: 0x0235f2dbfaa89b57ec7b055afe29849ef7ddfeb1cefdb9ebdc43f5494984db29e5
   1969 
   1970     name: derivation of private key from basepoint secret and per_commitment_secret
   1971     # SHA256(per_commitment_point || basepoint)
   1972     # => SHA256(0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486 || 0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2)
   1973     # = 0xcbcdd70fcfad15ea8e9e5c5a12365cf00912504f08ce01593689dd426bca9ff0
   1974     # + basepoint_secret (0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f)
   1975     # = 0xcbced912d3b21bf196a766651e436aff192362621ce317704ea2f75d87e7be0f
   1976     localprivkey: 0xcbced912d3b21bf196a766651e436aff192362621ce317704ea2f75d87e7be0f
   1977 
   1978     name: derivation of revocation pubkey from basepoint and per_commitment_point
   1979     # SHA256(revocation_basepoint || per_commitment_point)
   1980     # => SHA256(0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2 || 0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486)
   1981     # = 0xefbf7ba5a074276701798376950a64a90f698997cce0dff4d24a6d2785d20963
   1982     # x revocation_basepoint = 0x02c00c4aadc536290422a807250824a8d87f19d18da9d610d45621df22510db8ce
   1983     # SHA256(per_commitment_point || revocation_basepoint)
   1984     # => SHA256(0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486 || 0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2)
   1985     # = 0xcbcdd70fcfad15ea8e9e5c5a12365cf00912504f08ce01593689dd426bca9ff0
   1986     # x per_commitment_point = 0x0325ee7d3323ce52c4b33d4e0a73ab637711057dd8866e3b51202a04112f054c43
   1987     # 0x02c00c4aadc536290422a807250824a8d87f19d18da9d610d45621df22510db8ce + 0x0325ee7d3323ce52c4b33d4e0a73ab637711057dd8866e3b51202a04112f054c43 => 0x02916e326636d19c33f13e8c0c3a03dd157f332f3e99c317c141dd865eb01f8ff0
   1988     revocationpubkey: 0x02916e326636d19c33f13e8c0c3a03dd157f332f3e99c317c141dd865eb01f8ff0
   1989 
   1990     name: derivation of revocation secret from basepoint_secret and per_commitment_secret
   1991     # SHA256(revocation_basepoint || per_commitment_point)
   1992     # => SHA256(0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2 || 0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486)
   1993     # = 0xefbf7ba5a074276701798376950a64a90f698997cce0dff4d24a6d2785d20963
   1994     # * revocation_basepoint_secret (0x000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f)# = 0x44bfd55f845f885b8e60b2dca4b30272d5343be048d79ce87879d9863dedc842
   1995     # SHA256(per_commitment_point || revocation_basepoint)
   1996     # => SHA256(0x025f7117a78150fe2ef97db7cfc83bd57b2e2c0d0dd25eaf467a4a1c2a45ce1486 || 0x036d6caac248af96f6afa7f904f550253a0f3ef3f5aa2fe6838a95b216691468e2)
   1997     # = 0xcbcdd70fcfad15ea8e9e5c5a12365cf00912504f08ce01593689dd426bca9ff0
   1998     # * per_commitment_secret (0x1f1e1d1c1b1a191817161514131211100f0e0d0c0b0a09080706050403020100)# = 0x8be02a96a97b9a3c1c9f59ebb718401128b72ec009d85ee1656319b52319b8ce
   1999     # => 0xd09ffff62ddb2297ab000cc85bcb4283fdeb6aa052affbc9dddcf33b61078110
   2000     revocationprivkey: 0xd09ffff62ddb2297ab000cc85bcb4283fdeb6aa052affbc9dddcf33b61078110
   2001 
   2002 # Appendix F: Commitment and HTLC Transaction Test Vectors (anchors)
   2003 
   2004 The anchor test vectors are based on the test cases as defined in appendix C.
   2005 Note that in appendix C, `to_local_msat` and `to_remote_msat` are balances
   2006 before subtraction of:
   2007 * Commit fee (funder only)
   2008 * Anchor outputs (funder only)
   2009 * In-flight htlcs
   2010 
   2011 ```yaml
   2012 [
   2013     {
   2014         "Name": "simple commitment tx with no HTLCs",
   2015         "LocalBalance": 7000000000,
   2016         "RemoteBalance": 3000000000,
   2017         "DustLimitSatoshis": 546,
   2018         "FeePerKw": 15000,
   2019         "UseTestHtlcs": false,
   2020         "HtlcDescs": [],
   2021         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80044a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994c0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994a508b6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e04004830450221008266ac6db5ea71aac3c95d97b0e172ff596844851a3216eb88382a8dddfd33d2022050e240974cfd5d708708b4365574517c18e7ae535ef732a3484d43d0d82be9f701483045022100f89034eba16b2be0e5581f750a0a6309192b75cce0f202f0ee2b4ec0cc394850022076c65dc507fe42276152b7a3d90e961e678adbe966e916ecfe85e64d430e75f301475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2022         "RemoteSigHex": "3045022100f89034eba16b2be0e5581f750a0a6309192b75cce0f202f0ee2b4ec0cc394850022076c65dc507fe42276152b7a3d90e961e678adbe966e916ecfe85e64d430e75f3"
   2023     },
   2024     {
   2025         "Name": "simple commitment tx with no HTLCs and single anchor",
   2026         "LocalBalance": 10000000000,
   2027         "RemoteBalance": 0,
   2028         "DustLimitSatoshis": 546,
   2029         "FeePerKw": 15000,
   2030         "UseTestHtlcs": false,
   2031         "HtlcDescs": [],
   2032         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80024a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f10529800000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400473044022007cf6b405e9c9b4f527b0ecad9d8bb661fabb8b12abf7d1c0b3ad1855db3ed490220616d5c1eeadccc63bd775a131149455d62d95a42c2a1b01cc7821fc42dce7778014730440220655bf909fb6fa81d086f1336ac72c97906dce29d1b166e305c99152d810e26e1022051f577faa46412c46707aaac46b65d50053550a66334e00a44af2706f27a865801475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2033         "RemoteSigHex": "30440220655bf909fb6fa81d086f1336ac72c97906dce29d1b166e305c99152d810e26e1022051f577faa46412c46707aaac46b65d50053550a66334e00a44af2706f27a8658"
   2034     },
   2035     {
   2036         "Name": "commitment tx with seven outputs untrimmed",
   2037         "LocalBalance": 6988000000,
   2038         "RemoteBalance": 3000000000,
   2039         "DustLimitSatoshis": 546,
   2040         "FeePerKw": 644,
   2041         "UseTestHtlcs": true,
   2042         "HtlcDescs": [
   2043             {
   2044                 "RemoteSigHex": "30440220746dc89a593e1b50915db63359b50c3c404f8324f78075c87708c866ccefda2502202a11062012dc8607b17e8c46ea4eefdfcc6b89a35440de99432ba12788d7bb17",
   2045                 "ResolutionTxHex": "02000000000101b8cefef62ea66f5178b9361b2371be0759cbc8c689bcfa7a8e6746d497ec221a02000000000100000001e8030000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220746dc89a593e1b50915db63359b50c3c404f8324f78075c87708c866ccefda2502202a11062012dc8607b17e8c46ea4eefdfcc6b89a35440de99432ba12788d7bb1783473044022036f77f88b49bd03dc16d3a015efcc7acffc2a93b213324035d77a716f79013ff02203c218eb882a40402a8bb05dbb751a442345a4e56307be76b214b6d4db9ed3c92012000000000000000000000000000000000000000000000000000000000000000008d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a914b8bcb07f6344b42ab04250c86a6e8b75d3fdbbc688527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f401b175ac6851b2756800000000"
   2046             },
   2047             {
   2048                 "RemoteSigHex": "3045022100a847bc3b8cf2441013725ae32dc589c419835d069afd6d7f3d9834d8be7cea6e02204ce9d35ec7f0788da80e4d62e810c4ccd13617e58fa10832e38fb7ae87bdf338",
   2049                 "ResolutionTxHex": "02000000000101b8cefef62ea66f5178b9361b2371be0759cbc8c689bcfa7a8e6746d497ec221a03000000000100000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100a847bc3b8cf2441013725ae32dc589c419835d069afd6d7f3d9834d8be7cea6e02204ce9d35ec7f0788da80e4d62e810c4ccd13617e58fa10832e38fb7ae87bdf33883473044022026739b1adbfa34c485bf0e5a19e0cf7532f64545bcc5c95b95643ccc2d351e1902201743bb1b34f00e031cc15f6eff0f8ab764508d2681ff965ba62e76e540bca1e801008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6851b27568f6010000"
   2050             },
   2051             {
   2052                 "RemoteSigHex": "3044022035977f2aa6d6ae12f1dae3366440faa17558e9c88c3188bfc8df7e276c6c65410220659f1f9070c725d9d46e43b99a36fc6d711d36069704add2d57fc1fa2818cf12",
   2053                 "ResolutionTxHex": "02000000000101b8cefef62ea66f5178b9361b2371be0759cbc8c689bcfa7a8e6746d497ec221a04000000000100000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022035977f2aa6d6ae12f1dae3366440faa17558e9c88c3188bfc8df7e276c6c65410220659f1f9070c725d9d46e43b99a36fc6d711d36069704add2d57fc1fa2818cf12834730440220191ba44e57b1601a59d99f85971d4801b286d428de275487c87ceeb8df1a4811022002215875d92833df0c9615c9096cf97152f87139ed9f82718bbb5b8b3d312524012001010101010101010101010101010101010101010101010101010101010101018d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6851b2756800000000"
   2054             },
   2055             {
   2056                 "RemoteSigHex": "3044022002f3ff9a31270092c214d3d5b8b4f826599404bba64b87f7536ef6324d41551b022079dc4cb25f7ecd84b49f5cce03eae7e2655b59f39d543765daef0d4f11c93fa2",
   2057                 "ResolutionTxHex": "02000000000101b8cefef62ea66f5178b9361b2371be0759cbc8c689bcfa7a8e6746d497ec221a05000000000100000001b80b0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022002f3ff9a31270092c214d3d5b8b4f826599404bba64b87f7536ef6324d41551b022079dc4cb25f7ecd84b49f5cce03eae7e2655b59f39d543765daef0d4f11c93fa283483045022100f03047e38bc0aae2d80d53424b8c1d1b8139120e2bf09ad31a2803978745e6e102205b74c0eef0b472710b98c77e619ee9d0cc47a9dd786f4f214a564f44d79f9b9a01008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6851b27568f7010000"
   2058             },
   2059             {
   2060                 "RemoteSigHex": "30440220547937564288f64fb3e3c945a1348b912471f0c1c4cc7dc8ceca15a4cbd299b6022053c4f8e30832b13dfbe31e4091e313428625e0b5ac61eecba93f8f11c1e26225",
   2061                 "ResolutionTxHex": "02000000000101b8cefef62ea66f5178b9361b2371be0759cbc8c689bcfa7a8e6746d497ec221a06000000000100000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220547937564288f64fb3e3c945a1348b912471f0c1c4cc7dc8ceca15a4cbd299b6022053c4f8e30832b13dfbe31e4091e313428625e0b5ac61eecba93f8f11c1e2622583473044022022604660234aef9bd21284598ec50f070ac82a3a0152e0af5e98a02cd6e8976f022042b0b9112ee00806b856dff6de52a82c98b036a4fe14bb5fd2926725e2fc8191012004040404040404040404040404040404040404040404040404040404040404048d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6851b2756800000000"
   2062             }
   2063         ],
   2064         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80094a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994e80300000000000022002010f88bf09e56f14fb4543fd26e47b0db50ea5de9cf3fc46434792471082621aed0070000000000002200203e68115ae0b15b8de75b6c6bc9af5ac9f01391544e0870dae443a1e8fe7837ead007000000000000220020fe0598d74fee2205cc3672e6e6647706b4f3099713b4661b62482c3addd04a5eb80b000000000000220020f96d0334feb64a4f40eb272031d07afcb038db56aa57446d60308c9f8ccadef9a00f000000000000220020ce6e751274836ff59622a0d1e07f8831d80bd6730bd48581398bfadd2bb8da9ac0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994a4f996a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100ef82a405364bfc4007e63a7cc82925a513d79065bdbc216d60b6a4223a323f8a02200716730b8561f3c6d362eaf47f202e99fb30d0557b61b92b5f9134f8e2de368101483045022100e0106830467a558c07544a3de7715610c1147062e7d091deeebe8b5c661cda9402202ad049c1a6d04834317a78483f723c205c9f638d17222aafc620800cc1b6ae3501475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2065         "RemoteSigHex": "3045022100e0106830467a558c07544a3de7715610c1147062e7d091deeebe8b5c661cda9402202ad049c1a6d04834317a78483f723c205c9f638d17222aafc620800cc1b6ae35"
   2066     },
   2067     {
   2068         "Name": "commitment tx with six outputs untrimmed (minimum dust limit)",
   2069         "LocalBalance": 6988000000,
   2070         "RemoteBalance": 3000000000,
   2071         "DustLimitSatoshis": 1001,
   2072         "FeePerKw": 645,
   2073         "UseTestHtlcs": true,
   2074         "HtlcDescs": [
   2075             {
   2076                 "RemoteSigHex": "3045022100e04d160a326432659fe9fb127304c1d348dfeaba840081bdc57d8efd902a48d8022008a824e7cf5492b97e4d9e03c06a09f822775a44f6b5b2533a2088904abfc282",
   2077                 "ResolutionTxHex": "02000000000101104f394af4c4fad78337f95e3e9f802f4c0d86ab231853af09b285348561320002000000000100000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100e04d160a326432659fe9fb127304c1d348dfeaba840081bdc57d8efd902a48d8022008a824e7cf5492b97e4d9e03c06a09f822775a44f6b5b2533a2088904abfc28283483045022100b7c49846466b13b190ff739bbe3005c105482fc55539e55b1c561f76b6982b6c02200e5c35808619cf543c8405cff9fedd25f333a4a2f6f6d5e8af8150090c40ef0901008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a914b43e1b38138a41b37f7cd9a1d274bc63e3a9b5d188ac6851b27568f6010000"
   2078             },
   2079             {
   2080                 "RemoteSigHex": "3045022100fbdc3c367ce3bf30796025cc590ee1f2ce0e72ae1ac19f5986d6d0a4fc76211f02207e45ae9267e8e820d188569604f71d1abd11bd385d58853dd7dc034cdb3e9a6e",
   2081                 "ResolutionTxHex": "02000000000101104f394af4c4fad78337f95e3e9f802f4c0d86ab231853af09b285348561320003000000000100000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100fbdc3c367ce3bf30796025cc590ee1f2ce0e72ae1ac19f5986d6d0a4fc76211f02207e45ae9267e8e820d188569604f71d1abd11bd385d58853dd7dc034cdb3e9a6e83483045022100d29330f24db213b262068706099b39c15fa7e070c3fcdf8836c09723fc4d365602203ce57d01e9f28601e461a0b5c4a50119b270bde8b70148d133a6849c70b115ac012001010101010101010101010101010101010101010101010101010101010101018d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6851b2756800000000"
   2082             },
   2083             {
   2084                 "RemoteSigHex": "3044022066c5ef625cee3ddd2bc7b6bfb354b5834cf1cc6d52dd972fb41b7b225437ae4a022066cb85647df65c6b87a54e416dcdcca778a776c36a9643d2b5dc793c9b29f4c1",
   2085                 "ResolutionTxHex": "02000000000101104f394af4c4fad78337f95e3e9f802f4c0d86ab231853af09b285348561320004000000000100000001b80b0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022066c5ef625cee3ddd2bc7b6bfb354b5834cf1cc6d52dd972fb41b7b225437ae4a022066cb85647df65c6b87a54e416dcdcca778a776c36a9643d2b5dc793c9b29f4c18347304402202d4ce515cd9000ec37575972d70b8d24f73909fb7012e8ebd8c2066ef6fe187902202830b53e64ea565fecd0f398100691da6bb2a5cf9bb0d1926f1d71d05828a11e01008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6851b27568f7010000"
   2086             },
   2087             {
   2088                 "RemoteSigHex": "3044022022c7e11595c53ee89a57ca76baf0aed730da035952d6ab3fe6459f5eff3b337a022075e10cc5f5fd724a35ce4087a5d03cd616698626c69814032132b50bb97dc615",
   2089                 "ResolutionTxHex": "02000000000101104f394af4c4fad78337f95e3e9f802f4c0d86ab231853af09b285348561320005000000000100000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022022c7e11595c53ee89a57ca76baf0aed730da035952d6ab3fe6459f5eff3b337a022075e10cc5f5fd724a35ce4087a5d03cd616698626c69814032132b50bb97dc61583483045022100b20cd63e0587d1711beaebda4730775c4ac8b8b2ec78fe18a0c44c3f168c25230220079abb7fc4924e2fca5950842e5b9e416735585026914570078c4ef62f286226012004040404040404040404040404040404040404040404040404040404040404048d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6851b2756800000000"
   2090             }
   2091         ],
   2092         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80084a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994d0070000000000002200203e68115ae0b15b8de75b6c6bc9af5ac9f01391544e0870dae443a1e8fe7837ead007000000000000220020fe0598d74fee2205cc3672e6e6647706b4f3099713b4661b62482c3addd04a5eb80b000000000000220020f96d0334feb64a4f40eb272031d07afcb038db56aa57446d60308c9f8ccadef9a00f000000000000220020ce6e751274836ff59622a0d1e07f8831d80bd6730bd48581398bfadd2bb8da9ac0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994abc996a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100d57697c707b6f6d053febf24b98e8989f186eea42e37e9e91663ec2c70bb8f70022079b0715a472118f262f43016a674f59c015d9cafccec885968e76d9d9c5d005101473044022025d97466c8049e955a5afce28e322f4b34d2561118e52332fb400f9b908cc0a402205dc6fba3a0d67ee142c428c535580cd1f2ff42e2f89b47e0c8a01847caffc31201475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2093         "RemoteSigHex": "3044022025d97466c8049e955a5afce28e322f4b34d2561118e52332fb400f9b908cc0a402205dc6fba3a0d67ee142c428c535580cd1f2ff42e2f89b47e0c8a01847caffc312"
   2094     },
   2095     {
   2096         "Name": "commitment tx with four outputs untrimmed (minimum dust limit)",
   2097         "LocalBalance": 6988000000,
   2098         "RemoteBalance": 3000000000,
   2099         "DustLimitSatoshis": 2001,
   2100         "FeePerKw": 2185,
   2101         "UseTestHtlcs": true,
   2102         "HtlcDescs": [
   2103             {
   2104                 "RemoteSigHex": "304402206870514a72ad6e723ff7f1e0370d7a33c1cd2a0b9272674143ebaf6a1d02dee102205bd953c34faf5e7322e9a1c0103581cb090280fda4f1039ee8552668afa90ebb",
   2105                 "ResolutionTxHex": "02000000000101ac13a7715f80b8e52dda43c6929cade5521bdced3a405da02b443f1ffb1e33cc02000000000100000001b80b0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402206870514a72ad6e723ff7f1e0370d7a33c1cd2a0b9272674143ebaf6a1d02dee102205bd953c34faf5e7322e9a1c0103581cb090280fda4f1039ee8552668afa90ebb834730440220669de9ca7910eff65a7773ebd14a9fc371fe88cde5b8e2a81609d85c87ac939b02201ac29472fa4067322e92d75b624942d60be5050139b20bb363db75be79eb946f01008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9148a486ff2e31d6158bf39e2608864d63fefd09d5b88ac6851b27568f7010000"
   2106             },
   2107             {
   2108                 "RemoteSigHex": "3045022100949e8dd938da56445b1cdfdebe1b7efea086edd05d89910d205a1e2e033ce47102202cbd68b5262ab144d9ec12653f87dfb0bb6bd05d1f58ae1e523f028eaefd7271",
   2109                 "ResolutionTxHex": "02000000000101ac13a7715f80b8e52dda43c6929cade5521bdced3a405da02b443f1ffb1e33cc03000000000100000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100949e8dd938da56445b1cdfdebe1b7efea086edd05d89910d205a1e2e033ce47102202cbd68b5262ab144d9ec12653f87dfb0bb6bd05d1f58ae1e523f028eaefd727183483045022100e3104ed8b239f8019e5f0a1a73d7782a94a8c36e7984f476c3a0b3cb0e62e27902207e3d52884600985f8a2098e53a5c30dd6a5e857733acfaa07ab2162421ed2688012004040404040404040404040404040404040404040404040404040404040404048d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6851b2756800000000"
   2110             }
   2111         ],
   2112         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80064a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994b80b000000000000220020f96d0334feb64a4f40eb272031d07afcb038db56aa57446d60308c9f8ccadef9a00f000000000000220020ce6e751274836ff59622a0d1e07f8831d80bd6730bd48581398bfadd2bb8da9ac0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994ac5916a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100cd8479cfe1edb1e5a1d487391e0451a469c7171e51e680183f19eb4321f20e9b02204eab7d5a6384b1b08e03baa6e4d9748dfd2b5ab2bae7e39604a0d0055bbffdd501473044022040f63a16148cf35c8d3d41827f5ae7f7c3746885bb64d4d1b895892a83812b3e02202fcf95c2bf02c466163b3fa3ced6a24926fbb4035095a96842ef516e86ba54c001475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2113         "RemoteSigHex": "3044022040f63a16148cf35c8d3d41827f5ae7f7c3746885bb64d4d1b895892a83812b3e02202fcf95c2bf02c466163b3fa3ced6a24926fbb4035095a96842ef516e86ba54c0"
   2114     },
   2115     {
   2116         "Name": "commitment tx with three outputs untrimmed (minimum dust limit)",
   2117         "LocalBalance": 6988000000,
   2118         "RemoteBalance": 3000000000,
   2119         "DustLimitSatoshis": 3001,
   2120         "FeePerKw": 3687,
   2121         "UseTestHtlcs": true,
   2122         "HtlcDescs": [
   2123             {
   2124                 "RemoteSigHex": "3044022017b558a3cf5f0cb94269e2e927b29ed22bd2416abb8a7ce6de4d1256f359b93602202e9ca2b1a23ea3e69f433c704e327739e219804b8c188b1d52f74fd5a9de954c",
   2125                 "ResolutionTxHex": "02000000000101542562b326c08e3a076d9cfca2be175041366591da334d8d513ff1686fd95a6002000000000100000001a00f0000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500473044022017b558a3cf5f0cb94269e2e927b29ed22bd2416abb8a7ce6de4d1256f359b93602202e9ca2b1a23ea3e69f433c704e327739e219804b8c188b1d52f74fd5a9de954c83483045022100af7a8b7c7ff2080c68995254cb66d64d9954edcc5baac3bb4f27ed2d29aaa6120220421c27da7a60574a9263f271e0f3bd34594ec6011095190022b3b54596ea03de012004040404040404040404040404040404040404040404040404040404040404048d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a91418bc1a114ccf9c052d3d23e28d3b0a9d1227434288527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f801b175ac6851b2756800000000"
   2126             }
   2127         ],
   2128         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80054a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994a00f000000000000220020ce6e751274836ff59622a0d1e07f8831d80bd6730bd48581398bfadd2bb8da9ac0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994aa28b6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100c970799bcb33f43179eb43b3378a0a61991cf2923f69b36ef12548c3df0e6d500220413dc27d2e39ee583093adfcb7799be680141738babb31cc7b0669a777a31f5d01483045022100ad6c71569856b2d7ff42e838b4abe74a713426b37f22fa667a195a4c88908c6902202b37272b02a42dc6d9f4f82cab3eaf84ac882d9ed762859e1e75455c2c22837701475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2129         "RemoteSigHex": "3045022100ad6c71569856b2d7ff42e838b4abe74a713426b37f22fa667a195a4c88908c6902202b37272b02a42dc6d9f4f82cab3eaf84ac882d9ed762859e1e75455c2c228377"
   2130     },
   2131     {
   2132         "Name": "commitment tx with two outputs untrimmed (minimum dust limit)",
   2133         "LocalBalance": 6988000000,
   2134         "RemoteBalance": 3000000000,
   2135         "DustLimitSatoshis": 4001,
   2136         "FeePerKw": 4894,
   2137         "UseTestHtlcs": true,
   2138         "HtlcDescs": [],
   2139         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80044a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994c0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994ad0886a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e04004830450221009f16ac85d232e4eddb3fcd750a68ebf0b58e3356eaada45d3513ede7e817bf4c02207c2b043b4e5f971261975406cb955219fa56bffe5d834a833694b5abc1ce4cfd01483045022100e784a66b1588575801e237d35e510fd92a81ae3a4a2a1b90c031ad803d07b3f3022021bc5f16501f167607d63b681442da193eb0a76b4b7fd25c2ed4f8b28fd35b9501475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2140         "RemoteSigHex": "3045022100e784a66b1588575801e237d35e510fd92a81ae3a4a2a1b90c031ad803d07b3f3022021bc5f16501f167607d63b681442da193eb0a76b4b7fd25c2ed4f8b28fd35b95"
   2141     },
   2142     {
   2143         "Name": "commitment tx with one output untrimmed (minimum dust limit)",
   2144         "LocalBalance": 6988000000,
   2145         "RemoteBalance": 3000000000,
   2146         "DustLimitSatoshis": 4001,
   2147         "FeePerKw": 6216010,
   2148         "UseTestHtlcs": true,
   2149         "HtlcDescs": [],
   2150         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80024a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994c0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994a04004830450221009ad80792e3038fe6968d12ff23e6888a565c3ddd065037f357445f01675d63f3022018384915e5f1f4ae157e15debf4f49b61c8d9d2b073c7d6f97c4a68caa3ed4c1014830450221008fd5dbff02e4b59020d4cd23a3c30d3e287065fda75a0a09b402980adf68ccda022001e0b8b620cd915ddff11f1de32addf23d81d51b90e6841b2cb8dcaf3faa5ecf01475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2151         "RemoteSigHex": "30450221008fd5dbff02e4b59020d4cd23a3c30d3e287065fda75a0a09b402980adf68ccda022001e0b8b620cd915ddff11f1de32addf23d81d51b90e6841b2cb8dcaf3faa5ecf"
   2152     },
   2153     {
   2154         "Name": "commitment tx with 3 htlc outputs, 2 offered having the same amount and preimage",
   2155         "LocalBalance": 6987999999,
   2156         "RemoteBalance": 3000000000,
   2157         "DustLimitSatoshis": 546,
   2158         "FeePerKw": 253,
   2159         "UseTestHtlcs": true,
   2160         "HtlcDescs": [
   2161             {
   2162                 "RemoteSigHex": "30440220078fe5343dab88c348a3a8a9c1a9293259dbf35507ae971702cc39dd623ea9af022011ed0c0f35243cd0bb4d9ca3c772379b2b5f4af93140e9fdc5600dfec1cdb0c2",
   2163                 "ResolutionTxHex": "020000000001013d060d0305c9616eaabc21d41fae85bcb5477b5d7f1c92aa429cf15339bbe1c402000000000100000001d0070000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e05004730440220078fe5343dab88c348a3a8a9c1a9293259dbf35507ae971702cc39dd623ea9af022011ed0c0f35243cd0bb4d9ca3c772379b2b5f4af93140e9fdc5600dfec1cdb0c28347304402205df665e2908c7690d2d33eb70e6e119958c28febe141a94ed0dd9a55ce7c8cfc0220364d02663a5d019af35c5cd5fda9465d985d85bbd12db207738d61163449a424012001010101010101010101010101010101010101010101010101010101010101018d76a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c8201208763a9144b6b2e5444c2639cc0fb7bcea5afba3f3cdce23988527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae677502f501b175ac6851b2756800000000"
   2164             },
   2165             {
   2166                 "RemoteSigHex": "304402202df6bf0f98a42cfd0172a16bded7d1b16c14f5f42ba23f5c54648c14b647531302200fe1508626817f23925bb56951d5e4b2654c751743ab6db48a6cce7dda17c01c",
   2167                 "ResolutionTxHex": "020000000001013d060d0305c9616eaabc21d41fae85bcb5477b5d7f1c92aa429cf15339bbe1c40300000000010000000188130000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e050047304402202df6bf0f98a42cfd0172a16bded7d1b16c14f5f42ba23f5c54648c14b647531302200fe1508626817f23925bb56951d5e4b2654c751743ab6db48a6cce7dda17c01c8347304402203f99ec05cdd89558a23683b471c1dcce8f6a92295f1fff3b0b5d21be4d4f97ea022019d29070690fc2c126fe27cc4ab2f503f289d362721b2efa7418e7fddb939a5b01008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9142002cc93ebefbb1b73f0af055dcc27a0b504ad7688ac6851b27568f9010000"
   2168             },
   2169             {
   2170                 "RemoteSigHex": "3045022100bd206b420c495f3aa714d3ea4766cbe95441deacb5d2f737f1913349aee7c2ae02200249d2c950dd3b15326bf378ae5d2b871d33d6737f5d70735f3de8383140f2a1",
   2171                 "ResolutionTxHex": "020000000001013d060d0305c9616eaabc21d41fae85bcb5477b5d7f1c92aa429cf15339bbe1c40400000000010000000188130000000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0500483045022100bd206b420c495f3aa714d3ea4766cbe95441deacb5d2f737f1913349aee7c2ae02200249d2c950dd3b15326bf378ae5d2b871d33d6737f5d70735f3de8383140f2a183483045022100f2cd35e385b9b7e15b92a5d78d120b6b2c5af4e974bc01e884c5facb3bb5966c0220706e0506477ce809a40022d6de8e041e9ef13136c45abee9c36f58a01fdb188b01008876a91414011f7254d96b819c76986c277d115efce6f7b58763ac67210394854aa6eab5b2a8122cc726e9dded053a2184d88256816826d6231c068d4a5b7c820120876475527c21030d417a46946384f88d5f3337267c5e579765875dc4daca813e21734b140639e752ae67a9142002cc93ebefbb1b73f0af055dcc27a0b504ad7688ac6851b27568fa010000"
   2172             }
   2173         ],
   2174         "ExpectedCommitmentTxHex": "02000000000101bef67e4e2fb9ddeeb3461973cd4c62abb35050b1add772995b820b584a488489000000000038b02b80074a010000000000002200202b1b5854183c12d3316565972c4668929d314d81c5dcdbb21cb45fe8a9a8114f4a01000000000000220020e9e86e4823faa62e222ebc858a226636856158f07e69898da3b0d1af0ddb3994d007000000000000220020fe0598d74fee2205cc3672e6e6647706b4f3099713b4661b62482c3addd04a5e881300000000000022002018e40f9072c44350f134bdc887bab4d9bdfc8aa468a25616c80e21757ba5dac7881300000000000022002018e40f9072c44350f134bdc887bab4d9bdfc8aa468a25616c80e21757ba5dac7c0c62d0000000000220020f3394e1e619b0eca1f91be2fb5ab4dfc59ba5b84ebe014ad1d43a564d012994aad9c6a00000000002200204adb4e2f00643db396dd120d4e7dc17625f5f2c11a40d857accc862d6b7dd80e0400483045022100b4014970d9d7962853f3f85196144671d7d5d87426250f0a5fdaf9a55292e92502205360910c9abb397467e19dbd63d081deb4a3240903114c98cec0a23591b79b7601473044022027b38dfb654c34032ffb70bb43022981652fce923cbbe3cbe7394e2ade8b34230220584195b78da6e25c2e8da6b4308d9db25b65b64975db9266163ef592abb7c72501475221023da092f6980e58d2c037173180e9a465476026ee50f96695963e8efe436f54eb21030e9f7b623d2ccc7c9bd44d66d5ce21ce504c0acf6385a132cec6d3c39fa711c152ae3e195220",
   2175         "RemoteSigHex": "3044022027b38dfb654c34032ffb70bb43022981652fce923cbbe3cbe7394e2ade8b34230220584195b78da6e25c2e8da6b4308d9db25b65b64975db9266163ef592abb7c725"
   2176     }
   2177 ]
   2178 ```
   2179 
   2180 # Appendix G: Dual Funded Transaction Test Vectors
   2181 
   2182 ## Funding Transaction Construction
   2183 ### Preliminaries:
   2184 
   2185 ```
   2186 Genesis block 0:
   2187 0100000000000000000000000000000000000000000000000000000000000000000000003ba3edfd7a7b12b27ac72c3e67768f617fc81bc3888a51323a9fb8aa4b1e5e4adae5494dffff7f20020000000101000000010000000000000000000000000000000000000000000000000000000000000000ffffffff4d04ffff001d0104455468652054696d65732030332f4a616e2f32303039204368616e63656c6c6f72206f6e206272696e6b206f66207365636f6e64206261696c6f757420666f722062616e6b73ffffffff0100f2052a01000000434104678afdb0fe5548271967f1a67130b7105cd6a828e03909a67962e0ea1f61deb649f6bc3f4cef38c4f35504e51ec112de5c384df7ba0b8d578a4c702b6bf11d5fac00000000
   2188 
   2189 Block 1:0000002006226e46111a0b59caaf126043eb5bbf28c34f3a5e332a1fc7b2b73cf188910ff86fd1d0db3ac5a72df968622f31e6b5e6566a09e29206d7c7a55df90e181de8be86815cffff7f200000000001020000000001010000000000000000000000000000000000000000000000000000000000000000ffffffff03510101ffffffff0200f2052a0100000017a914113ca7e584fe1575b6fc39abae991529f66eda58870000000000000000266a24aa21a9ede2f61c3f71d1defd3fa999dfa36953755c690689799962b48bebd836974e8cf90120000000000000000000000000000000000000000000000000000000000000000000000000
   2190 Coinbase address pubkey: 2MtpN8zCxTp8AWSg7VBjBX7vU6x73bVCKP8
   2191 Coinbase address privkey: cPxFtfE1w3ptFnsZvvFeWji21kTArYa9GXwMkYsoQHdaJKrjUTek
   2192 
   2193 Parent transaction (spends coinbase of block 1):
   2194 02000000000101f86fd1d0db3ac5a72df968622f31e6b5e6566a09e29206d7c7a55df90e181de800000000171600141fb9623ffd0d422eacc450fd1e967efc477b83ccffffffff0580b2e60e00000000220020fd89acf65485df89797d9ba7ba7a33624ac4452f00db08107f34257d33e5b94680b2e60e0000000017a9146a235d064786b49e7043e4a042d4cc429f7eb6948780b2e60e00000000160014fbb4db9d85fba5e301f4399e3038928e44e37d3280b2e60e0000000017a9147ecd1b519326bc13b0ec716e469b58ed02b112a087f0006bee0000000017a914f856a70093da3a5b5c4302ade033d4c2171705d387024730440220696f6cee2929f1feb3fd6adf024ca0f9aa2f4920ed6d35fb9ec5b78c8408475302201641afae11242160101c6f9932aeb4fcd1f13a9c6df5d1386def000ea259a35001210381d7d5b1bc0d7600565d827242576d9cb793bfe0754334af82289ee8b65d137600000000
   2195 ```
   2196 
   2197 ### Funding transaction (spends parent's outputs):
   2198 
   2199 Locktime: 120
   2200 Feerate: 253 sat/kiloweight
   2201 Opener's `funding_satoshi`: 2 0000 0000 sat
   2202 Accepter's `funding_satoshi`: 2 0000 0000 sat
   2203 
   2204 Inputs:
   2205 ```
   2206 4303ca8ff10c6c345b9299672a66f111c5b81ae027cc5b0d4d39d09c66b032b9 0
   2207 	witness_data:
   2208 	  preimage: 20 68656c6c6f2074686572652c2074686973206973206120626974636f6e212121
   2209 	  witness_script: 27 82012088a820add57dfe5277079d069ca4ad4893c96de91f88ffb981fdc6a2a34d5336c66aff87
   2210 	scriptPubKey: 0020fd89acf65485df89797d9ba7ba7a33624ac4452f00db08107f34257d33e5b946
   2211 	address: bcrt1qlky6eaj5sh0cj7tanwnm573nvf9vg3f0qrdssyrlxsjh6vl9h9rql40v2g
   2212 
   2213 4303ca8ff10c6c345b9299672a66f111c5b81ae027cc5b0d4d39d09c66b032b9 2
   2214 	pubkey: 034695f5b7864c580bf11f9f8cb1a94eb336f2ce9ef872d2ae1a90ee276c772484
   2215 	privkey: cUM8Dr33wK4uFmw3Tz8sbQ7BiBNgX5BthRurU7RkgXVvNUPcWrJf
   2216 	witness_program: fbb4db9d85fba5e301f4399e3038928e44e37d32
   2217 	scriptPubKey: 0014fbb4db9d85fba5e301f4399e3038928e44e37d32
   2218 	address: bcrt1qlw6dh8v9lwj7xq058x0rqwyj3ezwxlfjxsy7er
   2219 
   2220 ```
   2221 
   2222 ### Expected Opener's `tx_add_input` (input 0 above):
   2223 ```
   2224   num_inputs: 1
   2225   tx_add_input:[
   2226     {
   2227       channel_id: "xxx",
   2228       serial_id: 20,
   2229       prevtx_len: 353,
   2230       prevtx: "02000000000101f86fd1d0db3ac5a72df968622f31e6b5e6566a09e29206d7c7a55df90e181de800000000171600141fb9623ffd0d422eacc450fd1e967efc477b83ccffffffff0580b2e60e00000000220020fd89acf65485df89797d9ba7ba7a33624ac4452f00db08107f34257d33e5b94680b2e60e0000000017a9146a235d064786b49e7043e4a042d4cc429f7eb6948780b2e60e00000000160014fbb4db9d85fba5e301f4399e3038928e44e37d3280b2e60e0000000017a9147ecd1b519326bc13b0ec716e469b58ed02b112a087f0006bee0000000017a914f856a70093da3a5b5c4302ade033d4c2171705d387024730440220696f6cee2929f1feb3fd6adf024ca0f9aa2f4920ed6d35fb9ec5b78c8408475302201641afae11242160101c6f9932aeb4fcd1f13a9c6df5d1386def000ea259a35001210381d7d5b1bc0d7600565d827242576d9cb793bfe0754334af82289ee8b65d137600000000",
   2231       prev_vout: 0,
   2232       sequence: 4294967293
   2233     }
   2234   ]
   2235 ```
   2236 
   2237 ### Expected Accepter's `tx_add_input` (input 2 above):
   2238 ```
   2239   num_inputs: 1
   2240   tx_add_input:[
   2241     {
   2242       channel_id: "xxx",
   2243       serial_id: 11,
   2244       prevtx_len: 353,
   2245       prevtx: "02000000000101f86fd1d0db3ac5a72df968622f31e6b5e6566a09e29206d7c7a55df90e181de800000000171600141fb9623ffd0d422eacc450fd1e967efc477b83ccffffffff0580b2e60e00000000220020fd89acf65485df89797d9ba7ba7a33624ac4452f00db08107f34257d33e5b94680b2e60e0000000017a9146a235d064786b49e7043e4a042d4cc429f7eb6948780b2e60e00000000160014fbb4db9d85fba5e301f4399e3038928e44e37d3280b2e60e0000000017a9147ecd1b519326bc13b0ec716e469b58ed02b112a087f0006bee0000000017a914f856a70093da3a5b5c4302ade033d4c2171705d387024730440220696f6cee2929f1feb3fd6adf024ca0f9aa2f4920ed6d35fb9ec5b78c8408475302201641afae11242160101c6f9932aeb4fcd1f13a9c6df5d1386def000ea259a35001210381d7d5b1bc0d7600565d827242576d9cb793bfe0754334af82289ee8b65d137600000000",
   2246       prev_vout: 2,
   2247       sequence: 4294967293
   2248     }
   2249   ]
   2250 ```
   2251 
   2252 ### Outputs: (scriptPubKeys)
   2253 ```
   2254 # opener's change address
   2255 pubkey: 0206e626a4c6d4392d4030bc78bd93f728d1ba61214a77c63adc17d71e32ded3df
   2256 # privkey: cSpC1KYEV1vsUFBwTdcuRkncbwfipY1m5zuQ9CjgAYwiVvbQ4fc1
   2257 scriptPubKey: 00141ca1cca8855bad6bc1ea5436edd8cff10b7e448b
   2258 address: bcrt1qrjsue2y9twkkhs022smwmkx07y9hu3ytshgjmj
   2259 
   2260 # accepter's change address
   2261 pubkey: 028f3978c211f4c0bf4d20674f345ae14e08871b25b2c957b4bdbd42e9726278fc
   2262 privkey: cQ1HXnbAE4wGhuB2b9rJEydV5ayeEmMqxf1dvHPZmyMTPkwvZJyg
   2263 scriptPubKey: 001444cb0c39f93ecc372b5851725bd29d865d333b10
   2264 address: bcrt1qgn9scw0e8mxrw26c29e9h55asewnxwcsdxdp50
   2265 
   2266 # the 2-of-2s
   2267 pubkey1: 0292edb5f7bbf9e900f7e024be1c1339c6d149c11930e613af3a983d2565f4e41e
   2268 pubkey2: 02e16172a41e928cbd78f761bd1c657c4afc7495a1244f7f30166b654fbf7661e3
   2269 script_def: multi(2,0292edb5f7bbf9e900f7e024be1c1339c6d149c11930e613af3a983d2565f4e41e,02e16172a41e928cbd78f761bd1c657c4afc7495a1244f7f30166b654fbf7661e3)
   2270 script: 52210292edb5f7bbf9e900f7e024be1c1339c6d149c11930e613af3a983d2565f4e41e2102e16172a41e928cbd78f761bd1c657c4afc7495a1244f7f30166b654fbf7661e352ae
   2271 scriptPubKey: 0020297b92c238163e820b82486084634b4846b86a3c658d87b9384192e6bea98ec5
   2272 address: bcrt1q99ae9s3czclgyzuzfpsggc6tfprts63uvkxc0wfcgxfwd04f3mzs3asq6l
   2273 ```
   2274 
   2275 ### Expected Opener's `tx_add_output`:
   2276 
   2277 ```
   2278   num_outputs: 2
   2279   tx_add_output[
   2280     {
   2281       channel_id:"xxx",
   2282       serial_id: 30,
   2283       sats: 49999845,
   2284       scriptlen: 22,
   2285       script: "1600141ca1cca8855bad6bc1ea5436edd8cff10b7e448b"
   2286     },{
   2287       channel_id: "xxx",
   2288       serial_id: 44,
   2289       sats: 400000000,
   2290       scriptlen: 34,
   2291       script: "220020297b92c238163e820b82486084634b4846b86a3c658d87b9384192e6bea98ec5"
   2292     }
   2293   ]
   2294 ```
   2295 
   2296 ### Expected Accepter's `tx_add_output`:
   2297 
   2298 ```
   2299   num_outputs: 1
   2300   tx_add_output[
   2301     {
   2302       channel_id: xxx,
   2303       serial_id: 33,
   2304       sats: 49999900,
   2305       scriptlen: 22,
   2306       script: 16001444cb0c39f93ecc372b5851725bd29d865d333b10
   2307     }
   2308   ]
   2309 ```
   2310 
   2311 ### Expected Fee Calculation:
   2312 
   2313 Opener's fees and change:
   2314 ```
   2315     initiator_weight = (input_count, output_count, version, locktime) * 4
   2316                      + segwit_fields (marker + flag)
   2317                      + inputs (txid, vout, scriptSig, sequence) * number initiator inputs * 4
   2318                      + funding_output * 4
   2319                      + change_output * 4
   2320                      + max(number initiator inputs
   2321 			       * minimum witness weight,
   2322 			   actual witness weight of all inputs)
   2323 
   2324     initiator_weight = (1 + 1 + 4 + 4) * 4
   2325                      + 2
   2326                      + (32 + 4 + 1 + 4) * 1 * 4
   2327                      + 43 * 4
   2328                      + 31 * 4
   2329                      + max(1 * 107, 71)
   2330 
   2331     initiator_weight = 609
   2332 
   2333     initiator_fees = initiator_weight * feerate
   2334     initiator_fees = 609 * 253 / 1000
   2335     initiator_fees = 155 sats
   2336 
   2337     change = total_funding
   2338            - funding_sats
   2339            - fees
   2340 
   2341     change = 2 5000 0000
   2342            - 2 0000 0000
   2343            -         155
   2344 
   2345     change =   4999 9845
   2346 
   2347     as hex: e5effa0200000000
   2348 ```
   2349 
   2350 ### Accepter's fees and change:
   2351 ```
   2352     contributor_weight = inputs(txid, vout, scriptSig, sequence)
   2353 			  * number contributor inputs * 4
   2354                        + change_output * 4
   2355 		       + max(number contributor inputs
   2356 			         * minimum witness weight,
   2357 			     actual witness weight of all inputs)
   2358 
   2359     contributor_weight = (32 + 4 + 1 + 4) * 1 *  4
   2360                        + 31 * 4
   2361                        + max(1 * 107, 99)
   2362 
   2363     contributor_weight = 395
   2364 
   2365     contributor_fees = contributor_weight * feerate
   2366     contributor_fees = 398 * 253 / 1000
   2367     contributor_fees = 100 sats
   2368 
   2369     change = total_funding
   2370            - funding_sats
   2371            - fees
   2372 
   2373     change = 2 5000 0000
   2374            - 2 0000 0000
   2375            -         100
   2376 
   2377     change =   4999 9900
   2378 
   2379     as hex: 1cf0fa0200000000
   2380 ```
   2381 
   2382 ### Unsigned Funding Transaction:
   2383 
   2384 ```
   2385 0200000002b932b0669cd0394d0d5bcc27e01ab8c511f1662a6799925b346c0cf18fca03430200000000fdffffffb932b0669cd0394d0d5bcc27e01ab8c511f1662a6799925b346c0cf18fca03430000000000fdffffff03e5effa02000000001600141ca1cca8855bad6bc1ea5436edd8cff10b7e448b1cf0fa020000000016001444cb0c39f93ecc372b5851725bd29d865d333b100084d71700000000220020297b92c238163e820b82486084634b4846b86a3c658d87b9384192e6bea98ec578000000
   2386 ```
   2387 
   2388 ### Expected Opener's `tx_signatures`:
   2389 
   2390 ```
   2391   tx_signatures{
   2392       channel_id: xxx,
   2393       txid: "5ca4e657c1aa9d069ea4a5d712045d233a7d7c52738cb02993637289e6386057",
   2394       num_witnesses: 1,
   2395       witness[{
   2396         len: 74,
   2397         witness_data: "022068656c6c6f2074686572652c2074686973206973206120626974636f6e2121212782012088a820add57dfe5277079d069ca4ad4893c96de91f88ffb981fdc6a2a34d5336c66aff87"
   2398       }]
   2399   }
   2400 ```
   2401 
   2402 ### Expected Accepter's `tx_signatures`:
   2403 
   2404 ```
   2405   tx_signatures{
   2406       channel_id: xxx,
   2407       txid: "5ca4e657c1aa9d069ea4a5d712045d233a7d7c52738cb02993637289e6386057",
   2408       num_witnesses: 1,
   2409       witness[{
   2410         len: 107,
   2411         witness_data: "0247304402207de9ba56bb9f641372e805782575ee840a899e61021c8b1572b3ec1d5b5950e9022069e9ba998915dae193d3c25cb89b5e64370e6a3a7755e7f31cf6d7cbc2a49f6d0121034695f5b7864c580bf11f9f8cb1a94eb336f2ce9ef872d2ae1a90ee276c772484"
   2412       }]
   2413   }
   2414 ```
   2415 
   2416 #### Signed Funding Transaction:
   2417 
   2418 Note locktime is set to 120.
   2419 
   2420 ```
   2421 02000000000102b932b0669cd0394d0d5bcc27e01ab8c511f1662a6799925b346c0cf18fca03430200000000fdffffffb932b0669cd0394d0d5bcc27e01ab8c511f1662a6799925b346c0cf18fca03430000000000fdffffff03e5effa02000000001600141ca1cca8855bad6bc1ea5436edd8cff10b7e448b1cf0fa020000000016001444cb0c39f93ecc372b5851725bd29d865d333b100084d71700000000220020297b92c238163e820b82486084634b4846b86a3c658d87b9384192e6bea98ec50247304402207de9ba56bb9f641372e805782575ee840a899e61021c8b1572b3ec1d5b5950e9022069e9ba998915dae193d3c25cb89b5e64370e6a3a7755e7f31cf6d7cbc2a49f6d0121034695f5b7864c580bf11f9f8cb1a94eb336f2ce9ef872d2ae1a90ee276c772484022068656c6c6f2074686572652c2074686973206973206120626974636f6e2121212782012088a820add57dfe5277079d069ca4ad4893c96de91f88ffb981fdc6a2a34d5336c66aff8778000000
   2422 ```
   2423 
   2424 # Appendix H: Commitment and HTLC Transaction Test Vectors (zero-fee-commitments)
   2425 
   2426 Test vectors [are provided](./bolt03/zero-fee-commitments-test.json) that detail commitment and HTLC
   2427 transactions created using `zero_fee_commitments` in various scenarios. All parameters are provided
   2428 to ensure that implementations generate exactly the same signed transactions.
   2429 
   2430 # References
   2431 
   2432 # Authors
   2433 
   2434 [ FIXME: ]
   2435 
   2436 ![Creative Commons License](https://i.creativecommons.org/l/by/4.0/88x31.png "License CC-BY")
   2437 <br>
   2438 This work is licensed under a [Creative Commons Attribution 4.0 International License](http://creativecommons.org/licenses/by/4.0/).