mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-29 20:16:33 -05:00
Split bitcoin::Wallet functions into various impl blocks
This allows us to construct instances of bitcoin::Wallet for test purposes that use a different blockchain and database implementation. We also parameterize the electrum-client to make it possible to construct a bitcoin::Wallet for tests that doesn't have one. This is necessary because the client validates the connection as it is constructed and we don't want to provide an Electrum backend for unit tests.
This commit is contained in:
parent
b9d8cbeaa2
commit
8576894c10
2 changed files with 126 additions and 107 deletions
|
|
@ -21,7 +21,7 @@ impl TxLock {
|
|||
pub async fn new(wallet: &Wallet, amount: Amount, A: PublicKey, B: PublicKey) -> Result<Self> {
|
||||
let lock_output_descriptor = build_shared_output_descriptor(A.0, B.0);
|
||||
let address = lock_output_descriptor
|
||||
.address(wallet.get_network().await)
|
||||
.address(wallet.get_network())
|
||||
.expect("can derive address from descriptor");
|
||||
|
||||
let psbt = wallet.send_to_address(address, amount).await?;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue