Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BIP 174] Implement serialization support for GLOBAL_XPUB field. #16463

wants to merge 8 commits into
base: master


Copy link

achow101 commented Jul 25, 2019

bitcoin/bips#784 added a new global field GLOBAL_XPUB to BIP 174. This PR adds support for (de)serializing this field and displaying it in decodepsbt.


This comment has been minimized.

Copy link

DrahtBot commented Jul 25, 2019

The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.


Reviewers, this pull request conflicts with the following ones:

  • #18317 (Serialization improvements step 6 (all except wallet/gui) by sipa)
  • #18027 ("PSBT Operations" dialog by gwillen)
  • #17509 (gui: save and load PSBT by Sjors)
  • #17034 (Bip174 extensions by achow101)
  • #16549 ([WIP] UI external signer support (e.g. hardware wallet) by Sjors)
  • #16546 ([WIP] External signer support - Wallet Box edition by Sjors)
  • #16528 (Native Descriptor Wallets using DescriptorScriptPubKeyMan by achow101)

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.

achow101 added 4 commits Jul 25, 2019
…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.
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.
src/psbt.h Outdated
@@ -424,6 +516,18 @@ struct PartiallySignedTransaction
OverrideStream<Stream> os(&s, s.GetType(), s.GetVersion() | SERIALIZE_TRANSACTION_NO_WITNESS);
SerializeToVector(os, *tx);

// Write xpubs
for (const auto xpub_pair : xpubs) {
for (const auto xpub : xpub_pair.second) {

This comment has been minimized.

Copy link

jonatack Mar 24, 2020


suggested change to reference instead of copy in range loops:

-        for (const auto xpub_pair : xpubs) {
-            for (const auto xpub : xpub_pair.second) {
+        for (const auto& xpub_pair : xpubs) {
+            for (const auto& xpub : xpub_pair.second) {

This comment has been minimized.

Copy link

jonatack Mar 24, 2020


(this also fixes warnings if you build with -Wrange-loop-analysis)

This comment has been minimized.

Copy link

achow101 Mar 26, 2020

Author Member

Done, also in a few other places.

@laanwj laanwj modified the milestones: 0.20.0, 0.21.0 Mar 26, 2020
@laanwj laanwj added the Feature label Mar 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.