Browse Source
The wallet should check if the passed-in address has correct network
debug-collab-settlement
bonomat
3 years ago
No known key found for this signature in database
GPG Key ID: E5F8E74C672BC666
1 changed files with
12 additions and
0 deletions
-
daemon/src/wallet.rs
|
@ -177,6 +177,17 @@ impl Actor { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
pub async fn handle_withdraw(&self, msg: Withdraw) -> Result<Txid> { |
|
|
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 fee_rate = msg.fee.unwrap_or_else(FeeRate::default_min_relay_fee); |
|
|
let address = msg.address; |
|
|
let address = msg.address; |
|
|
|
|
|
|
|
@ -191,6 +202,7 @@ impl Actor { |
|
|
tracing::info!(%amount, %address, "Amount to be sent to address"); |
|
|
tracing::info!(%amount, %address, "Amount to be sent to address"); |
|
|
|
|
|
|
|
|
let wallet = self.wallet.lock().await; |
|
|
let wallet = self.wallet.lock().await; |
|
|
|
|
|
|
|
|
let mut tx_builder = wallet.build_tx(); |
|
|
let mut tx_builder = wallet.build_tx(); |
|
|
|
|
|
|
|
|
tx_builder |
|
|
tx_builder |
|
|