14
14
15
15
struct KeyOriginInfo ;
16
16
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
+
17
29
/* * An interface to be implemented by keystores that support signing. */
18
30
class SigningProvider
19
31
{
@@ -25,6 +37,14 @@ class SigningProvider
25
37
virtual bool GetKey (const CKeyID &address, CKey& key) const { return false ; }
26
38
virtual bool HaveKey (const CKeyID &address) const { return false ; }
27
39
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 ;
28
48
};
29
49
30
50
extern const SigningProvider& DUMMY_SIGNING_PROVIDER;
@@ -42,6 +62,8 @@ class HidingSigningProvider : public SigningProvider
42
62
bool GetPubKey (const CKeyID& keyid, CPubKey& pubkey) const override ;
43
63
bool GetKey (const CKeyID& keyid, CKey& key) const override ;
44
64
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 ;
45
67
};
46
68
47
69
struct FlatSigningProvider final : public SigningProvider
@@ -50,11 +72,16 @@ struct FlatSigningProvider final : public SigningProvider
50
72
std::map<CKeyID, CPubKey> pubkeys;
51
73
std::map<CKeyID, std::pair<CPubKey, KeyOriginInfo>> origins;
52
74
std::map<CKeyID, CKey> keys;
75
+ std::map<CKeyID, std::vector<ScriptPath>> taproot_paths;
76
+ std::map<CKeyID, std::pair<CPubKey, uint256>> p2c_tweaks;
53
77
54
78
bool GetCScript (const CScriptID& scriptid, CScript& script) const override ;
55
79
bool GetPubKey (const CKeyID& keyid, CPubKey& pubkey) const override ;
56
80
bool GetKeyOrigin (const CKeyID& keyid, KeyOriginInfo& info) const override ;
57
81
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
+
58
85
};
59
86
60
87
FlatSigningProvider Merge (const FlatSigningProvider& a, const FlatSigningProvider& b);
0 commit comments