Bitcoin network check when building PSBT

This ensures that funds are not sent to an address on the wrong network.
no-transfer-proof-failure
Daniel Karzel 3 years ago
parent ca6cb0a76a
commit 102cec437e
No known key found for this signature in database
GPG Key ID: 30C3FC2E438ADB6E

@ -7,6 +7,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [Unreleased]
### Fixed
- An issue where ASB Bitcoin withdrawal can be done to an address on the wrong network.
A network check was added that compares the wallet's network against the network of the given address when building the transaction.
## [0.6.0] - 2021-05-24
### Added

@ -303,6 +303,10 @@ where
address: Address,
amount: Amount,
) -> Result<PartiallySignedTransaction> {
if self.network != address.network {
bail!("Cannot build PSBT because network of given address is {} but wallet is on network {}", address.network, self.network);
}
let wallet = self.wallet.lock().await;
let client = self.client.lock().await;
let fee_rate = client.estimate_feerate(self.target_block)?;

Loading…
Cancel
Save