taproot-assets icon indicating copy to clipboard operation
taproot-assets copied to clipboard

Unlock Coins on Anchor TX Broadcast Failure

Open ffranr opened this issue 11 months ago • 4 comments

This PR ensures that asset coins are properly unlocked if an error occurs during the anchor transaction broadcast process. Previously, failed broadcasts could leave coins locked, causing send attempts to be stuck.

Key changes:

  • Unlock asset coins before returning an error when publishing an anchor transaction.
  • Ensure inputs are unlocked if an error occurs before reaching the broadcast complete state.
  • Introduce SendStateBroadcastComplete to better define when a transfer can be canceled.
  • Improve logging by reporting the final fee rate of the anchoring transaction and logging the wallet's minimum relay fee for better debugging.

ffranr avatar Feb 03 '25 16:02 ffranr

Pull Request Test Coverage Report for Build 13379509732

Details

  • 0 of 28 (0.0%) changed or added relevant lines in 4 files are covered.
  • 32 unchanged lines in 6 files lost coverage.
  • Overall coverage remained the same at 41.014%

Changes Missing Coverage Covered Lines Changed/Added Lines %
itest/assertions.go 0 1 0.0%
tapfreighter/parcel.go 0 2 0.0%
tapfreighter/wallet.go 0 8 0.0%
tapfreighter/chain_porter.go 0 17 0.0%
<!-- Total: 0 28
Files with Coverage Reduction New Missed Lines %
tapgarden/planter.go 2 64.98%
tappsbt/create.go 2 53.22%
tapfreighter/chain_porter.go 4 0.0%
tapgarden/caretaker.go 4 68.11%
commitment/tap.go 5 83.64%
universe/interface.go 15 50.65%
<!-- Total: 32
Totals Coverage Status
Change from base Build 13373496688: 0.0%
Covered Lines: 27339
Relevant Lines: 66657

💛 - Coveralls

coveralls avatar Feb 03 '25 16:02 coveralls

I think before broadcast, we can call into CheckMempoolAccept, then only broadcast if that returns that it's likely to be accepted.

Here's an example in lnd: https://github.com/lightningnetwork/lnd/blob/6bf895aeb929fb64265bfb226f796392921d8d3a/lnwallet/btcwallet/btcwallet.go#L1928-L1957

Roasbeef avatar Feb 04 '25 19:02 Roasbeef

@ffranr, remember to re-request review from reviewers when ready

lightninglabs-deploy avatar Jun 18 '25 06:06 lightninglabs-deploy

!lightninglabs-deploy mute

guggero avatar Jun 18 '25 06:06 guggero