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

Purge PleaseOpenChannel upon disconnection #570

Closed
pm47 opened this issue Dec 13, 2023 · 1 comment
Closed

Purge PleaseOpenChannel upon disconnection #570

pm47 opened this issue Dec 13, 2023 · 1 comment

Comments

@pm47
Copy link
Member

pm47 commented Dec 13, 2023

If a disconnection happens right after having sent PleaseOpenChannel, swap-in utxos will not be unlocked. It's a different issue from #564, with similar effects.

We may be able to clean up the channelRequests table here, but I'm not sure about side effects:

is Disconnected -> {
when (peerConnection) {
null -> logger.info { "ignoring disconnected event, we're already disconnected" }
else -> {
logger.warning { "disconnecting channels from connectionId=${peerConnection?.id}" }
peerConnection = null
_channels.forEach { (key, value) ->
val (state1, actions) = value.process(ChannelCommand.Disconnected)
_channels = _channels + (key to state1)
processActions(key, peerConnection, actions)
}
incomingPaymentHandler.purgePayToOpenRequests()
}
}
}

Logs:

2023-12-13 12:31:43.084  7946-7946  f.a.l.i.Peer            fr.acinq.phoenix.testnet             I   - swap-in wallet: requesting channel using 1 utxos with balance=200000 sat
                                                                                                        remoteNodeId: 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
2023-12-13 12:31:43.085  7946-7946  f.a.l.i.Peer            fr.acinq.phoenix.testnet             I   - sending please_open_channel with 1 utxos (amount = 200000 sat)
                                                                                                        remoteNodeId: 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
                                                                                                        connectionId: 1702465030475
2023-12-13 12:31:43.087  7946-7946  f.a.l.i.Peer            fr.acinq.phoenix.testnet             I   - sending PleaseOpenChannel(chainHash=43497fd7f826957108f4a30fd9cec3aeba79972084e90ead01ea330900000000, requestId=a3e7dd3176d000dfc80ce658735a988b4a0caf38088b00e5c326f6494a6ed1b7, localFundingAmount=200000 sat, localInputsCount=1, localInputsWeight=392, tlvs=TlvStream(records=[GrandParents(outpoints=[d9b771ae775b7b4a8546f809596ee09106e95ac38a39097c60b9d7285f15e032:1])], unknown=[]))
                                                                                                        remoteNodeId: 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
                                                                                                        connectionId: 1702465030475
2023-12-13 12:31:43.087  7946-7946  f.a.p.m.PeerManager     fr.acinq.phoenix.testnet             D   - collecting node_event=Requested
2023-12-13 12:31:43.093  7946-7946  f.a.p.t.Navigation      fr.acinq.phoenix.testnet             D   - init app view composition
2023-12-13 12:31:43.123  7946-7995  EGL_emulation           fr.acinq.phoenix.testnet             D  app_time_stats: avg=533347.44ms min=1.71ms max=2132772.25ms count=4
2023-12-13 12:31:56.125  7946-7946  f.a.l.b.e....trumClient fr.acinq.phoenix.testnet             W   - electrum connection error: fr.acinq.lightning.io.TcpSocket$IOException$ConnectionClosed: Connection closed
                                                                                                    	at fr.acinq.lightning.io.JvmTcpSocket.receiveAvailable(JvmTcpSocket.kt:72)
                                                                                                    	at fr.acinq.lightning.io.JvmTcpSocket$receiveAvailable$1.invokeSuspend(Unknown Source:16)
                                                                                                    	at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:33)
                                                                                                    	at kotlinx.coroutines.DispatchedTask.run(DispatchedTask.kt:108)
                                                                                                    	at android.os.Handler.handleCallback(Handler.java:942)
                                                                                                    	at android.os.Handler.dispatchMessage(Handler.java:99)
                                                                                                    	at android.os.Looper.loopOnce(Looper.java:201)
                                                                                                    	at android.os.Looper.loop(Looper.java:288)
                                                                                                    	at android.app.ActivityThread.main(ActivityThread.java:7872)
                                                                                                    	at java.lang.reflect.Method.invoke(Native Method)
                                                                                                    	at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
                                                                                                    	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
2023-12-13 12:31:56.173  7946-7946  f.a.p.m.Ap...ionsDaemon fr.acinq.phoenix.testnet             I   - next Electrum connection attempt #0 in 100ms
2023-12-13 12:31:56.333  7946-7946  f.a.p.m.Ap...ionsDaemon fr.acinq.phoenix.testnet             I   - calling ElectrumClient.connect to server=ServerAddress(host=testnet.qtornado.com, port=51002, tls=PINNED_PUBLIC_KEY(pubKey=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwkLgqNkkTbwpV3gMdgDA...}) with handshake_timeout=4s
2023-12-13 12:31:56.400  7946-7946  f.a.l.b.e....trumClient fr.acinq.phoenix.testnet             I   - attempting connection to electrumx instance [host=testnet.qtornado.com, port=51002, tls=PINNED_PUBLIC_KEY(pubKey=MIICIjANBgkqhkiG9w0BAQEFAAOCAg8AMIICCgKCAgEAwkLgqNkkTbwpV3gMdgDA...}]
2023-12-13 12:31:56.442  7946-7946  f.a.l.i.Peer            fr.acinq.phoenix.testnet             W   - TCP receive: Connection closed
                                                                                                        remoteNodeId: 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
                                                                                                        connectionId: 1702465030475
2023-12-13 12:31:56.462  7946-7946  f.a.l.i.Peer            fr.acinq.phoenix.testnet             W   - closing TCP socket: Connection closed
                                                                                                        remoteNodeId: 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
                                                                                                        connectionId: 1702465030475
2023-12-13 12:31:56.513  7946-7946  f.a.l.i.Peer            fr.acinq.phoenix.testnet             I   - connection state changed: CLOSED
                                                                                                        remoteNodeId: 03933884aaf1d6b108397e5efe5c86bcf2d8ca8d2f700eda99db9214fc2712b134
@t-bast
Copy link
Member

t-bast commented Jul 8, 2024

We're getting rid of please_open_channel entirely in #649, so we don't need to fix this.

@t-bast t-bast closed this as completed Jul 8, 2024
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

No branches or pull requests

2 participants