Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

- ASB+CONTROLLER: `get-swaps` now includes the `btc_punish_txid` per swap: the Bitcoin punish transaction id. This is deterministic from the swap's locked state, so it is set even before the punish transaction is published.

## [4.6.5] - 2026-05-26

## [4.6.4] - 2026-05-21
Expand Down
3 changes: 3 additions & 0 deletions swap-controller-api/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ pub struct Swap {
/// Bitcoin redeem transaction id. Deterministic from the swap's locked state,
/// so this is set even before the redeem transaction is published.
pub btc_redeem_txid: String,
/// Bitcoin punish transaction id. Deterministic from the swap's locked state,
/// so this is set even before the punish transaction is published.
pub btc_punish_txid: String,
pub peer_id: String,
pub completed: bool,
}
Expand Down
2 changes: 2 additions & 0 deletions swap-controller/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ async fn dispatch(cmd: Cmd, client: impl AsbApiClient) -> anyhow::Result<()> {
"Rate (BTC/XMR)",
"BTC Redeem Fee",
"BTC Redeem TxID",
"BTC Punish TxID",
"Peer ID",
"Completed",
]);
Expand All @@ -110,6 +111,7 @@ async fn dispatch(cmd: Cmd, client: impl AsbApiClient) -> anyhow::Result<()> {
&swap.exchange_rate.to_string(),
&swap.btc_redeem_fee.to_string(),
&swap.btc_redeem_txid,
&swap.btc_punish_txid,
&swap.peer_id,
&swap.completed.to_string(),
]);
Expand Down
4 changes: 4 additions & 0 deletions swap-core/src/bitcoin/punish.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ impl TxPunish {
self.digest
}

pub fn txid(&self) -> Txid {
self.inner.compute_txid()
}

pub fn complete(
self,
tx_punish_sig_bob: bitcoin::Signature,
Expand Down
2 changes: 1 addition & 1 deletion swap-machine/src/alice/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1051,7 +1051,7 @@ impl State3 {
}
}

fn tx_punish(&self) -> TxPunish {
pub fn tx_punish(&self) -> TxPunish {
swap_core::bitcoin::TxPunish::new(
&self.tx_cancel(),
&self.punish_address,
Expand Down
1 change: 1 addition & 0 deletions swap/src/asb/rpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,7 @@ impl AsbApiServer for RpcImpl {
exchange_rate,
btc_redeem_fee: state3.tx_redeem_fee,
btc_redeem_txid: state3.tx_redeem().txid().to_string(),
btc_punish_txid: state3.tx_punish().txid().to_string(),
peer_id: peer_id.to_string(),
completed: is_complete(&current_alice),
});
Expand Down
Loading