Skip to content
This repository has been archived by the owner on Jul 17, 2023. It is now read-only.

Fix estimation of tx inputs #142

Open
altafan opened this issue Sep 22, 2022 · 1 comment
Open

Fix estimation of tx inputs #142

altafan opened this issue Sep 22, 2022 · 1 comment

Comments

@altafan
Copy link
Contributor

altafan commented Sep 22, 2022

At the moment, the estimateTxSize function expects a simple numInputs arg becuase it assumes all inputs are of type p2wpkh | p2sh(p2wpkh), therefore the estimation for txs that include other types of inputs may not be accurate.

This can be fixed by expecting a list of input script types + 2 lists of auxiliary redeeem script sizes and witness sizes instead of the numInputs one. The auxiliary arrays can be easily reconstructed from a pset in wallet.buildTx, or properly crafted from wallet info in wallet.sendTx

Take a look here for a reference implementation.

@tiero
Copy link
Member

tiero commented Oct 11, 2022

Duplicated of this #113

Closing that since less detailed.

NOTICE: reference implementation do not support OP_RETURN and PUSHDATA weighting

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants