|
|
@ -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));
|
|
|
|
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> {
|
|
|
|
class CAffectedKeysVisitor : public boost::static_visitor<void> {
|
|
|
|
private:
|
|
|
|
private:
|
|
|
|
const CKeyStore &keystore;
|
|
|
|
const CKeyStore &keystore;
|
|
|
|
std::vector<CKeyID> &vKeys;
|
|
|
|
std::vector<CKeyID> &vKeys;
|
|
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
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) {}
|
|
|
|
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) {
|
|
|
|
void Process(const CScript &script) {
|
|
|
|
txnouttype type;
|
|
|
|
txnouttype type;
|
|
|
|
std::vector<CTxDestination> vDest;
|
|
|
|
std::vector<CTxDestination> vDest;
|
|
|
|