Implements PSBT_GLOBAL_VERSION, PSBT_GLOBAL_PROPRIETARY, PSBT_IN_PROPRIETARY, PSBT_OUT_PROPRIETARY, and PSBT_GLOBAL_XPUB. The PSBT_GLOBAL_XPUB changes are merged in from #16463.
Also includes the test vectors added to BIP 174 for these fields.
A number of additional changes to keypath and xpub serialization are made to support PSBT_GLOBAL_XPUB.
DrahtBot added the label
RPC/REST/ZMQ
on Oct 3, 2019
DrahtBot added the label
Tests
on Oct 3, 2019
DrahtBot
commented at 8:28 pm on October 3, 2019:
member
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
Conflicts
Reviewers, 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.
fanquake requested review from instagibbs
on Oct 8, 2019
fanquake requested review from meshcollider
on Oct 8, 2019
in
src/psbt.h:671
in
6ccda5b023outdated
463@@ -462,8 +464,9 @@ struct PartiallySignedTransaction
464 break;
465 }
466467- // First byte of key is the type
468- unsigned char type = key[0];
469+ // Type is compact size uint at beginning of key
470+ VectorReader skey(s.GetType(), s.GetVersion(), key, 0);
471+ uint64_t type = ReadCompactSize(skey);
instagibbs
commented at 3:52 pm on October 8, 2019:
Manually inspected that all the fields with constant types are now being written with compact size, but I would like to be more systematic somehow in the future.
instagibbs approved
instagibbs
commented at 3:59 pm on October 8, 2019:
member
cursory review ACK
DrahtBot added the label
Needs rebase
on Oct 9, 2019
achow101 force-pushed
on Oct 9, 2019
achow101 force-pushed
on Oct 9, 2019
DrahtBot removed the label
Needs rebase
on Oct 9, 2019
in
src/psbt.h:580
in
674e6382aboutdated
571@@ -496,6 +572,35 @@ struct PartiallySignedTransaction
572 }
573 break;
574 }
575+ case PSBT_GLOBAL_VERSION:
576+ {
577+ if (version) {
578+ throw std::ios_base::failure("Duplicate Key, version already provided");
579+ } else if (key.size() != 1) {
580+ throw std::ios_base::failure("Global verion key is more than one byte type");
ec06a2e9ff3a59a903b301a8b539f467a8d57077: BIP174 defines it as <32-bit uint>. So we should check key.size() > 4? Not that it matters much, since we trip over any version > 0.
23b45a66f3343fdf5315a8673ed898202fddf182: I assume that + 1 is here because <xpub> is encoded as CompactSize and is always shorter than 253 bytes (i.e. it’s always 78 bytes)? Still it seems cleaner to just deserialise it, rather than adding 1 everywhere.
I wish <keylen> would have been defined without the key type (i.e. keydatalen), but let’s not overhaul the BIP :-)
Sjors
commented at 1:09 pm on April 30, 2021:
member
tACK052d8c7
It would be nice to see testing by someone who actually uses the proprietary fields.
Followup suggestions:
populate the global_xpubs field for (a simple subset of) descriptors wallets.
run the new test vectors against Bitcoin Core v0.21.0 (shameless plug for #19013)
Note to other reviewers: the change to CompactSize in f90d63b does not make this standard backward incompatible, because all existing key types are less than 253. The new propreitary types (PSBT_IN_PROPRIETARY, etc) are safely set to 0xFC (252). See also https://github.com/bitcoin/bips/pull/1115
in
src/rpc/rawtransaction.cpp:998
in
26b0902ff0outdated
994@@ -995,6 +995,13 @@ static RPCHelpMan decodepsbt()
995 {RPCResult::Type::ELISION, "", "The layout is the same as the output of decoderawtransaction."},
996 }},
997 {RPCResult::Type::NUM, "psbt_version", "The PSBT version number. Not to be confused with the unsigned transaction version"},
998+ {RPCResult::Type::OBJ, "proprietary", "The global proprietary map",
546@@ -546,6 +547,9 @@ struct PSBTOutput
547 struct PartiallySignedTransaction
548 {
549 std::optional<CMutableTransaction> tx;
550+ // We use a vector of CExtPubKey in the event that there happens to be the same KeyOriginInfos for different CExtPubKeys
551+ // Note that this map swaps the key and values from the serialization
552+ std::map<KeyOriginInfo, std::set<CExtPubKey>> m_xpubs;
Sjors
commented at 8:24 am on May 12, 2021:
member
re-utACKbf9c50a modulo RPCResult::Type::ARR
Shouldn’t “The global proprietary map” for inputs and outputs also be an RPCResult::Type::ARR? And maybe label them “The input proprietary map” and “The output proprietary map” respectively.
achow101
commented at 6:45 pm on May 12, 2021:
member
Shouldn’t “The global proprietary map” for inputs and outputs also be an RPCResult::Type::ARR? And maybe label them “The input proprietary map” and “The output proprietary map” respectively.
Done
achow101 force-pushed
on May 12, 2021
achow101 force-pushed
on Oct 5, 2021
luke-jr referenced this in commit
20e5fed7b1
on Oct 10, 2021
luke-jr referenced this in commit
9c9ed7697c
on Oct 10, 2021
luke-jr referenced this in commit
e10d002b89
on Oct 10, 2021
luke-jr referenced this in commit
837ddbbb33
on Oct 10, 2021
luke-jr referenced this in commit
48a7020f24
on Oct 10, 2021
luke-jr referenced this in commit
16d296fd05
on Oct 10, 2021
luke-jr referenced this in commit
38086133f9
on Oct 10, 2021
luke-jr referenced this in commit
2f6c16b88e
on Oct 10, 2021
luke-jr referenced this in commit
7ac24f76b0
on Oct 10, 2021
luke-jr referenced this in commit
ebb4fdc770
on Oct 10, 2021
luke-jr referenced this in commit
a7705687cf
on Oct 10, 2021
luke-jr referenced this in commit
bd02b59d70
on Oct 10, 2021
luke-jr referenced this in commit
dab86d74f7
on Oct 10, 2021
luke-jr referenced this in commit
ca14f6034c
on Oct 10, 2021
luke-jr referenced this in commit
9e57c0ff2e
on Oct 10, 2021
DrahtBot added the label
Needs rebase
on Dec 3, 2021
darosior approved
darosior
commented at 2:31 pm on December 5, 2021:
member
I also have a branch implementing the various hash preimage input types, since it is needed for Miniscript signing support. Here it is rebased on this one since i figured it might make sense to have other input types implementations in this PR as well.
achow101 force-pushed
on Dec 5, 2021
DrahtBot removed the label
Needs rebase
on Dec 5, 2021
achow101 force-pushed
on Dec 5, 2021
achow101 force-pushed
on Dec 8, 2021
darosior
commented at 9:26 pm on December 8, 2021:
member
re-ACK198b080f1f5ddc7b698f6f6f3def4511ab2b4b83
in
test/functional/data/rpc_psbt.json:41
in
198b080f1foutdated
darosior
commented at 9:44 pm on December 8, 2021:
Actually, i think there is a duplicate between line 38 and 41 (my bad).
achow101
commented at 8:26 pm on December 9, 2021:
Removed the duplicate.
achow101 force-pushed
on Dec 9, 2021
Sjors
commented at 5:50 am on December 10, 2021:
member
re-utACKe75e52f7a2a82e24b20f59255cf39809342fcf58
darosior
commented at 8:26 am on December 10, 2021:
member
re-ACKe75e52f7a2a82e24b20f59255cf39809342fcf58
MarcoFalke removed the label
Tests
on Dec 10, 2021
DrahtBot added the label
Needs rebase
on Dec 10, 2021
Types are compact size uints3235847473
Implement PSBT versionsc3eb416b88
Add GetVersion helper to PSBTdf84fa99c5
Output psbt version in decodepsbt10ba0b593d
Implement PSBT proprietary typeaebe758e54
Output proprietary type info in decodepsbta4cf810174
Test for proprietary field94065cc6c5
moveonly: Move (Un)Serialize(To/From)Vector, (De)SerializeHDKeypaths to psbt module
SerializeToVector, UnserializeFromVector, DeserializeHDKeypaths, and SerializeHDKeypaths
were in sign.h where PSBT was originally implemented. Since all of the PSBT serialization
has moved to its own file, these functions should follow.
5fdaf6a2ad
Store version bytes and be able to serialize them in CExtPubKey
CExtPubKey does not store the version bytes for the extended public key.
We store these so that a CExtPubKey can be serialized and deserialized with
the same version bytes.
a69332fd89
Separate individual HD Keypath serialization into separate functionsd3dbb16168
Implement operator< for KeyOriginInfo and CExtPubKeyc5c63b8e4f
Implement serializations for PSBT_GLOBAL_XPUB903848562e
Add global_xpubs to decodepsbt35670df866
Add global xpub test vectors from BIPd8043ddf64
Merge global xpubs in joinpsbts and combinepsbts81521173ba
achow101 force-pushed
on Dec 10, 2021
DrahtBot removed the label
Needs rebase
on Dec 10, 2021
laanwj
commented at 9:45 pm on December 10, 2021:
member
This is a metadata mirror of the GitHub repository
bitcoin/bitcoin.
This site is not affiliated with GitHub.
Content is generated from a GitHub metadata backup.
generated: 2024-12-18 15:12 UTC
This site is hosted by @0xB10C More mirrored repositories can be found on mirror.b10c.me