Spent a while figuring out where this new function should live now that
the PSBT stuff has been pulled into src/psbt.cpp and the wallet, and isn't
mixed up with the RPC logic.
In the end I modified the the function to return a normal error rather
than throwing an RPC exception and put it in src/psbt.cpp with the other
functions that behave this way.
Fixes the change-size estimation bug that I fixed in #17290, though incompletely
(Steven made up a size for the surjection proof which was different from the
size that I made up....this time I actually checked with libsecp to get an upper
bound.) He also found another place we were doing the wrong estimation, which
I had missed on my pass. So between the two of us I think we've done some good.
Also moves some which sets code coin_selection_params.tx_noinputs_size to after
some Elements sanity checks, which I think will have zero observable effect
(or non-observable effect) but it's part of the PR so I'm keeping it. Though
updated since we can now use BnB even with subtract-fee-from-output.
This one took a little bit of work. Basically everywhere that Andy's new code
didn't compile, I looked for a similarly shaped line in the pre-PR diff between
Bitcoin and Elements and adjusted it in the same way. Was pretty typical; all
CAmounts become CAmountMaps, etc.
I then spent about 7 hours chasing down a coin selection failure in the blocksign
functional tests, which ultimately turned out to be a Core issue. I added a
stopgap fix (commented, search for "stopgap" in wallet.cpp), and opened the issue
https://github.com/bitcoin/bitcoin/issues/20347
There was also a bug where we were not estimating change output sizes correctly
in case we had massive blinded outputs, which I had to fix to get the functional
tests to pass.
When we decode or sign a PSBT given to us via RPC, first check that, if
it contains blinded output values, they verifiably match the unblinded
output values contained in the original transaction proposal. Otherwise fail.
34ef25072 Move GetNumIssuances to issuance.cpp (Steven Roose)
f9925853c Remove the GetNumIssuances in the assertion (Steven Roose)
Pull request description:
This is in response to @dgpv 's https://github.com/ElementsProject/elements/issues/842.
I'm not 100% confident this is correct, but it seems so. It also passed all tests on my machine.
Tree-SHA512: 65206ac5e464a222b379043ca7943e9764382d25db6afc3ade89a1c637404c9f902d9ac21e1671722f1a29592a135b69c2c9164932958929d6a6588a12a14ac2