|
|
@ -2348,6 +2348,36 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin |
|
|
|
control.Add(vChecks); |
|
|
|
} |
|
|
|
|
|
|
|
if (fAddressIndex) { |
|
|
|
for (unsigned int k = 0; k < tx.vout.size(); k++) { |
|
|
|
const CTxOut &out = tx.vout[k]; |
|
|
|
|
|
|
|
if (out.scriptPubKey.IsPayToScriptHash()) { |
|
|
|
vector<unsigned char> hashBytes(out.scriptPubKey.begin()+2, out.scriptPubKey.begin()+22); |
|
|
|
|
|
|
|
// record receiving activity
|
|
|
|
addressIndex.push_back(make_pair(CAddressIndexKey(2, uint160(hashBytes), pindex->nHeight, i, txhash, k, false), out.nValue)); |
|
|
|
|
|
|
|
// record unspent output
|
|
|
|
addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(2, uint160(hashBytes), txhash, k), CAddressUnspentValue(out.nValue, out.scriptPubKey, pindex->nHeight))); |
|
|
|
|
|
|
|
} else if (out.scriptPubKey.IsPayToPublicKeyHash()) { |
|
|
|
vector<unsigned char> hashBytes(out.scriptPubKey.begin()+3, out.scriptPubKey.begin()+23); |
|
|
|
|
|
|
|
// record receiving activity
|
|
|
|
addressIndex.push_back(make_pair(CAddressIndexKey(1, uint160(hashBytes), pindex->nHeight, i, txhash, k, false), out.nValue)); |
|
|
|
|
|
|
|
// record unspent output
|
|
|
|
addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, uint160(hashBytes), txhash, k), CAddressUnspentValue(out.nValue, out.scriptPubKey, pindex->nHeight))); |
|
|
|
|
|
|
|
} else { |
|
|
|
continue; |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
CTxUndo undoDummy; |
|
|
|
if (i > 0) { |
|
|
|
blockundo.vtxundo.push_back(CTxUndo()); |
|
|
|