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:

  1. Making ExitTxStatus describe observed transaction state, not machine actions. States now read as facts about the chain/mempool, not instructions for the machine.

  2. Introducing a pause point (AwaitingCpfpBroadcast) where the state machine halts and waits for the caller to supply a signed CPFP via Exit::provide_cpfp_tx. Callers discover pending requests through Exit::exits_needing_cpfp.

  3. Removing onchain: &mut dyn ExitUnilaterally from all progress() 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
Confirmed

After:

VerifyInputs
AwaitingInputConfirmation
AwaitingCpfpBroadcast      ← paused; caller must provide a CPFP
AwaitingConfirmation       ← package is in mempool; awaiting confirmation
Confirmed

AwaitingConfirmation 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/)

Merge request reports

Loading