Skip to content

chore: remove unused txout_weight_from_spk_len - #92

Open
chukwudiikeh wants to merge 1 commit into
bitcoindevkit:masterfrom
chukwudiikeh:remove-txout-weight-from-spk-len
Open

chukwudiikeh wants to merge 1 commit into
bitcoindevkit:masterfrom
chukwudiikeh:remove-txout-weight-from-spk-len

Conversation

@chukwudiikeh

Copy link
Copy Markdown

Fixes #91

txout_weight_from_spk_len overcounts output weight by 112 WU for every script length (284 WU for P2TR instead of 172, and nothing in the crate calls it.This PR removes it. If you'd rather keep it, I can fix the formula instead and add a test against bitcoin::TxOut::weight().

Fix:Removed the unused and incorrect txout_weight_from_spk_len helper.

txout_weight_from_spk_len multiplied TXOUT_BASE_WEIGHT, which is
already in weight units, by 4 again and counted the scriptPubKey
length prefix twice, so it overcounted every output by 112 WU (284 WU
for P2TR instead of 172). Nothing in the crate calls it, so remove it.

Fixes bitcoindevkit#91.
@chukwudiikeh

Copy link
Copy Markdown
Author

@evanlinjin opened this to remove the unused helper from #91. If you'd rather keep it as a corrected, tested function, let me know and I'll switch the PR over.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

txout_weight_from_spk_len overcounts output weight and is never used

1 participant