ElementsProject / lightning

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

Upgrading **BROKEN** wallet/wallet.c:2594: INSERT INTO channels #7183

Closed JaviLib closed 5 months ago

JaviLib commented 7 months ago

After upgrading from 23.11.2 to 24.02.1, I obtain the following error:

lightningd_build  | 2024-03-28T17:27:39.815321629Z Error executing statement: wallet/wallet.c:2594: INSERT INTO channels (  peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, require_confirm_inputs_remote, require_confirm_inputs_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);: UNIQUE constraint failed: channels.id
lightningd_build  | 2024-03-28T17:27:39.815333462Z 2024-03-28T17:27:39.815Z **BROKEN** lightningd: Error executing statement: wallet/wallet.c:2594: INSERT INTO channels (  peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, require_confirm_inputs_remote, require_confirm_inputs_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);: UNIQUE constraint failed: channels.id

I had to downgrade and restore the backup I made just before updating in order for my node to continue operating.

nakoshi-satamoto commented 7 months ago

This might be related, see this and if this solution works for you

https://github.com/ElementsProject/lightning/issues/7162

adi2011 commented 7 months ago

Hi @JavierRSobrino, can you please check the logs and see if this error occurs after your node logs "Detected a channel with lost state, Entering Recovery mode!"?

KBPROC commented 6 months ago

I have also encountered this issue after routine OS update and lightningd restart. Searched and found 'lightningd --disable-plugin=recover' which has my node running again. The issue appears to be well understood and I suspect the next release will include the fix. Thanks.

BROKEN lightningd: Error executing statement: wallet/wallet.c:2594: INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, require_confirm_inputs_remote, require_confirm_inputs_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);: UNIQUE constraint failed: channels.id Error executing statement: wallet/wallet.c:2594: INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, require_confirm_inputs_remote, require_confirm_inputs_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);: UNIQUE constraint failed: channels.id Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.Lost connection to the RPC socket.

adi2011 commented 5 months ago

This should be resolved now. @JavierRSobrino @KBPROC, Pls do lmk if this error INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local... still persists.

vincenzopalazzo commented 5 months ago

@adi2011 If understood correctly we merge the code that fixed this issue right? So maybe we can close the issue?

adi2011 commented 5 months ago

Yes @vincenzopalazzo, this should be resolved now...

vincenzopalazzo commented 5 months ago

Fixed in https://github.com/ElementsProject/lightning/pull/7216