Skip to content

Commit

Permalink
tapfreighter: unlock asset coins before err on tx broadcast fail
Browse files Browse the repository at this point in the history
Ensure locked asset coins are released before returning an error when
attempting to publish the anchor transaction. Without this change, if
the chain bridge logic determines the anchor transaction should not be
broadcast, the coins remain locked, leaving the send attempt stuck in
limbo.
  • Loading branch information
ffranr committed Feb 3, 2025
1 parent 1022c12 commit e0c9661
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions tapfreighter/chain_porter.go
Original file line number Diff line number Diff line change
Expand Up @@ -1391,6 +1391,10 @@ func (p *ChainPorter) stateStep(currentPkg sendPackage) (*sendPackage, error) {
"transaction %v: %w", txHash, err)

case err != nil:
// Unlock the inputs we locked for this transfer before
// returning the error.
p.unlockInputs(ctx, &currentPkg)

return nil, fmt.Errorf("unable to broadcast "+
"transaction %v: %w", txHash, err)
}
Expand Down

0 comments on commit e0c9661

Please sign in to comment.