Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/21283. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. |
src/rpc/rawtransaction.cpp
Outdated
| result.pushKV("input_count", psbtx.inputs.size()); | ||
| result.pushKV("output_count", psbtx.inputs.size()); |
There was a problem hiding this comment.
Getting a compile error consistent with the CI for these two lines:
rpc/rawtransaction.cpp:1192:16: error: call to member function 'pushKV' is ambiguous
result.pushKV("input_count", psbtx.inputs.size());
~~~~~~~^~~~~~
./univalue/include/univalue.h:127:10: note: candidate function
bool pushKV(const std::string& key, int64_t val_) {
^
./univalue/include/univalue.h:131:10: note: candidate function
bool pushKV(const std::string& key, uint64_t val_) {
^
./univalue/include/univalue.h:135:10: note: candidate function
bool pushKV(const std::string& key, bool val_) {
^
./univalue/include/univalue.h:139:10: note: candidate function
bool pushKV(const std::string& key, int val_) {
^
./univalue/include/univalue.h:143:10: note: candidate function
bool pushKV(const std::string& key, double val_) {
^
./univalue/include/univalue.h:118:10: note: candidate function
bool pushKV(const std::string& key, const UniValue& val);
^
./univalue/include/univalue.h:119:10: note: candidate function not viable: no known conversion from 'std::__1::vector<PSBTInput, std::__1::allocator<PSBTInput> >::size_type' (aka 'unsigned long') to 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') for 2nd argument
bool pushKV(const std::string& key, const std::string& val_) {
^
./univalue/include/univalue.h:123:10: note: candidate function not viable: no known conversion from 'std::__1::vector<PSBTInput, std::__1::allocator<PSBTInput> >::size_type' (aka 'unsigned long') to 'const char *' for 2nd argument
bool pushKV(const std::string& key, const char *val_) {
^
rpc/rawtransaction.cpp:1193:16: error: call to member function 'pushKV' is ambiguous
result.pushKV("output_count", psbtx.inputs.size());
~~~~~~~^~~~~~
./univalue/include/univalue.h:127:10: note: candidate function
bool pushKV(const std::string& key, int64_t val_) {
^
./univalue/include/univalue.h:131:10: note: candidate function
bool pushKV(const std::string& key, uint64_t val_) {
^
./univalue/include/univalue.h:135:10: note: candidate function
bool pushKV(const std::string& key, bool val_) {
^
./univalue/include/univalue.h:139:10: note: candidate function
bool pushKV(const std::string& key, int val_) {
^
./univalue/include/univalue.h:143:10: note: candidate function
bool pushKV(const std::string& key, double val_) {
^
./univalue/include/univalue.h:118:10: note: candidate function
bool pushKV(const std::string& key, const UniValue& val);
^
./univalue/include/univalue.h:119:10: note: candidate function not viable: no known conversion from 'std::__1::vector<PSBTInput, std::__1::allocator<PSBTInput> >::size_type' (aka 'unsigned long') to 'const std::string' (aka 'const basic_string<char, char_traits<char>, allocator<char> >') for 2nd argument
bool pushKV(const std::string& key, const std::string& val_) {
^
./univalue/include/univalue.h:123:10: note: candidate function not viable: no known conversion from 'std::__1::vector<PSBTInput, std::__1::allocator<PSBTInput> >::size_type' (aka 'unsigned long') to 'const char *' for 2nd argument
bool pushKV(const std::string& key, const char *val_) {
^
2 errors generated.
There was a problem hiding this comment.
I can't replicate this error at all, but I think I have fixed it.
21c991c to
76ea5cc
Compare
c13bfdd to
c50746a
Compare
Helper for getting the PSBTInput COutPoint
Use v2 for other RPCs. For some tests to work, PSBTv0 is set explicitly.
If we are asked to make a PSBTv0, we may not necessarily have made an unsigned transaction. So instead use GetUnsignedTx which will either fetch one that already exists, or construct a new one from the stored data. Internally we may be storing a PSBTv0 like a PSBTv2, but still want to serialize those as v0.
|
In 20 days it will have been 5 years since this PR was open. Let's try to re-gain some momentum around reviewing this? If a few other regular contributors volunteer to review this, i will commit to review it too. Some (re?)testing from users and outside contributors could be useful too. |
| assert len(psbt.tx.vin) == 1 | ||
| assert len(psbt.tx.vout) == 1 | ||
| assert len(psbt.i) == 1 | ||
| assert len(psbt.i) == 1 |
There was a problem hiding this comment.
Should this be psbt.o instead of psbt.i here?
| if (amount == std::nullopt) { | ||
| throw std::ios_base::failure("Output amount is required in PSBTv2"); | ||
| } | ||
| if (!script.has_value()) { |
There was a problem hiding this comment.
PSBT_OUT_SCRIPT is not required in BIP375. Should we address that here, or is it out of scope for this PR?
BIP 370 PSBTv2 introduces several new fields and different invariants for PSBT. This PR implements those new fields and restructures the PSBT implementation to match PSBTv2 but still remain compatible with PSBTv0.