Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature to allow shutdown of channels opened with the wrong funding txid / output number. #4421

Merged

Conversation

rustyrussell
Copy link
Contributor

See #4416, though it may not help soon enough for that (the peer will forget the channel after 2016 blocks, so they need to upgrade and try this before then!)

Next step is to remove the footgun which caused it, but @TBast also reported that he had similar problems with users trying to RBF their funding tx...

@rustyrussell rustyrussell added this to the v0.9.4 milestone Mar 10, 2021
Copy link
Member

@cdecker cdecker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very good, just found an assert that seems to be triggerable (followed by the same check in an if block) and minor wording.

CI failures seem unrelated, restarted.

ACK 599113e

I was initially curious about why we'd want to remember the funding
alias in the first place, but it is being used to track the funding
instead. I'm wondering if this is worth generalizing into an alias
tracking feature: record tx outpoint aliases in a new table, if an
alias gets confirmed look at the txo_watches and call that with the
alias transaction instead. It'd require a bit of care in the watch
callbacks in case we build on top of that TX, but it could allow us to
use the aliasing to unify outpoint tracking across variants of
transactions for things like HTLC-transactions being re-assembled into
larger batches, these malleation cases and some others.

Not for this PR, but might be a nice cleanup for the next release if we go
more into the direction of babysitting our txs.

\fBexperimental-shutdown-wrong-funding\fR


Specifying this allows the \fBwrong_funding\fR field in shutdown: if a
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For the spec we probably want to call this funding_malleated_txid or funding_alias_txid but for now this is ok.


Specifying this allows the \fBwrong_funding\fR field in shutdown: if a
remote node has opened a channel using the incorrect txid (and it
hasn't been used yet at all) this allows them to negotiate a clean
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn't specifying that it hasn't been used implied? We can't perform updates unless we find the correct funding.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, I should clarify. "If the remote node has opened a channel but claims it used the incorrect txid (and the channel hasn't been used at all)"?

@@ -90,6 +90,10 @@ msgtype,shutdown,38
msgdata,shutdown,channel_id,channel_id,
msgdata,shutdown,len,u16,
msgdata,shutdown,scriptpubkey,byte,len
msgdata,shutdown,tlvs,shutdown_tlvs,
tlvtype,shutdown_tlvs,wrong_funding,100
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shall we use 104 here as well to match the option featurebit?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, why not.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(I didn't change this, actually, since @openoms is actively testing now, and easier not to break him).

Comment on lines +1326 to +1336
", shutdown_wrong_txid" // 57
", shutdown_wrong_outnum" // 58
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

At some point I'll add an outpoint primitive that subsumes (txid, outnum) since it's a very common thing, and they rarely get queried individually :-)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If only ALTER TABLE DROP COLUMN were something that sqlite3 can do...

@@ -75,6 +76,7 @@ static struct bitcoin_tx *close_tx(const tal_t *ctx,
out_minus_fee[LOCAL],
out_minus_fee[REMOTE],
dust_limit);
assert(tx);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whoops, this looks like it could trigger, taking closingd with it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, that was me trying to track a bug and force a backtrace.

Good catch!

@@ -669,6 +695,11 @@ int main(int argc, char *argv[])
status_debug("fee = %s",
type_to_string(tmpctx, struct amount_sat, &offer[LOCAL]));
status_debug("fee negotiation step = %s", fee_negotiation_step_str);
if (wrong_funding)
status_unusual("Seting wrong_funding_txid to %s:%u",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
status_unusual("Seting wrong_funding_txid to %s:%u",
status_unusual("Setting wrong_funding_txid to %s:%u",

@openoms
Copy link
Contributor

openoms commented Mar 10, 2021

Tried but seems to break unless it is me doing something wrong.
Running on signet with a x86_64 Debian Linux and an aarch64 Rpi4 running Debian as well.
Git is checked out to this PR:

git fetch origin pull/4421/head:pr4421
git checkout pr4421

built with:

./configure --enable-experimental-features
make

And lightningd is running with:

/usr/local/bin/lightningd --experimental-shutdown-wrong-funding

Build output: https://pastebin.com/raw/AD6U8RNG

The signet transaction sent (with the wrong txid passed to fundchannel_complete): https://mempool.space/signet/tx/28e3a76f2b6f6179d0c033d01614223c63586e0feb58f2c592475370c6a65a3c
Running:

$ lightning-cli close id=7a6e2d80bc076660593282b5260bf41cfaa5025c29440b5e700f1a3b2c5a9736 wrong_funding=28e3a76f2b6f6179d0c033d01614223c63586e0feb58f2c592475370c6a65a3c:1
   lightning-cli: reading response: socket closed

In the log:

DEBUG   035d7bef8ecadac0cfbc306222bc9cc4f7c07414ae4e0a4f4fa4be9355142168f6-channeld-chan#1: peer_in WIRE_GOSSIP_TIMESTAMP_FILTER
**BROKEN** lightningd: FATAL SIGNAL 11 (version v0.9.3-247-g599113e)
**BROKEN** lightningd: backtrace: common/daemon.c:44 (send_backtrace) 0xaaaadf7cb04f
**BROKEN** lightningd: backtrace: common/daemon.c:52 (crashdump) 0xaaaadf7cb0a7
**BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffa99e27cf
**BROKEN** lightningd: backtrace: lightningd/peer_control.c:1649 (json_close) 0xaaaadf79b42c
**BROKEN** lightningd: backtrace: lightningd/jsonrpc.c:643 (command_exec) 0xaaaadf787697
**BROKEN** lightningd: backtrace: lightningd/jsonrpc.c:767 (rpc_command_hook_final) 0xaaaadf788c93
**BROKEN** lightningd: backtrace: lightningd/plugin_hook.c:286 (plugin_hook_call_) 0xaaaadf7a8427
**BROKEN** lightningd: backtrace: lightningd/jsonrpc.c:855 (plugin_hook_call_rpc_command) 0xaaaadf789237
**BROKEN** lightningd: backtrace: lightningd/jsonrpc.c:942 (parse_request) 0xaaaadf789237
**BROKEN** lightningd: backtrace: lightningd/jsonrpc.c:1033 (read_json) 0xaaaadf78949b
**BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:59 (next_plan) 0xaaaadf80ca27
**BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:407 (do_plan) 0xaaaadf80d057
**BROKEN** lightningd: backtrace: ccan/ccan/io/io.c:417 (io_ready) 0xaaaadf80d097
**BROKEN** lightningd: backtrace: ccan/ccan/io/poll.c:445 (io_loop) 0xaaaadf80efa7
**BROKEN** lightningd: backtrace: lightningd/io_loop_with_timers.c:24 (io_loop_with_timers) 0xaaaadf786f9b
**BROKEN** lightningd: backtrace: lightningd/lightningd.c:1092 (main) 0xaaaadf78af2b
**BROKEN** lightningd: backtrace: (null):0 ((null)) 0xffffa9557d23
**BROKEN** lightningd: backtrace: (null):0 ((null)) 0xaaaadf776e23

DEBUG   plugin-manager: started(26811) /usr/local/bin/../libexec/c-lightning/plugins/autoclean
DEBUG   plugin-manager: started(26812) /usr/local/bin/../libexec/c-lightning/plugins/bcli

@rustyrussell
Copy link
Contributor Author

Good catch, fix coming!

@openoms
Copy link
Contributor

openoms commented Mar 11, 2021

Tested sucessfully on signet!
Resulting transaction:
https://mempool.space/signet/tx/4fa3bdb399b712ab4af187213663f3e1ab2ab13746f84cb74e794075ee76fa08

$ ligthning-cli close id=7a6e2d80bc076660593282b5260bf41cfaa5025c29440b5e700f1a3b2c5a9737 wrong_funding=9dc0a491de53fe54ed8089d23919b6700365a499a9c0f8b9a132abee9d59b4be:1
{
   "tx": "0200000001beb4599deeab32a1b9f8c0a999a4650370b61939d28980ed54fe53de91a4c09d0100000000ffffffff01991d0300000000001600148b902a96c30c0663d1d63f96476d8496e356b86800000000",
   "txid": "4fa3bdb399b712ab4af187213663f3e1ab2ab13746f84cb74e794075ee76fa08",
   "type": "mutual"
}

Log of the remote peer:

DEBUG   02bc748ee7eb2044e11a606e9ba0fc7d91afb43951e365c201e6b3198ad600e10a-closingd-chan#1: Feerange remote update 236sat: now 0sat-235sat
DEBUG   02bc748ee7eb2044e11a606e9ba0fc7d91afb43951e365c201e6b3198ad600e10a-closingd-chan#1: Status closed, but not exited. Killing
DEBUG   lightningd: Broadcasting txid 4fa3bdb399b712ab4af187213663f3e1ab2ab13746f84cb74e794075ee76fa08
DEBUG   lightningd: sendrawtransaction: 02000000000101beb4599deeab32a1b9f8c0a999a4650370b61939d28980ed54fe53de91a4c09d0100000000ffffffff01991d0300000000001600148b902a96c30c0663d1d63f96476d8496e356b8680400473044022023496260cf17402773add7f8e44891a43284a0e45b25afe11be001e0b290a2a702206b1bc4760650926082d018fdc7f1a9b91b20241f0f43dcfc3463c53f849c20a70147304402207d704387539209fffb8abc654aad4860e81b097a8ddcd4d93877aa6bdabfd78b022036027758ae6a85ee90d5e0ab633a30704d4c1c55cbe1621e59807c37ec34442a0147522103514cb8ed1c738cac2c9dd242e314143db246efe19846bc4d4658ecadfb7c6c452103bd6e1d5f751f4cb65bfe918cda22749107f727f0f4cd9165bacb45eb6f81dea152ae00000000
INFO    02bc748ee7eb2044e11a606e9ba0fc7d91afb43951e365c201e6b3198ad600e10a-chan#1: State changed from CLOSINGD_SIGEXCHANGE to CLOSINGD_COMPLETE
DEBUG   hsmd: Client: Received message 5 from client
DEBUG   plugin-bcli: sendrawtx exit 0 (bitcoin-cli -signet sendrawtransaction 02000000000101beb4599deeab32a1b9f8c0a999a4650370b61939d28980ed54fe53de91a4c09d0100000000ffffffff01991d0300000000001600148b902a96c30c0663d1d63f96476d8496e356b8680400473044022023496260cf17402773add7f8e44891a43284a0e45b25afe11be001e0b290a2a702206b1bc4760650926082d018fdc7f1a9b91b20241f0f43dcfc3463c53f849c20a70147304402207d704387539209fffb8abc654aad4860e81b097a8ddcd4d93877aa6bdabfd78b022036027758ae6a85ee90d5e0ab633a30704d4c1c55cbe1621e59807c37ec34442a0147522103514cb8ed1c738cac2c9dd242e314143db246efe19846bc4d4658ecadfb7c6c452103bd6e1d5f751f4cb65bfe918cda22749107f727f0f4cd9165bacb45eb6f81dea152ae00000000) 
DEBUG   lightningd: ... polled feerate estimate for min_acceptable (163) smoothed to 213 (alpha=0.44)

Log of the funding peer:

DEBUG   lightningd: ... feerate estimate for min_acceptable hit floor 253
INFO    0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-chan#1: State changed from CHANNELD_AWAITING_LOCKIN to CHANNELD_SHUTTING_DOWN
DEBUG   lightningd: close_command: timeout = 172800
DEBUG   lightningd: ... polled feerate estimate for min_acceptable (163) smoothed to 213 (alpha=0.44)
DEBUG   lightningd: ... feerate estimate for min_acceptable hit floor 253
DEBUG   lightningd: update_feerates: feerate = 326, min=253, max=4294967295, penalty=326
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-channeld-chan#1: Trying commit
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-channeld-chan#1: Can't send commit: nothing to send
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-channeld-chan#1: peer_out WIRE_SHUTDOWN
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-channeld-chan#1: peer_in WIRE_SHUTDOWN
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: pid 2299, msgfd 45
UNUSUAL 0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-channeld-chan#1: Status closed, but waitpid 2171 says No child processes
INFO    0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-chan#1: State changed from CHANNELD_SHUTTING_DOWN to CLOSINGD_SIGEXCHANGE
DEBUG   hsmd: Client: Received message 9 from client
DEBUG   hsmd: new_client: 1
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: out = 204421sat/0sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: dustlimit = 546sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: fee = 236sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: fee negotiation step = 50%
UNUSUAL 0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Setting wrong_funding_txid to 9dc0a491de53fe54ed8089d23919b6700365a499a9c0f8b9a132abee9d59b4be:1
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Making close tx at = 204421sat/0sat fee 236sat
DEBUG   hsmd: Client: Received message 21 from client
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: sending fee offer 236sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: peer_out WIRE_CLOSING_SIGNED
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: peer_in WIRE_CLOSING_SIGNED
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Making close tx at = 204421sat/0sat fee 236sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Received fee offer 236sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: ...offer is reasonable
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-chan#1: Their actual closing tx fee is 236sat vs previous 236sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Feerange init 0sat-236sat, remote higher
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Feerange local update 236sat: now 237sat-236sat
DEBUG   0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-closingd-chan#1: Status closed, but not exited. Killing
DEBUG   lightningd: Broadcasting txid 4fa3bdb399b712ab4af187213663f3e1ab2ab13746f84cb74e794075ee76fa08
DEBUG   lightningd: sendrawtransaction: 02000000000101beb4599deeab32a1b9f8c0a999a4650370b61939d28980ed54fe53de91a4c09d0100000000ffffffff01991d0300000000001600148b902a96c30c0663d1d63f96476d8496e356b8680400473044022023496260cf17402773add7f8e44891a43284a0e45b25afe11be001e0b290a2a702206b1bc4760650926082d018fdc7f1a9b91b20241f0f43dcfc3463c53f849c20a70147304402207d704387539209fffb8abc654aad4860e81b097a8ddcd4d93877aa6bdabfd78b022036027758ae6a85ee90d5e0ab633a30704d4c1c55cbe1621e59807c37ec34442a0147522103514cb8ed1c738cac2c9dd242e314143db246efe19846bc4d4658ecadfb7c6c452103bd6e1d5f751f4cb65bfe918cda22749107f727f0f4cd9165bacb45eb6f81dea152ae00000000
INFO    0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9-chan#1: State changed from CLOSINGD_SIGEXCHANGE to CLOSINGD_COMPLETE
DEBUG   hsmd: Client: Received message 5 from client
DEBUG   plugin-bcli: sendrawtx exit 0 (bitcoin-cli -signet sendrawtransaction 02000000000101beb4599deeab32a1b9f8c0a999a4650370b61939d28980ed54fe53de91a4c09d0100000000ffffffff01991d0300000000001600148b902a96c30c0663d1d63f96476d8496e356b8680400473044022023496260cf17402773add7f8e44891a43284a0e45b25afe11be001e0b290a2a702206b1bc4760650926082d018fdc7f1a9b91b20241f0f43dcfc3463c53f849c20a70147304402207d704387539209fffb8abc654aad4860e81b097a8ddcd4d93877aa6bdabfd78b022036027758ae6a85ee90d5e0ab633a30704d4c1c55cbe1621e59807c37ec34442a0147522103514cb8ed1c738cac2c9dd242e314143db246efe19846bc4d4658ecadfb7c6c452103bd6e1d5f751f4cb65bfe918cda22749107f727f0f4cd9165bacb45eb6f81dea152ae00000000) 
DEBUG   lightningd: ... polled feerate estimate for min_acceptable (163) smoothed to 213 (alpha=0.44)

And the recovered funds in the wallet:

$ lightning-cli listfunds
{
   "outputs": [
      {
         "txid": "4fa3bdb399b712ab4af187213663f3e1ab2ab13746f84cb74e794075ee76fa08",
         "output": 0,
         "value": 204185,
         "amount_msat": "204185000msat",
         "scriptpubkey": "00148b902a96c30c0663d1d63f96476d8496e356b868",
         "address": "tb1q3wgz49krpsrx85wk87tywmvyjm34dwrgd0mc7w",
         "status": "confirmed",
         "blockheight": 28662,
         "reserved": false
      }
   ],
   "channels": [
      {
         "peer_id": "0376c2d859b43fae1ddd6cea85d55e1237a2e3a6c24f62eb1788b6ce3693d26cb9",
         "connected": false,
         "state": "ONCHAIN",
         "channel_sat": 204421,
         "our_amount_msat": "204421000msat",
         "channel_total_sat": 204421,
         "amount_msat": "204421000msat",
         "funding_txid": "37975a2c3b1a0f705e0b44295c02a5fa1cf40b26b5823259606607bc802d6e7a",
         "funding_output": 0
      }
   ]
}

@cdecker
Copy link
Member

cdecker commented Mar 12, 2021

Minor breakage in the test, otherwise perfect:

_________________________ test_shutdown_alternate_txid _________________________
[gw1] linux -- Python 3.6.13 /opt/hostedtoolcache/Python/3.6.13/x64/bin/python3

node_factory = <pyln.testing.utils.NodeFactory object at 0x7ff8b6d24208>
bitcoind = <pyln.testing.utils.ElementsD object at 0x7ff8b696e710>

    @unittest.skipIf(EXPERIMENTAL_DUAL_FUND, "Uses fundchannel_start")
    def test_shutdown_alternate_txid(node_factory, bitcoind):
        l1, l2 = node_factory.line_graph(2, fundchannel=False,
                                         opts={'experimental-shutdown-wrong-funding': None})
    
        amount = 1000000
        amount_msat = Millisatoshi(amount * 1000)
    
        # Let's make a classic fundchannel mistake (wrong txid!)
        addr = l1.rpc.fundchannel_start(l2.info['id'], amount_msat)['funding_address']
        txid = bitcoind.rpc.sendtoaddress(addr, amount / 10**8)
    
        # Gotta figure out which output manually :(
        tx = bitcoind.rpc.getrawtransaction(txid, 1)
        for n, out in enumerate(tx['vout']):
>           if out['scriptPubKey']['addresses'][0] == addr:
E           KeyError: 'addresses'

tests/test_closing.py:2715: KeyError

@rustyrussell
Copy link
Contributor Author

Minor breakage in the test, otherwise perfect:

_________________________ test_shutdown_alternate_txid _________________________
[gw1] linux -- Python 3.6.13 /opt/hostedtoolcache/Python/3.6.13/x64/bin/python3

node_factory = <pyln.testing.utils.NodeFactory object at 0x7ff8b6d24208>
bitcoind = <pyln.testing.utils.ElementsD object at 0x7ff8b696e710>

    @unittest.skipIf(EXPERIMENTAL_DUAL_FUND, "Uses fundchannel_start")
    def test_shutdown_alternate_txid(node_factory, bitcoind):
        l1, l2 = node_factory.line_graph(2, fundchannel=False,
                                         opts={'experimental-shutdown-wrong-funding': None})
    
        amount = 1000000
        amount_msat = Millisatoshi(amount * 1000)
    
        # Let's make a classic fundchannel mistake (wrong txid!)
        addr = l1.rpc.fundchannel_start(l2.info['id'], amount_msat)['funding_address']
        txid = bitcoind.rpc.sendtoaddress(addr, amount / 10**8)
    
        # Gotta figure out which output manually :(
        tx = bitcoind.rpc.getrawtransaction(txid, 1)
        for n, out in enumerate(tx['vout']):
>           if out['scriptPubKey']['addresses'][0] == addr:
E           KeyError: 'addresses'

tests/test_closing.py:2715: KeyError

Obvious fix applied. Rebased and folded previous fixes...

@rustyrussell rustyrussell force-pushed the guilt/shutdown-wrong-txid branch 2 times, most recently from 319460c to 0095c48 Compare March 15, 2021 01:43
… up!

It's not unheard of for people to give the wrong funding tx to us,
getting their funds stuck.  Interestingly, we can allow mutual close
using a different txid and output number as long as they (solely)
funded the channel, and the channel hasn't been used.

This defines a "play area" feature to do just that.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
…tpoint.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
If it passes checks, lightningd puts it in the database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Added: lightningd: experimental-shutdown-wrong-funding to allow remote nodes to close incorrectly opened channels.
Changelog-Added: JSON-RPC: close has a new `wrong_funding` option to try to close out unused channels where we messed up the funding tx.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Fairly easy to do, though we also have to add the watch when we load
from the database.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
@rustyrussell
Copy link
Contributor Author

Trivial rebase to fix generated file conflicts

@rustyrussell
Copy link
Contributor Author

rustyrussell commented Mar 16, 2021

Ack 06d04f8

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants