<oembed><type>rich</type><version>1.0</version><author_name>npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_name><author_url>https://nostr.ae/npub1zw7cc8z78v6s3grujfvcv3ckpvg6kr0w7nz9yzvwyglyg0qu5sjsqhkhpx</author_url><provider_name>njump</provider_name><provider_url>https://nostr.ae</provider_url><html>📅 Original date posted:2018-10-12&#xA;📝 Original message:&#xA;Christian Decker &lt;decker.christian at gmail.com&gt; writes:&#xA;&gt; On Thu, Oct 11, 2018 at 3:40 AM Rusty Russell &lt;rusty at rustcorp.com.au&gt; wrote:&#xA;&gt;&#xA;&gt;&gt; &gt; * Once we have enough confirmations we merge the channels (either&#xA;&gt;&gt; &gt; automatically or with the next channel update). A new commitment tx is&#xA;&gt;&gt; &gt; being created which now spends each output of each of the two funding tx&#xA;&gt;&gt; &gt; and assigns the channel balance to the channel partners accordingly to&#xA;&gt;&gt; the&#xA;&gt;&gt; &gt; two independent channels. The old commitment txs are being invalidated.&#xA;&gt;&gt; &gt; * The disadvantage is that while splicing is not completed and if the&#xA;&gt;&gt; &gt; funder of the splicing tx is trying to publish an old commitment tx the&#xA;&gt;&gt; &gt; node will only be punished by sending all the funds of the first funding&#xA;&gt;&gt; tx&#xA;&gt;&gt; &gt; to the partner as the special commitment tx of the 2nd output has no&#xA;&gt;&gt; newer&#xA;&gt;&gt; &gt; state yet.&#xA;&gt;&gt;&#xA;&gt;&gt; Yes, this is the alternative method; produce a parallel funding tx&#xA;&gt;&gt; (which only needs to support a single revocation, or could even be done&#xA;&gt;&gt; by a long timeout) and then join them when it reaches the agreed depth.&#xA;&gt;&gt;&#xA;&gt;&gt; It has some elegance; particularly because one side doesn&#39;t have to do&#xA;&gt;&gt; any validation or store anything until it&#39;s about to splice in.  You get&#xA;&gt;&gt; asked for a key and signature, you produce a new one, and sign whatever&#xA;&gt;&gt; tx they want.  They hand you back the tx and the key you used once it&#39;s&#xA;&gt;&gt; buried far enough, and you check the tx is indeed buried and the output&#xA;&gt;&gt; is the script you&#39;re expecting, then you flip the commitment tx.&#xA;&gt;&gt;&#xA;&gt;&gt; But I chose chose not to do this because every transaction commitment&#xA;&gt;&gt; forever will require 2 signatures, and doesn&#39;t allow us to forget old&#xA;&gt;&gt; revocation information.&#xA;&gt;&gt;&#xA;&gt;&gt; And it has some strange side-effects: onchain this looks like two&#xA;&gt;&gt; channels; do we gossip about both?  We have to figure the limit on&#xA;&gt;&gt; splice-in to make sure the commitment tx stays under 400kSipa.&#xA;&gt;&gt;&#xA;&gt;&#xA;&gt; This is a lot closer to my original proposal for splicing, and I&#xA;&gt; still like it a lot more since the transition from old to new&#xA;&gt; channel is bascially atomic (not having to update state on both&#xA;&gt; pre-splice and post-splice version). The new funds will remain&#xA;&gt; unavailable for the same time, and since we allow only one&#xA;&gt; concurrent splice in your proposal we don&#39;t even lose any&#xA;&gt; additional time regarding the splice-outs.&#xA;&gt;&#xA;&gt; So pulling the splice_add_input and splice_add_output up to&#xA;&gt; signal the intent of adding funds to a splice. Splice_all_added&#xA;&gt; is then used to start moving the funds to a pre-allocated 2-of-2&#xA;&gt; output where the funds can mature. Once the funds are&#xA;&gt; matured (e.g., 6 confirmations) we can start the transition: both&#xA;&gt; parties claim the funding output, and the pre-allocated funds, to&#xA;&gt; create a new funding tx which is immediately broadcast, and we&#xA;&gt; flip over to the new channel state. No need to keep parallel&#xA;&gt; state and then disambiguating which one it was.&#xA;&#xA;If we&#39;re going to do side splice-in like this, I would use a very&#xA;different protocol: the reason for this protocol was to treat splice-in&#xA;and splice-out the same, and inline splice-in requires wait time.  Since&#xA;splice-out doesn&#39;t, we don&#39;t need this at all.&#xA;&#xA;It would look much more like:&#xA;&#xA;1. Prepare any output with script of specific form. eg:&#xA;        OP_DEPTH 3 OP_EQUAL OP_IF&#xA;                &lt;funding_pubkey1&gt; &lt;funding_pubkey2&gt; OP_CHECKMULTISIG&#xA;        OP_ELSE&#xA;                &lt;blockheight&gt; OP_CHECKLOCKTIMEVERIFY OP_DROP&#xA;                &lt;myrescue_pubkey&gt; OP_CHECKSIG&#xA;        OP_ENDIF&#xA;&#xA;1. type: 40 (`splice_in`) (`option_splice`)&#xA;2. data:&#xA;   * [`32`:`channel_id`]&#xA;   * [`8`: `satoshis`]&#xA;   * [`32`: `txid`]&#xA;   * [`4`: `txoutnum`]&#xA;   * [`4`: `blockheight`]&#xA;   * [`33`: `myrescue_pubkey`]&#xA;&#xA;1. type: 137 (`update_splice_in_accept`) (`option_splice`)&#xA;   data:&#xA;   * [`32`:`channel_id`]&#xA;   * [`32`: `txid`]&#xA;   * [`4`: `txoutnum`]&#xA;&#xA;1. type: 138 (`update_splice_in_reject`) (`option_splice`)&#xA;   data:&#xA;   * [`32`:`channel_id`]&#xA;   * [`32`: `txid`]&#xA;   * [`2`:`len`]&#xA;   * [`len`:`errorstr`]&#xA;&#xA;The recipient of `splice_in` checks that it&#39;s happy with the&#xA;`blockheight` (far enough in future).  Once it sees the tx referred to&#xA;buried to its own `minimum_depth`, it checks output is what they&#xA;claimed, then sends `update_splice_in_accept`; it&#39;s followed up&#xA;`commitment_signed` like normal, but from this point onwards, all&#xA;commitment txs signatures have one extra sig.&#xA;&#xA;Similarly, splice-out:&#xA;&#xA;1. type: 139 (`update_splice_out`) (`option_splice`)&#xA;   * [`32`:`channel_id`]&#xA;   * [`8`: `satoshis`]&#xA;   * [`2`: `scriptlen`]&#xA;   * [`scriptlen`: `outscript`]&#xA;&#xA;The recipient checks that the output script is standard, and the amount&#xA;can be afforded by the other side.  From then on, each commitment tx has&#xA;a new output.&#xA;&#xA;Note this doesn&#39;t put the splice out on the blockchain!&#xA;&#xA;1. type: 140 (`propose_reopen`) (`option_splice`)&#xA;   * [`32`:`channel_id`]&#xA;   * [`4`:`feerate_per_kw`]&#xA;   * [`33`:`funding_pubkey`]&#xA;&#xA;This is initiates a mutually-agreed broadcast of the current state: all&#xA;inputs (original and spliced), all spliced outputs, and a funding-style&#xA;2x2 which has all the remaining funds.  Call this a &#39;reopen tx&#39;.&#xA;&#xA;This must be done with no outstanding commitments, like closing tx&#xA;negotiation, and it&#39;s a back-and-forth until both sides agree on&#xA;feerate.  Then you send:&#xA;&#xA;1. type: 141 (`reopen_accept`) (`option_splice`)&#xA;   * [`32`:`channel_id`]&#xA;   * [`4`:`feerate_per_kw`]&#xA;   * [`64`: `new_commitment_sig`]&#xA;&#xA;Once you&#39;ve received and sent this, you&#39;re ready to sign the reopen tx:&#xA;&#xA;1. type: 142 (`reopen`) (`option_splice`)&#xA;   * [`32`:`channel_id`]&#xA;   * [`64`: `reopen_commitment_sig`]&#xA;&#xA;We need similar &#39;what happens on reconnect at various points&#39; logic to&#xA;the previous one &lt;handwave&gt;.&#xA;&#xA;Once you&#39;ve sent and received the `reopen`, you can broadcast the reopen&#xA;tx at will and start updating again.  If we recommend that public&#xA;channels reuse their old `funding_pubkey` then that means that we should&#xA;also have gossip continuity for upgraded nodes, and don&#39;t need the&#xA;previous channel_update hack.&#xA;&#xA;We could add a new `reopen_locked` message which indicates that both&#xA;sides are happy with the reopen depth, if we don&#39;t want to allow reopens&#xA;back-to-back?&#xA;&#xA;&gt; This is one of the cases where a simpler solution (relatively&#xA;&gt; speaking ^^) is to be preferred imho, allowing for future&#xA;&gt; iterations.&#xA;&#xA;Unless we can have both :)&#xA;&#xA;Cheers,&#xA;Rusty.</html></oembed>