mirror of
https://github.com/RoboSats/taptrade-core.git
synced 2025-07-29 06:03:14 +00:00
switch back to real escrow output in escrow tx
This commit is contained in:
@ -159,20 +159,22 @@ impl<D: bdk::database::BatchDatabase> CoordinatorWallet<D> {
|
|||||||
|
|
||||||
let (escrow_psbt, details) = {
|
let (escrow_psbt, details) = {
|
||||||
// maybe we can generate a address/taproot pk directly from the descriptor without a new wallet?
|
// maybe we can generate a address/taproot pk directly from the descriptor without a new wallet?
|
||||||
// let temp_wallet = Wallet::new(
|
let temp_wallet = Wallet::new(
|
||||||
// &escrow_output_descriptor,
|
&escrow_output_descriptor,
|
||||||
// None,
|
None,
|
||||||
// bitcoin::Network::Regtest,
|
bitcoin::Network::Regtest,
|
||||||
// MemoryDatabase::new(),
|
MemoryDatabase::new(),
|
||||||
// )?;
|
)?;
|
||||||
// let escrow_address = temp_wallet
|
let escrow_address = temp_wallet
|
||||||
// .get_address(bdk::wallet::AddressIndex::New)?
|
.get_address(bdk::wallet::AddressIndex::New)?
|
||||||
// .address;
|
.address;
|
||||||
let escrow_address =
|
|
||||||
Address::from_str(self.get_new_address().await?.as_str())?.assume_checked();
|
// dummy escrow address for testing the psbt signing flow
|
||||||
|
// let escrow_address =
|
||||||
|
// Address::from_str(self.get_new_address().await?.as_str())?.assume_checked();
|
||||||
|
|
||||||
// using absolute fee for now, in production we should come up with a way to determine the tx weight
|
// using absolute fee for now, in production we should come up with a way to determine the tx weight
|
||||||
// upfront and substract the fee from the change outputs
|
// upfront and substract the fee from the change outputs (10k == ~30/sat vbyte)
|
||||||
let tx_fee_abs = 10000;
|
let tx_fee_abs = 10000;
|
||||||
|
|
||||||
let change_amount_maker = maker_psbt_input_data.input_sum()?
|
let change_amount_maker = maker_psbt_input_data.input_sum()?
|
||||||
@ -182,9 +184,9 @@ impl<D: bdk::database::BatchDatabase> CoordinatorWallet<D> {
|
|||||||
|
|
||||||
let amount_escrow = escrow_amount_maker_sat + escrow_amount_taker_sat;
|
let amount_escrow = escrow_amount_maker_sat + escrow_amount_taker_sat;
|
||||||
|
|
||||||
let wallet = self.wallet.lock().await;
|
// let wallet = self.wallet.lock().await;
|
||||||
// let mut builder = temp_wallet.build_tx();
|
let mut builder = temp_wallet.build_tx();
|
||||||
let mut builder = wallet.build_tx();
|
// let mut builder = wallet.build_tx();
|
||||||
builder
|
builder
|
||||||
.manually_selected_only()
|
.manually_selected_only()
|
||||||
.add_recipient(escrow_address.script_pubkey(), amount_escrow)
|
.add_recipient(escrow_address.script_pubkey(), amount_escrow)
|
||||||
|
Reference in New Issue
Block a user