@@ -80,6 +80,38 @@ std::string COutput::ToString() const
80
80
return strprintf (" COutput(%s, %d, %d) [%s]" , tx->GetHash ().ToString (), i, nDepth, FormatMoney (tx->tx ->vout [i].nValue ));
81
81
}
82
82
83
+ class CAffectedKeysVisitor : public boost ::static_visitor<void > {
84
+ private:
85
+ const CKeyStore &keystore;
86
+ std::vector<CKeyID> &vKeys;
87
+
88
+ public:
89
+ CAffectedKeysVisitor (const CKeyStore &keystoreIn, std::vector<CKeyID> &vKeysIn) : keystore(keystoreIn), vKeys(vKeysIn) {}
90
+
91
+ void Process (const CScript &script) {
92
+ txnouttype type;
93
+ std::vector<CTxDestination> vDest;
94
+ int nRequired;
95
+ if (ExtractDestinations (script, type, vDest, nRequired)) {
96
+ for (const CTxDestination &dest : vDest)
97
+ boost::apply_visitor (*this , dest);
98
+ }
99
+ }
100
+
101
+ void operator ()(const CKeyID &keyId) {
102
+ if (keystore.HaveKey (keyId))
103
+ vKeys.push_back (keyId);
104
+ }
105
+
106
+ void operator ()(const CScriptID &scriptId) {
107
+ CScript script;
108
+ if (keystore.GetCScript (scriptId, script))
109
+ Process (script);
110
+ }
111
+
112
+ void operator ()(const CNoDestination &none) {}
113
+ };
114
+
83
115
const CWalletTx* CWallet::GetWalletTx (const uint256& hash) const
84
116
{
85
117
LOCK (cs_wallet);
@@ -3629,38 +3661,6 @@ void CWallet::ListLockedCoins(std::vector<COutPoint>& vOutpts) const
3629
3661
3630
3662
/* * @} */ // end of Actions
3631
3663
3632
- class CAffectedKeysVisitor : public boost ::static_visitor<void > {
3633
- private:
3634
- const CKeyStore &keystore;
3635
- std::vector<CKeyID> &vKeys;
3636
-
3637
- public:
3638
- CAffectedKeysVisitor (const CKeyStore &keystoreIn, std::vector<CKeyID> &vKeysIn) : keystore(keystoreIn), vKeys(vKeysIn) {}
3639
-
3640
- void Process (const CScript &script) {
3641
- txnouttype type;
3642
- std::vector<CTxDestination> vDest;
3643
- int nRequired;
3644
- if (ExtractDestinations (script, type, vDest, nRequired)) {
3645
- for (const CTxDestination &dest : vDest)
3646
- boost::apply_visitor (*this , dest);
3647
- }
3648
- }
3649
-
3650
- void operator ()(const CKeyID &keyId) {
3651
- if (keystore.HaveKey (keyId))
3652
- vKeys.push_back (keyId);
3653
- }
3654
-
3655
- void operator ()(const CScriptID &scriptId) {
3656
- CScript script;
3657
- if (keystore.GetCScript (scriptId, script))
3658
- Process (script);
3659
- }
3660
-
3661
- void operator ()(const CNoDestination &none) {}
3662
- };
3663
-
3664
3664
void CWallet::GetKeyBirthTimes (std::map<CTxDestination, int64_t > &mapKeyBirth) const {
3665
3665
AssertLockHeld (cs_wallet); // mapKeyMetadata
3666
3666
mapKeyBirth.clear ();
0 commit comments