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 (189696B)


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