-
Notifications
You must be signed in to change notification settings - Fork 296
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
fix(electrum): Fix fetch_prev_txout
#1443
fix(electrum): Fix fetch_prev_txout
#1443
Conversation
Previously we inserted every TxOut of a previous tx at the same outpoint, which is incorrect because an outpoint only points to a single TxOut. Now just get the TxOut corresponding to the txin prevout and insert it with its outpoint.
This looks like the right solution but Is it possible to create a test that fails before the change and passes after? I'd like to make sure an issue like this doesn't sneak in again. |
Would it also make sense to fix |
As I understand the behavior of |
Damn this is a huge oversight by @LagginTimes and myself. Thanks for taking this on. |
ACK af15ebb |
We definitely need more tests for this. We can add these tests in subsequent PRs. I propose a separate test specific to testing fee calculation that takes into account what @ValuedMammal mentioned in #1443 (comment):
|
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.
ACK af15ebb
Previously we inserted every
TxOut
of a previous tx at the same outpoint, which is incorrect because an outpoint only points to a singleTxOut
. Now just get theTxOut
corresponding to the txin prevout and insert it with its outpoint.Notes to the reviewers
The bug in question was demonstrated in a discord comment https://discord.com/channels/753336465005608961/1239693193159639073/1239704153400414298 but I don't think we've opened an issue yet. Essentially, because of a mismatch between the outpoint and txout stored in TxGraph, we weren't summing the inputs correctly which caused
calculate_fee
to fail withNegativeFee
error.fixes #1419
Checklists
All Submissions:
cargo fmt
andcargo clippy
before committingBugfixes: