From dc276bd08718349f69f6cf47e80bb5b97295647d Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 26 Jun 2018 06:18:12 -1100 Subject: [PATCH] Map address type 3 -> 1 --- src/main.cpp | 10 +++++----- src/rpcblockchain.cpp | 3 --- src/rpcrawtransaction.cpp | 3 --- src/txmempool.cpp | 6 +++--- 4 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 5a1cdcd10..bb1f959ad 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2529,10 +2529,10 @@ bool DisconnectBlock(CBlock& block, CValidationState& state, CBlockIndex* pindex vector hashBytes(prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.begin()+34); // undo spending activity - addressIndex.push_back(make_pair(CAddressIndexKey(3, Hash160(hashBytes), pindex->nHeight, i, hash, j, true), prevout.nValue * -1)); + addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, hash, j, true), prevout.nValue * -1)); // restore unspent index - addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(3, Hash160(hashBytes), input.prevout.hash, input.prevout.n), CAddressUnspentValue(prevout.nValue, prevout.scriptPubKey, undo.nHeight))); + addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), input.prevout.hash, input.prevout.n), CAddressUnspentValue(prevout.nValue, prevout.scriptPubKey, undo.nHeight))); } else { @@ -2814,7 +2814,7 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin } else if (prevout.scriptPubKey.IsPayToPublicKey()) { hashBytes = uint160(vector (prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.begin()+34)); - addressType = 3; + addressType = 1; } else { hashBytes.SetNull(); @@ -2887,10 +2887,10 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin vector hashBytes(out.scriptPubKey.begin()+1, out.scriptPubKey.begin()+34); // record receiving activity - addressIndex.push_back(make_pair(CAddressIndexKey(3, Hash160(hashBytes), pindex->nHeight, i, txhash, k, false), out.nValue)); + addressIndex.push_back(make_pair(CAddressIndexKey(1, Hash160(hashBytes), pindex->nHeight, i, txhash, k, false), out.nValue)); // record unspent output - addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(3, Hash160(hashBytes), txhash, k), CAddressUnspentValue(out.nValue, out.scriptPubKey, pindex->nHeight))); + addressUnspentIndex.push_back(make_pair(CAddressUnspentKey(1, Hash160(hashBytes), txhash, k), CAddressUnspentValue(out.nValue, out.scriptPubKey, pindex->nHeight))); } else { diff --git a/src/rpcblockchain.cpp b/src/rpcblockchain.cpp index ca9a21278..28f7dc38c 100644 --- a/src/rpcblockchain.cpp +++ b/src/rpcblockchain.cpp @@ -176,9 +176,6 @@ UniValue blockToDeltasJSON(const CBlock& block, const CBlockIndex* blockindex) else if (spentInfo.addressType == 2) { delta.push_back(Pair("address", CBitcoinAddress(CScriptID(spentInfo.addressHash)).ToString())); } - else if (spentInfo.addressType == 3) { - xxx delta.push_back(Pair("address", CBitcoinAddress(CScriptID(spentInfo.addressHash)).ToString())); - } else { continue; } diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index ff6df3505..a9aff1b7f 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -165,9 +165,6 @@ void TxToJSONExpanded(const CTransaction& tx, const uint256 hashBlock, UniValue& else if (spentInfo.addressType == 2) { in.push_back(Pair("address", CBitcoinAddress(CScriptID(spentInfo.addressHash)).ToString())); } - else if (spentInfo.addressType == 3) { - xxx in.push_back(Pair("address", CBitcoinAddress(CScriptID(spentInfo.addressHash)).ToString())); - } } } in.push_back(Pair("sequence", (int64_t)txin.nSequence)); diff --git a/src/txmempool.cpp b/src/txmempool.cpp index 67e79b5cf..51ed1103e 100644 --- a/src/txmempool.cpp +++ b/src/txmempool.cpp @@ -147,7 +147,7 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC } else if (prevout.scriptPubKey.IsPayToPublicKey()) { vector hashBytes(prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.begin()+34); - CMempoolAddressDeltaKey key(3, Hash160(hashBytes), txhash, j, 1); + 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); @@ -172,7 +172,7 @@ void CTxMemPool::addAddressIndex(const CTxMemPoolEntry &entry, const CCoinsViewC else if (out.scriptPubKey.IsPayToPublicKey()) { vector hashBytes(out.scriptPubKey.begin()+1, out.scriptPubKey.begin()+34); std::pair ret; - CMempoolAddressDeltaKey key(3, Hash160(hashBytes), txhash, k, 0); + CMempoolAddressDeltaKey key(1, Hash160(hashBytes), txhash, k, 0); mapAddress.insert(make_pair(key, CMempoolAddressDelta(entry.GetTime(), out.nValue))); inserted.push_back(key); } @@ -235,7 +235,7 @@ void CTxMemPool::addSpentIndex(const CTxMemPoolEntry &entry, const CCoinsViewCac } else if (prevout.scriptPubKey.IsPayToPublicKey()) { addressHash = Hash160(vector (prevout.scriptPubKey.begin()+1, prevout.scriptPubKey.begin()+34)); - addressType = 3; + addressType = 1; } else { addressHash.SetNull();