fix(sell-bitbox): make deposit retry idempotent — never re-broadcast a sent tx#682
Open
joshuakrueger-dfx wants to merge 1 commit into
Conversation
…a sent tx _broadcastDepositAndConfirm broadcast the deposit tx and then confirmed the payment in one try/catch, emitting SellBitboxDepositRetry on ANY failure. When the broadcast succeeded but the confirmation failed, retryDeposit re-ran the whole helper and re-broadcast the already-on-chain deposit transaction — a duplicate send and a perpetual retry loop. Split broadcast from confirm and carry the resulting txHash in the retry state: - broadcast failure → retry may broadcast again (broadcastTxHash == null) - confirm failure after a successful broadcast → retry confirms ONLY using the stored txHash, never re-broadcasting (broadcastTxHash != null) Regressions: sell_bitbox_cubit_test.dart (confirm-only retry asserts verifyNever(broadcastTransaction); broadcast-failure retry still broadcasts) + sell_bitbox_state_test.dart (broadcastTxHash in props). Issue RealUnitCH#657 — Part 4, finding BB1 (HIGH, financial).
c8ac1ac to
f0d932c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Addresses Issue #657 — Part 4, finding BB1 (HIGH, financial).
Problem
_broadcastDepositAndConfirmbroadcast the deposit tx and confirmed the payment in onetry/catch, emittingSellBitboxDepositRetryon any failure. When the broadcast succeeded but the confirmation failed,retryDepositre-ran the whole helper and re-broadcast the already-on-chain deposit transaction — a duplicate send and a perpetual retry loop.Fix
Split broadcast from confirm and carry the resulting
txHashin the retry state:broadcastTxHash == null)broadcastTxHash != null)Tests (RED→GREEN, proven)
confirm-only retryassertsverifyNever(broadcastTransaction)after a confirm failure;broadcast-failure retrystill re-broadcasts. The RED case fails on the old code (verified). Full sell-bitbox suite 68/68 green,flutter analyzeclean.🤖 Big Brother fleet flagged + operator hand-finish. Ref #657.