aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-08-07 16:40:49 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-08-07 16:49:18 +0200
commite8f387f9970f055cca4265e118bf0e2320762997 (patch)
tree6117e0f6d88edcf7ea24f6f542f342286e2d736a
parent1cd5f2cf9a98708767049a7ddf577cc3f4527617 (diff)
parent3339d845354c9c357ec90505192748d9d639e72e (diff)
Merge #13843: [trivial] Add doxygen-compatible comments to CAffectedKeysVisitor
3339d845354c9c357ec90505192748d9d639e72e [trivial] add doxygen-compatible comments to CAffectedKeysVisitor (Pierre Rochard) Pull request description: Tree-SHA512: 0003fde198a6977d0c8988efc8f76428f9e095009fddf131b07bd9809ef76a778c86bb2b1305e33df16101b6b703cf43eb6193462bb9f3687f98c1d9b109dd96
-rw-r--r--src/wallet/wallet.cpp11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp
index 2c15ff7d90..16568d0e05 100644
--- a/src/wallet/wallet.cpp
+++ b/src/wallet/wallet.cpp
@@ -102,14 +102,25 @@ std::string COutput::ToString() const
return strprintf("COutput(%s, %d, %d) [%s]", tx->GetHash().ToString(), i, nDepth, FormatMoney(tx->tx->vout[i].nValue));
}
+/** A class to identify which pubkeys a script and a keystore have in common. */
class CAffectedKeysVisitor : public boost::static_visitor<void> {
private:
const CKeyStore &keystore;
std::vector<CKeyID> &vKeys;
public:
+ /**
+ * @param[in] keystoreIn The CKeyStore that is queried for the presence of a pubkey.
+ * @param[out] vKeysIn A vector to which a script's pubkey identifiers are appended if they are in the keystore.
+ */
CAffectedKeysVisitor(const CKeyStore &keystoreIn, std::vector<CKeyID> &vKeysIn) : keystore(keystoreIn), vKeys(vKeysIn) {}
+ /**
+ * Apply the visitor to each destination in a script, recursively to the redeemscript
+ * in the case of p2sh destinations.
+ * @param[in] script The CScript from which destinations are extracted.
+ * @post Any CKeyIDs that script and keystore have in common are appended to the visitor's vKeys.
+ */
void Process(const CScript &script) {
txnouttype type;
std::vector<CTxDestination> vDest;