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

Better handling of remote commit confirmation in TxPublisher #1905

Merged
merged 2 commits into from
Aug 23, 2021

Conversation

t-bast
Copy link
Member

@t-bast t-bast commented Aug 12, 2021

This PR is split in two independent commits.

In the first commit, we fix a (harmless) issue where we kept spawning TxPublisher actors to spend anchor outputs even when the commit tx was confirmed if the feerate was already high enough. This was spamming the logs for no reason (and spawning actors that immediately stopped themselves), we should instead check the status of the commit tx as the first precondition to spending anchor outputs.

In the second commit, we call bitcoind's abandontransaction when 2nd-stage txs are evicted from the mempool because their parent is replaced (e.g. the remote commit tx is confirmed instead of our local commit tx). This ensures the bitcoind wallet will not keep these obsolete transactions in its DB and reserve their inputs for no good reason.

Fixes #1898

@t-bast t-bast requested a review from pm47 August 12, 2021 14:50
@codecov-commenter
Copy link

codecov-commenter commented Aug 12, 2021

Codecov Report

Merging #1905 (7a1ce33) into master (4cde8c5) will increase coverage by 0.02%.
The diff coverage is 84.00%.

@@            Coverage Diff             @@
##           master    #1905      +/-   ##
==========================================
+ Coverage   87.48%   87.51%   +0.02%     
==========================================
  Files         159      159              
  Lines       12086    12088       +2     
  Branches      487      515      +28     
==========================================
+ Hits        10574    10579       +5     
+ Misses       1512     1509       -3     
Impacted Files Coverage Δ
...clair/channel/publish/ReplaceableTxPublisher.scala 87.05% <83.33%> (+0.07%) ⬆️
...lockchain/bitcoind/rpc/ExtendedBitcoinClient.scala 91.42% <100.00%> (+0.25%) ⬆️
...cinq/eclair/channel/publish/MempoolTxMonitor.scala 84.41% <0.00%> (+3.89%) ⬆️

t-bast added 2 commits August 16, 2021 10:45
We used to check the feerate before checking whether the commit tx was
already confirmed: when the commit feerate was good enough, we would
respawn a publish actor every block whereas the commit tx was already
confirmed.
This ensures the bitcoind wallet won't keep the transaction around and
avoid using its inputs for other transactions.

Fixes #1898
@t-bast t-bast force-pushed the tx-publisher-improvements branch from 1b3dbda to 7a1ce33 Compare August 16, 2021 08:47
@t-bast t-bast merged commit c504658 into master Aug 23, 2021
@t-bast t-bast deleted the tx-publisher-improvements branch August 23, 2021 08:21
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.

Abandon anchor tx when competing commit tx has been confirmed
3 participants