Unlock Coins on Anchor TX Broadcast Failure
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
SendStateBroadcastCompleteto 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.
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 | |
|---|---|
| Change from base Build 13373496688: | 0.0% |
| Covered Lines: | 27339 |
| Relevant Lines: | 66657 |
💛 - 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
@ffranr, remember to re-request review from reviewers when ready
!lightninglabs-deploy mute