1414
1515struct KeyOriginInfo ;
1616
17+ struct ScriptPath
18+ {
19+ uint8_t version = 0xc0 ;
20+ CScript leaf;
21+ std::vector<uint256> path;
22+
23+ void clear () {
24+ leaf.clear ();
25+ path.clear ();
26+ }
27+ };
28+
1729/* * An interface to be implemented by keystores that support signing. */
1830class SigningProvider
1931{
@@ -25,6 +37,14 @@ class SigningProvider
2537 virtual bool GetKey (const CKeyID &address, CKey& key) const { return false ; }
2638 virtual bool HaveKey (const CKeyID &address) const { return false ; }
2739 virtual bool GetKeyOrigin (const CKeyID& keyid, KeyOriginInfo& info) const { return false ; }
40+ virtual bool GetScriptPaths (const CKeyID &addressid, std::vector<ScriptPath>& paths) const { return false ; }
41+ virtual bool GetP2CTweaks (const CKeyID &addressid, CPubKey& base, uint256& tweak) const { return false ; }
42+
43+ SigningProvider () = default ;
44+ protected:
45+ // This prevents accidental object slicing.
46+ SigningProvider (const SigningProvider&) = default ;
47+ SigningProvider& operator =(const SigningProvider&) = default ;
2848};
2949
3050extern const SigningProvider& DUMMY_SIGNING_PROVIDER;
@@ -42,6 +62,8 @@ class HidingSigningProvider : public SigningProvider
4262 bool GetPubKey (const CKeyID& keyid, CPubKey& pubkey) const override ;
4363 bool GetKey (const CKeyID& keyid, CKey& key) const override ;
4464 bool GetKeyOrigin (const CKeyID& keyid, KeyOriginInfo& info) const override ;
65+ bool GetScriptPaths (const CKeyID &addressid, std::vector<ScriptPath>& paths) const override ;
66+ bool GetP2CTweaks (const CKeyID &addressid, CPubKey& base, uint256& tweak) const override ;
4567};
4668
4769struct FlatSigningProvider final : public SigningProvider
@@ -50,11 +72,16 @@ struct FlatSigningProvider final : public SigningProvider
5072 std::map<CKeyID, CPubKey> pubkeys;
5173 std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> origins;
5274 std::map<CKeyID, CKey> keys;
75+ std::map<CKeyID, std::vector<ScriptPath>> taproot_paths;
76+ std::map<CKeyID, std::pair<CPubKey, uint256>> p2c_tweaks;
5377
5478 bool GetCScript (const CScriptID& scriptid, CScript& script) const override ;
5579 bool GetPubKey (const CKeyID& keyid, CPubKey& pubkey) const override ;
5680 bool GetKeyOrigin (const CKeyID& keyid, KeyOriginInfo& info) const override ;
5781 bool GetKey (const CKeyID& keyid, CKey& key) const override ;
82+ bool GetScriptPaths (const CKeyID &addressid, std::vector<ScriptPath>& paths) const override ;
83+ bool GetP2CTweaks (const CKeyID &addressid, CPubKey& base, uint256& tweak) const override ;
84+
5885};
5986
6087FlatSigningProvider Merge (const FlatSigningProvider& a, const FlatSigningProvider& b);
0 commit comments