Skip to content
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

More tests for bdk_electrum fee calculation #1444

Open
evanlinjin opened this issue May 15, 2024 · 2 comments · May be fixed by #1685
Open

More tests for bdk_electrum fee calculation #1444

evanlinjin opened this issue May 15, 2024 · 2 comments · May be fixed by #1685

Comments

@evanlinjin
Copy link
Member

PR #1443 identified a large oversight when we added the new feature of including prev txouts for fee calculation.

I propose a separate test specific to testing fee calculation that takes into account what @ValuedMammal mentioned in #1443 (comment):

In the integration test for electrum the outpoint we're looking for will always have a vout of 0 (they are coinbase txs), so calculating the fee of the received tx happens to work by sheer luck. A more robust test would involve controlling the utxo spent by Core and in which order it appears in the tx which is posing more of a challenge.

Originally posted by @evanlinjin in #1443 (comment)

@evanlinjin evanlinjin added this to BDK May 15, 2024
@notmandatory notmandatory moved this to Todo in BDK May 15, 2024
@notmandatory notmandatory added this to the 1.0.0-beta milestone May 15, 2024
@ValuedMammal
Copy link
Contributor

calculating the fee of the received tx happens to work by sheer luck

Correction: not by luck, but because the outpoint is determined to have a vout of 0 and before the fix we're always inserting the first txout.

After sleeping on it I think one way to do this is to send a "preliminary" tx to an address in Core's wallet such that the output created becomes the input of the next tx. This preliminary tx is the prev_tx that needs to be fetched in order to calculate the fee of the tx sent to the receiver. This way is better because the required outpoint is less determined. Then we assert we have the right (outpoint, txout) in the update TxGraph. Example ValuedMammal/bdk@953dbb3

@f3r10
Copy link

f3r10 commented Nov 12, 2024

hi @ValuedMammal @notmandatory could I work on this issue?

@f3r10 f3r10 linked a pull request Nov 13, 2024 that will close this issue
3 tasks
@notmandatory notmandatory removed this from the 1.0.0-beta milestone Nov 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Todo
Development

Successfully merging a pull request may close this issue.

4 participants