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

Abort interactive-tx during funding #2769

Merged
merged 2 commits into from Nov 3, 2023

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Oct 30, 2023

If we abort the interactive-tx protocol while we're waiting for bitcoind to fund the transaction, we must avoid sending an obsolete tx_add_input for the funded transaction. There is a check in Channel.scala to only send an outgoing interactive-tx message if we have an active interactive-tx session, but this isn't sufficient in the following scenario:

  • we disconnect and thus abort the interactive-tx session while bitcoind is funding
  • we reconnect and restart another interactive-tx session
  • bitcoind responds for the first interactive-tx session

In that scenario we would mix tx_add_input from the old and the new interactive-tx session, which leads to a duplicate serial_id.

If we abort the interactive-tx protocol while we're waiting for bitcoind
to fund the transaction, we must avoid sending an obsolete `tx_add_input`
for the funded transaction. There is a check in `Channel.scala` to only
send an outgoing interactive-tx message if we have an active interactive-tx
session, but this isn't sufficient in the following scenario:

- we disconnect and thus abort the interactive-tx session while bitcoind
  is funding
- we reconnect and restart another interactive-tx session
- bitcoind responds for the first interactive-tx session

In that scenario we would mix `tx_add_input` from the old and the new
interactive-tx session, which leads to a duplicate `serial_id`.
@t-bast t-bast requested a review from pm47 October 30, 2023 12:56
@codecov-commenter
Copy link

codecov-commenter commented Oct 30, 2023

Codecov Report

Merging #2769 (24c29d9) into master (9ca9227) will increase coverage by 0.01%.
Report is 1 commits behind head on master.
The diff coverage is 100.00%.

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

@@            Coverage Diff             @@
##           master    #2769      +/-   ##
==========================================
+ Coverage   85.84%   85.85%   +0.01%     
==========================================
  Files         216      216              
  Lines       18102    18095       -7     
  Branches      762      777      +15     
==========================================
- Hits        15540    15536       -4     
+ Misses       2562     2559       -3     
Files Coverage Δ
...re/src/main/scala/fr/acinq/eclair/NodeParams.scala 93.39% <100.00%> (-0.03%) ⬇️
...inq/eclair/channel/fund/InteractiveTxBuilder.scala 91.54% <100.00%> (+0.04%) ⬆️
...cinq/eclair/remote/EclairInternalsSerializer.scala 97.82% <100.00%> (ø)
...scala/fr/acinq/eclair/router/BalanceEstimate.scala 98.93% <100.00%> (ø)
.../src/main/scala/fr/acinq/eclair/router/Graph.scala 97.25% <100.00%> (-0.09%) ⬇️
...cala/fr/acinq/eclair/router/RouteCalculation.scala 94.56% <100.00%> (ø)
...src/main/scala/fr/acinq/eclair/router/Router.scala 94.78% <100.00%> (ø)
...main/scala/fr/acinq/eclair/router/Validation.scala 93.75% <100.00%> (-1.25%) ⬇️

... and 4 files with indirect coverage changes

This lets us fix the race between the `Abort` sent from the `Channel` to
the `InteractiveTxBuilder` and the funding result sent from `bitcoind`
to the `InteractiveTxBuilder`.
@t-bast t-bast merged commit 12adf87 into master Nov 3, 2023
1 check passed
@t-bast t-bast deleted the avoid-duplicate-tx-add-input-reconnect branch November 3, 2023 13:29
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