-
Notifications
You must be signed in to change notification settings - Fork 44
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
write integration test for taker cli app. #244
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach Ack.
Needs restructuring.
93f0a76
to
886fb5d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Approach Ack.
Some more fixes.
src/bin/taker.rs
Outdated
/// Recipient address | ||
#[clap(name = "address")] | ||
address: String, | ||
/// Amount to be sent (in satoshis) | ||
#[clap(name = "amount")] | ||
amount: u64, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need a fee
in this structure itself. That's not the same as the coinswap fee. Then use the fee used here to create the tx.
src/bin/taker.rs
Outdated
// Assuming fee=fee_rate | ||
// TODO: find a way to derive fee. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No fee and fee_rate is different. Doing fee_rate is difficult, because fee = fee_rate * tx_weight
. And we don't know the tx_weight
before signing the transaction. But we need the fee
to create the outputs before signing the tx.
So it becomes a chicken and egg style problem.
One way to solve this is to pre-estimate the tx_weight
, which is possible because its always single-sig p2wpkh type, which has a constant size of tx input.
This will get solved by BDK as it internally knows how to estimate input size from the descriptor.
For our purpose now having just the fee
is will work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Whenever we create any sort of tx like
funding
,contract
tx -> we takefee-rate
in function parameters
coinswap/src/protocol/contract.rs
Line 382 in 7996388
pub fn create_senders_contract_tx( |
coinswap/src/wallet/funding.rs
Line 123 in 7996388
fn create_funding_txes_random_amounts( |
-
Right now , we do not calculate
fee
of a tx , so we just assumefee= fee_rate
. -
So we should also do the same for
spend_from_wallet
api which is currently takingfee
as parameter.
coinswap/src/wallet/direct_send.rs
Line 67 in 7996388
pub fn spend_from_wallet( -
IMO, it seems irrational from user perspective to give
fee
as argument while callingsend-to-addresss
.
886fb5d
to
c0bcbd7
Compare
f28e54c
to
87d26cb
Compare
87d26cb
to
462ba1e
Compare
fixes #207