Persist stuck-transaction monitoring across restarts - #4296
mswilkison wants to merge 2 commits into
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Team Run ID: 📒 Files selected for processing (7)
Included review availability: Your plan provides up to 2 included reviews per hour; 1 remains after this review. 📝 WalkthroughWalkthroughThe stuck-transaction monitor now persists tracked transactions in work storage, restores them during node construction, and retries failed saves and deletions. Records retain broadcast times and alert state across restarts. Tests cover recovery, validation, failures, capacity, and concurrency. ChangesTransaction Monitor Persistence
Estimated code review effort: 4 (Complex) | ~45 minutes Merge Risk: ⚪ Minimal · up to Persistence, restoration, retry, cleanup, and restart behavior are covered without an identified merge-blocking regression. Sequence Diagram(s)sequenceDiagram
participant Node
participant TransactionMonitor
participant WorkPersistence
participant BitcoinChain
Node->>TransactionMonitor: Construct with work persistence
TransactionMonitor->>WorkPersistence: Restore tracked transactions
TransactionMonitor->>WorkPersistence: Persist registration and alert state
TransactionMonitor->>BitcoinChain: Check confirmation status
TransactionMonitor->>WorkPersistence: Retry failed saves or deletions
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Full details: Docstring CoverageExplanation Docstring coverage is 20.83% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 6 files. (1 skipped: 1 unsupported.)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Wallet transactions broadcast before a node restart disappeared from the stuck-transaction monitor. Persist the tracked set in the node's encrypted tBTC work storage and restore it synchronously during node construction, before monitoring or wallet coordination starts.
Original broadcast times and alert state survive restarts, so downtime counts toward the existing stuck threshold and maximum tracking age. Confirmed and expired entries are removed from storage. Separate initial and alerted records preserve the original registration if an alert write is interrupted. Failed saves and deletes are logged and retried in a separate local pass before the confirmation budget starts, so a slow Bitcoin backend cannot starve storage recovery. Corrupt or unreadable records do not prevent recovery of healthy entries, and the existing tracking limit remains enforced.
Update the operator documentation to explain that this work data must survive restarts and cannot be reconstructed after loss. Transactions broadcast by an older, memory-only version cannot be recovered retroactively.
Validation:
go test -race -ldflags=-checklinkname=0 ./pkg/tbtc -run '^Test(TransactionMonitor|Node_RestoresTransactionMonitor)' -count=1 -timeout=3mpasses, including node startup with encrypted storage.go vet ./pkg/tbtcandstaticcheck -checks=inherit,-SA1019 ./pkg/tbtcpass; changed Go files are formatted.go test -ldflags=-checklinkname=0 ./pkg/tbtc -count=1 -timeout=15mpasses.go vet ./...reports an existing copy-of-lock warning atpkg/tecdsa/signing/protocol.go:737, an unchanged line also present onmain.Fixes #4175.
Summary by CodeRabbit
New Features
Documentation