Browse Source

The wallet should check if the passed-in address has correct network

debug-collab-settlement
bonomat 3 years ago
parent
commit
7344a4ee89
No known key found for this signature in database GPG Key ID: E5F8E74C672BC666
  1. 12
      daemon/src/wallet.rs

12
daemon/src/wallet.rs

@ -177,6 +177,17 @@ impl Actor {
}
pub async fn handle_withdraw(&self, msg: Withdraw) -> Result<Txid> {
{
let wallet = self.wallet.lock().await;
if msg.address.network != wallet.network() {
bail!(
"Address has invalid network. It was {} but the wallet is connected to {}",
msg.address.network,
wallet.network()
)
}
}
let fee_rate = msg.fee.unwrap_or_else(FeeRate::default_min_relay_fee);
let address = msg.address;
@ -191,6 +202,7 @@ impl Actor {
tracing::info!(%amount, %address, "Amount to be sent to address");
let wallet = self.wallet.lock().await;
let mut tx_builder = wallet.build_tx();
tx_builder

Loading…
Cancel
Save