ElementsProject / lightning

Core Lightning — Lightning Network implementation focusing on spec compliance and performance
Other
2.8k stars 889 forks source link

Peer disconnects after `fundchannel` failure #2190

Open nitramiz opened 5 years ago

nitramiz commented 5 years ago

Issue and Steps to Reproduce

If we connect to a node, try to open a channel and the channel fails (i.e. for less than 1546 sat), the peer or us disconnect. Both nodes are operated by me, running inside docker containers.

getinfo output

Receiver (invoice issuer):

{
  "id": "pubkeypayee",
  "alias": "tester",
  "color": "039d22",
  "address": [
    {
      "type": "ipv4",
      "address": "x.x.x.x",
      "port": 9735
    }
  ],
  "binding": [
    {
      "type": "ipv4",
      "address": "0.0.0.0",
      "port": 9735
    }
  ],
  "version": "v0.6.1-225-g7eec225",
  "blockheight": 1448352,
  "network": "testnet",
  "msatoshi_fees_collected": 0
}

Sender (payer):

{
  "id": "pubkeypayer",
  "alias": "tester",
  "color": "02720b",
  "address": [
    {
      "type": "ipv4",
      "address": "x.x.x.x",
      "port": 9735
    }
  ],
  "binding": [
    {
      "type": "ipv4",
      "address": "0.0.0.0",
      "port": 9735
    }
  ],
  "version": "v0.6.1-225-g7eec225",
  "blockheight": 1448352,
  "network": "testnet",
  "msatoshi_fees_collected": 6007
}

Step-by-step:

Currently disconnected:

tester@localhost ~ $ lightning-cli listpeers | grep -A 3 pubkeypayee
      "id": "pubkeypayee",
      "connected": false,
      "channels": [
        {

Connecting:

lightning-cli connect pubkeypayee
{
  "id": "pubkeypayee"
}

Failed fundchannel:

lightning-cli fundchannel pubkeypayee 1000
{ "code" : -1, "message" : "channel a0fa2621121e2f684205f74b9f4a56f35092266466db9a772e20a06f731d004e: You gave bad parameters: channel capacity with funding 1000000 msat, reserves 546000/546000 msat, max_htlc_value_in_flight_msat 18446744073709551615 is 454000 msat, which is below 1000000 msat" }

Try to fund a channel with minimum sats:

lightning-cli fundchannel pubkeypayee 1546
{ "code" : -1, "message" : "Peer not connected" }

Then connecting again and funding with 1546 satoshis opens a channel successfully.

I was following the logs throughout the process on each node and the only thing that showed up didn't seem very helpful. Receiving node:

2018-12-18T15:06:09.836Z lightningd(1772): lightning_openingd-pubkeypayee chan #50: Peer connection lost
2018-12-18T15:06:09.838Z lightningd(1772): pubkeypayer chan #50: Owning subdaemon lightning_openingd died (62208)

Sending node:

2018-12-18T15:06:09.802Z lightningd(146701): lightning_openingd-pubkeypayee chan #84: Unexpected FUNDER_FAILED 1774546865792073656e74206572726f72206368616e6e656c20333365623436363730353664336631663366366536303335363966323136623033386538613035363365343163333232613135613531373364376436376539653a20596f7520676176652062616420706172616d65746572733a206368616e6e656c20636170616369747920776974682066756e64696e672031303030303030206d7361742c207265736572766573203534363030302f353436303030206d7361742c206d61785f68746c635f76616c75655f696e5f666c696768745f6d73617420313834343637343430373337303935353136313520697320343534303030206d7361742c2077686963682069732062656c6f772031303030303030206d73617400
2018-12-18T15:06:09.803Z lightningd(146701): pubkeypayee chan #84: Owning subdaemon lightning_openingd died (9)
ZmnSCPxj commented 4 years ago

We have since fixed this by automatically connecting on fundchannel initiation, is that enough to close this issue?