mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-28 19:50:20 -05:00
parent
683d565679
commit
5463bde4f8
12 changed files with 135 additions and 13 deletions
|
|
@ -24,6 +24,7 @@ impl TxLock {
|
|||
amount: Amount,
|
||||
A: PublicKey,
|
||||
B: PublicKey,
|
||||
change: bitcoin::Address,
|
||||
) -> Result<Self>
|
||||
where
|
||||
C: EstimateFeeRate,
|
||||
|
|
@ -34,7 +35,9 @@ impl TxLock {
|
|||
.address(wallet.get_network())
|
||||
.expect("can derive address from descriptor");
|
||||
|
||||
let psbt = wallet.send_to_address(address, amount).await?;
|
||||
let psbt = wallet
|
||||
.send_to_address(address, amount, Some(change))
|
||||
.await?;
|
||||
|
||||
Ok(Self {
|
||||
inner: psbt,
|
||||
|
|
@ -251,7 +254,11 @@ mod tests {
|
|||
wallet: &Wallet<(), bdk::database::MemoryDatabase, StaticFeeRate>,
|
||||
amount: Amount,
|
||||
) -> PartiallySignedTransaction {
|
||||
TxLock::new(&wallet, amount, A, B).await.unwrap().into()
|
||||
let change = wallet.new_address().await.unwrap();
|
||||
TxLock::new(&wallet, amount, A, B, change)
|
||||
.await
|
||||
.unwrap()
|
||||
.into()
|
||||
}
|
||||
|
||||
fn alice_and_bob() -> (PublicKey, PublicKey) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue