PSBT key path cleanups #13723

pull sipa wants to merge 11 commits into bitcoin:master from sipa:201807_key_origin_provider changing 11 files +232 −138
  1. sipa commented at 7:15 am on July 20, 2018: member

    This PR adds “key origin” (master fingeprint + key path) information to what is exposed from SigningProviders, allowing this information to be used by the generic PSBT code instead of having the RPC pull it directly from the wallet.

    This is also a preparation to having PSBT interact with output descriptors, which can then directly expose key origin information for the scripts they generate.

  2. sipa force-pushed on Jul 20, 2018
  3. in src/script/sign.cpp:628 in dc3ad0d3d9 outdated
    623@@ -624,3 +624,8 @@ bool PublicOnlySigningProvider::GetPubKey(const CKeyID &address, CPubKey& pubkey
    624 {
    625     return m_provider->GetPubKey(address, pubkey);
    626 }
    627+
    628+bool PublicOnlySigningProvider::GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo& info) const
    


    promag commented at 9:58 am on July 20, 2018:

    Commit “Make SigningProvider expose key origin information”

    nit CKeyID& keyid.


    sipa commented at 6:54 pm on July 20, 2018:
    done
  4. in src/wallet/wallet.cpp:4439 in dc3ad0d3d9 outdated
    4377@@ -4378,4 +4378,3 @@ void CWallet::LearnAllRelatedScripts(const CPubKey& key)
    4378     // OutputType::P2SH_SEGWIT always adds all necessary scripts for all types.
    4379     LearnRelatedScripts(key, OutputType::P2SH_SEGWIT);
    4380 }
    4381-
    


    promag commented at 9:59 am on July 20, 2018:

    Commit “Make SigningProvider expose key origin information”

    nit, remove.


    sipa commented at 6:54 pm on July 20, 2018:
    done
  5. in src/script/sign.h:51 in dc3ad0d3d9 outdated
    47@@ -47,6 +48,7 @@ class PublicOnlySigningProvider : public SigningProvider
    48     PublicOnlySigningProvider(const SigningProvider* provider) : m_provider(provider) {}
    49     bool GetCScript(const CScriptID &scriptid, CScript& script) const;
    50     bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const;
    51+    bool GetKeyOrigin(const CKeyID &address, KeyOriginInfo& info) const;
    


    promag commented at 9:59 am on July 20, 2018:

    Commit “Make SigningProvider expose key origin information”

    nit, CKeyID& address.


    sipa commented at 6:54 pm on July 20, 2018:
    done
  6. in src/script/sign.cpp:653 in f6631bf2ca outdated
    632 {
    633+    if (m_hide_secret) return false;
    634+    return m_provider->GetKey(keyid, key);
    635+}
    636+
    637+bool HidingSigningProvider::GetKeyOrigin(const CKeyID &keyid, KeyOriginInfo& info) const
    


    promag commented at 10:01 am on July 20, 2018:

    Commit “Generalize PublicOnlySigningProvider into HidingSigningProvider”

    nit, CKeyID& keyid.


    sipa commented at 6:54 pm on July 20, 2018:
    done
  7. in src/script/sign.h:51 in f6631bf2ca outdated
    51-    PublicOnlySigningProvider(const SigningProvider* provider) : m_provider(provider) {}
    52-    bool GetCScript(const CScriptID &scriptid, CScript& script) const;
    53-    bool GetPubKey(const CKeyID &address, CPubKey& pubkey) const;
    54-    bool GetKeyOrigin(const CKeyID &address, KeyOriginInfo& info) const;
    55+    HidingSigningProvider(const SigningProvider* provider, bool hide_secret, bool hide_origin) : m_hide_secret(hide_secret), m_hide_origin(hide_origin), m_provider(provider) {}
    56+    bool GetCScript(const CScriptID &scriptid, CScript& script) const override;
    


    promag commented at 10:09 am on July 20, 2018:

    Commit “Generalize PublicOnlySigningProvider into HidingSigningProvider”

    nit, CScriptID& scriptid and some more below.


    sipa commented at 6:54 pm on July 20, 2018:
    done
  8. practicalswift commented at 11:21 am on July 20, 2018: contributor

    Concept ACK

    Thanks for taking another look at this code

  9. promag commented at 1:15 pm on July 20, 2018: member
    Partial utACK. Nice refactors that improve code readability. Some nits regarding code style.
  10. sipa force-pushed on Jul 20, 2018
  11. sipa force-pushed on Jul 20, 2018
  12. sipa force-pushed on Jul 20, 2018
  13. sipa force-pushed on Jul 20, 2018
  14. in src/wallet/rpcwallet.cpp:4464 in d7bb6645ac outdated
    4460@@ -4461,21 +4461,14 @@ bool FillPSBT(const CWallet* pwallet, PartiallySignedTransaction& psbtx, const C
    4461         }
    4462 
    4463         SignatureData sigdata;
    4464-        complete &= SignPSBTInput(HidingSigningProvider(pwallet, !sign, false), *psbtx.tx, input, sigdata, i, sighash_type);
    4465+        complete &= SignPSBTInput(HidingSigningProvider(pwallet, !sign, !bip32derivs), *psbtx.tx, input, sigdata, i, sighash_type);
    


    achow101 commented at 6:58 pm on July 20, 2018:
    Shouldn’t this change be part of the earlier " Generalize PublicOnlySigningProvider into HidingSigningProvider" commit?

    sipa commented at 7:01 pm on July 20, 2018:
    It could be, but doesn’t matter. There is no bip32 information in SignatureData until this commit.
  15. sipa force-pushed on Jul 20, 2018
  16. achow101 commented at 7:00 pm on July 20, 2018: member
    Concept ACK
  17. sipa force-pushed on Jul 20, 2018
  18. in src/script/sign.cpp:625 in cd3394a7b8 outdated
    619@@ -620,7 +620,12 @@ bool PublicOnlySigningProvider::GetCScript(const CScriptID &scriptid, CScript& s
    620     return m_provider->GetCScript(scriptid, script);
    621 }
    622 
    623-bool PublicOnlySigningProvider::GetPubKey(const CKeyID &address, CPubKey& pubkey) const
    624+bool PublicOnlySigningProvider::GetPubKey(const CKeyID& keyid, CPubKey& pubkey) const
    625 {
    626     return m_provider->GetPubKey(address, pubkey);
    


    achow101 commented at 11:11 pm on July 20, 2018:

    In commit “Make SigningProvider expose key origin information”

    You should change address to keyid in this commit instead of “Generalize PublicOnlySigningProvider into HidingSigningProvider”


    sipa commented at 11:40 pm on July 20, 2018:
    Done.
  19. sipa force-pushed on Jul 20, 2018
  20. DrahtBot commented at 1:19 pm on July 22, 2018: member
    • #14021 (Import key origin data through importmulti by achow101)
    • #13932 (Additional utility RPCs for PSBT by achow101)
    • #13815 (util: Add [[nodiscard]] to all {Decode,Parse} functions returning bool by practicalswift)
    • #13671 (Remove the boost/algorithm/string/case_conv.hpp dependency by 251Labs)

    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.

  21. laanwj added the label RPC/REST/ZMQ on Jul 23, 2018
  22. laanwj commented at 2:05 pm on July 23, 2018: member
    utACK f6ba1ca1e51d044b6fc8398edfa4dd03061572c4 verified that [MOVEONLY] Move ParseHDKeypair is move-only
  23. DrahtBot added the label Needs rebase on Jul 24, 2018
  24. sipa force-pushed on Jul 24, 2018
  25. sipa commented at 10:13 pm on July 24, 2018: member
    Rebased.
  26. DrahtBot removed the label Needs rebase on Jul 24, 2018
  27. DrahtBot added the label Needs rebase on Aug 6, 2018
  28. sipa force-pushed on Aug 6, 2018
  29. DrahtBot removed the label Needs rebase on Aug 6, 2018
  30. sipa force-pushed on Aug 7, 2018
  31. sipa commented at 9:43 pm on August 7, 2018: member
    I don’t understand why this is causing the no-wallet Travis test to timeout: https://api.travis-ci.org/v3/job/413228232/log.txt
  32. MarcoFalke commented at 9:54 pm on August 7, 2018: member
    Should be fixed by deleting the travis cache and resetting that particular job.
  33. achow101 commented at 9:15 pm on August 9, 2018: member
    utACK 9c28a0c0ddfb09dcd4d5c0ca83ce5cdae9bc1fa2
  34. sipa force-pushed on Aug 10, 2018
  35. sipa commented at 3:34 am on August 10, 2018: member
    Rebased on top of #13917, which has far higher priority.
  36. DrahtBot added the label Needs rebase on Aug 13, 2018
  37. Only wipe wrong UTXO type data if overwritten by wallet c05712cb59
  38. Additional sanity checks in SignPSBTInput 8254e9950f
  39. Test that a non-witness script as witness utxo is not signed 7c8bffdc24
  40. More tests of signer checks 5df6f089b5
  41. Introduce KeyOriginInfo for fingerprint + path 611ab307fb
  42. Make SigningProvider expose key origin information 84f1f1bfdf
  43. Generalize PublicOnlySigningProvider into HidingSigningProvider 81e1dd5ce1
  44. [MOVEONLY] Move ParseHDKeypath to utilstrencodings 3b01efa0d1
  45. Implement key origin lookup in CWallet 03a99586a3
  46. Pass HD path data through SignatureData cad5dd2368
  47. Make SignPSBTInput operate on a private SignatureData object 917353c8b0
  48. sipa force-pushed on Aug 13, 2018
  49. DrahtBot removed the label Needs rebase on Aug 13, 2018
  50. laanwj added this to the "Blockers" column in a project

  51. in src/wallet/rpcwallet.cpp:4426 in 917353c8b0
    4463-    }
    4464-    return true;
    4465-}
    4466-
    4467-void AddKeypathToMap(const CWallet* pwallet, const CKeyID& keyID, std::map<CPubKey, std::vector<uint32_t>>& hd_keypaths)
    4468+void AddKeypathToMap(const CWallet* pwallet, const CKeyID& keyID, std::map<CPubKey, KeyOriginInfo>& hd_keypaths)
    


    Empact commented at 10:26 pm on August 20, 2018:
    Looks like this is no longer called.
  52. laanwj commented at 2:22 pm on August 28, 2018: member
    re-utACK 917353c8b0eff4cd95f9a5f7719f6756bb8338b1
  53. laanwj merged this on Aug 28, 2018
  54. laanwj closed this on Aug 28, 2018

  55. laanwj referenced this in commit aa39ca7645 on Aug 28, 2018
  56. MarcoFalke removed this from the "Blockers" column in a project

  57. kittywhiskers referenced this in commit e0d83ec619 on Jun 4, 2021
  58. kittywhiskers referenced this in commit f573fb60cb on Jun 4, 2021
  59. UdjinM6 referenced this in commit e356d8b8d7 on Jun 7, 2021
  60. barrystyle referenced this in commit acb122e6cf on Jun 8, 2021
  61. barrystyle referenced this in commit 9166796714 on Jun 8, 2021
  62. kittywhiskers referenced this in commit 44545672b2 on Jun 9, 2021
  63. kittywhiskers referenced this in commit 9b8652e55b on Jul 9, 2021
  64. kittywhiskers referenced this in commit 158c656bbc on Jul 13, 2021
  65. kittywhiskers referenced this in commit 2a4dee5fa0 on Jul 13, 2021
  66. kittywhiskers referenced this in commit 8b891c2b10 on Jul 13, 2021
  67. PastaPastaPasta referenced this in commit e98241da5d on Jul 13, 2021
  68. MarcoFalke locked this on Sep 8, 2021

github-metadata-mirror

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 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me