Support IsPayToCryptoCondition for -addressindex

This commit is contained in:
jl777
2018-07-21 05:19:57 -11:00
parent eb07073d67
commit 7f190223f5
3 changed files with 53 additions and 2 deletions

View File

@@ -152,7 +152,13 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
mapAddress.insert(make_pair(key, delta));
inserted.push_back(key);
}
}
else if (prevout.scriptPubKey.IsPayToCryptoCondition()) {
vector<unsigned char> hashBytes(prevout.scriptPubKey.begin(), prevout.scriptPubKey.end());
CMempoolAddressDeltaKey key(1, Hash160(hashBytes), txhash, j, 1);
CMempoolAddressDelta delta(entry.GetTime(), prevout.nValue * -1, input.prevout.hash, input.prevout.n);
mapAddress.insert(make_pair(key, delta));
inserted.push_back(key);
} }
for (unsigned int k = 0; k < tx.vout.size(); k++) {
const CTxOut &out = tx.vout[k];
@@ -176,6 +182,13 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC
mapAddress.insert(make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
inserted.push_back(key);
}
else if (out.scriptPubKey.IsPayToCryptoCondition()) {
vector<unsigned char> hashBytes(out.scriptPubKey.begin(), out.scriptPubKey.end());
std::pair<addressDeltaMap::iterator,bool> ret;
CMempoolAddressDeltaKey key(1, Hash160(hashBytes), txhash, k, 0);
mapAddress.insert(make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue)));
inserted.push_back(key);
}
}
mapAddressInserted.insert(make_pair(txhash, inserted));
@@ -237,6 +250,10 @@ void CTxMemPool::addSpentIndex(const CTxMemPoolEntry &entry, const CCoinsViewCac
addressHash = Hash160(vector<unsigned char> (prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.begin()+34));
addressType = 1;
}
else if (prevout.scriptPubKey.IsPayToCryptoCondition()) {
addressHash = Hash160(vector<unsigned char> (prevout.scriptPubKey.begin(), prevout.scriptPubKey.end()));
addressType = 1;
}
else {
addressHash.SetNull();
addressType = 0;