MCPcopy Create free account
hub / github.com/LUX-Core/lux / CAffectedKeysVisitor

Class CAffectedKeysVisitor

src/wallet.cpp:86–135  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

84}
85
86class CAffectedKeysVisitor : public boost::static_visitor<void> {
87private:
88 const CKeyStore &keystore;
89 std::vector<CKeyID> &vKeys;
90
91public:
92 CAffectedKeysVisitor(const CKeyStore &keystoreIn, std::vector<CKeyID> &vKeysIn) : keystore(keystoreIn), vKeys(vKeysIn) {}
93
94 void Process(const CScript &script) {
95 txnouttype type;
96 std::vector<CTxDestination> vDest;
97 int nRequired;
98 if (ExtractDestinations(script, type, vDest, nRequired)) {
99 for (const CTxDestination &dest : vDest)
100 boost::apply_visitor(*this, dest);
101 }
102 }
103
104 void operator()(const CKeyID &keyId) {
105 if (keystore.HaveKey(keyId))
106 vKeys.push_back(keyId);
107 }
108
109 void operator()(const CScriptID &scriptId) {
110 CScript script;
111 if (keystore.GetCScript(scriptId, script))
112 Process(script);
113 }
114
115 void operator()(const WitnessV0ScriptHash& scriptID)
116 {
117 CScriptID id;
118 CRIPEMD160().Write(scriptID.begin(), 32).Finalize(id.begin());
119 CScript script;
120 if (keystore.GetCScript(id, script)) {
121 Process(script);
122 }
123 }
124
125 void operator()(const WitnessV0KeyHash& keyid)
126 {
127 CKeyID id(keyid);
128 if (keystore.HaveKey(id)) {
129 vKeys.push_back(id);
130 }
131 }
132
133 template<typename X>
134 void operator()(const X &none) {}
135};
136
137const CWalletTx* CWallet::GetWalletTx(const uint256& hash) const
138{

Callers 2

GetKeyBirthTimesMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected