Skip to content
This repository has been archived by the owner on Dec 4, 2024. It is now read-only.

Commit

Permalink
fix: use proper bitcoin network when building withdrawal txs (#296)
Browse files Browse the repository at this point in the history
  • Loading branch information
stjepangolemac authored Oct 17, 2023
1 parent 1afab96 commit eac5a87
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
4 changes: 1 addition & 3 deletions sbtc-cli/src/commands/withdraw.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,6 @@ pub fn build_withdrawal_tx(withdrawal: &WithdrawalArgs) -> anyhow::Result<()> {

wallet.sync(&blockchain, SyncOptions::default())?;

let broadcaster_bitcoin_private_key =
PrivateKey::from_wif(&withdrawal.wif)?;
let drawee_stacks_private_key =
PrivateKey::from_wif(&withdrawal.drawee_wif)?.inner;
let payee_bitcoin_address =
Expand All @@ -86,7 +84,7 @@ pub fn build_withdrawal_tx(withdrawal: &WithdrawalArgs) -> anyhow::Result<()> {

let tx = sbtc_core::operations::op_return::withdrawal_request::build_withdrawal_tx(
&wallet,
broadcaster_bitcoin_private_key,
withdrawal.network,
drawee_stacks_private_key,
payee_bitcoin_address,
sbtc_wallet_bitcoin_address,
Expand Down
8 changes: 4 additions & 4 deletions sbtc-core/src/operations/op_return/withdrawal_request.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,8 @@ use bdk::{
blockdata::{opcodes::all::OP_RETURN, script::Instruction},
psbt::PartiallySignedTransaction,
secp256k1::{ecdsa::RecoverableSignature, Message, Secp256k1},
Address as BitcoinAddress, Network as BitcoinNetwork,
PrivateKey as BitcoinPrivateKey, Script, Transaction,
Address as BitcoinAddress, Network as BitcoinNetwork, Script,
Transaction,
},
database::BatchDatabase,
SignOptions, Wallet,
Expand Down Expand Up @@ -185,7 +185,7 @@ pub struct WithdrawalRequestData {
/// Construct a withdrawal request transaction
pub fn build_withdrawal_tx(
wallet: &Wallet<impl BatchDatabase>,
broadcaster_bitcoin_private_key: BitcoinPrivateKey,
bitcoin_network: BitcoinNetwork,
drawee_stacks_private_key: StacksPrivateKey,
payee_bitcoin_address: BitcoinAddress,
sbtc_wallet_bitcoin_address: BitcoinAddress,
Expand All @@ -199,7 +199,7 @@ pub fn build_withdrawal_tx(
&sbtc_wallet_bitcoin_address,
amount,
fulfillment_fee,
broadcaster_bitcoin_private_key.network,
bitcoin_network,
)?;

wallet
Expand Down

0 comments on commit eac5a87

Please sign in to comment.