bark: refactor unilateral exit state machine to be wallet-agnostic
The exit state machine previously coupled transaction signing, fee
estimation, and CPFP broadcasting into its own progress() steps.
This forced it to hold an ExitUnilaterally onchain wallet reference,
making it impossible to drive from a wallet-agnostic context (e.g. hardware wallets).
This branch decouples the state machine from the onchain wallet by:
-
Making
ExitTxStatusdescribe observed transaction state, not machine actions. States now read as facts about the chain/mempool, not instructions for the machine. -
Introducing a pause point (
AwaitingCpfpBroadcast) where the state machine halts and waits for the caller to supply a signed CPFP viaExit::provide_cpfp_tx. Callers discover pending requests throughExit::exits_needing_cpfp. -
Removing
onchain: &mut dyn ExitUnilaterallyfrom allprogress()signatures. Fee-rate policy, balance checks, and CPFP construction are now the caller's responsibility.
State machine changes
Before:
VerifyInputs
AwaitingInputConfirmation
NeedsSignedPackage ← create a CPFP
NeedsReplacementPackage ← create a replacement CPFP with higher fee
NeedsBroadcasting ← broadcast the package
BroadcastWithCpfp ← wait for confirmation
ConfirmedAfter:
VerifyInputs
AwaitingInputConfirmation
AwaitingCpfpBroadcast ← paused; caller must provide a CPFP
AwaitingConfirmation ← package is in mempool; awaiting confirmation
ConfirmedAwaitingConfirmation unifies NeedsBroadcasting and BroadcastWithCpfp.
The origin field distinguishes whether the CPFP was wallet-provided
(Wallet) or came from a third party (Mempool { fee_rate, total_fee });
the latter signals to callers that an RBF replacement may be worthwhile.
- check or remove this line after you've added a CHANGELOG entry or if your PR doesn't need one (they should go into
CHANGELOG/unreleased/)