Skip to content

Commit

Permalink
Fixes for addrindex to make compatible with 0.11 branch
Browse files Browse the repository at this point in the history
  • Loading branch information
btcdrak committed Jun 5, 2015
1 parent 367ae32 commit db21512
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1080,16 +1080,16 @@ bool ReadTransaction(CTransaction& tx, const CDiskTxPos &pos, uint256 &hashBlock
}

bool FindTransactionsByDestination(const CTxDestination &dest, std::set<CExtDiskTxPos> &setpos) {
uint160 addrid = 0;
uint160 addrid;
const CKeyID *pkeyid = boost::get<CKeyID>(&dest);
if (pkeyid)
addrid = static_cast<uint160>(*pkeyid);
if (!addrid) {
if (addrid.IsNull()) {
const CScriptID *pscriptid = boost::get<CScriptID>(&dest);
if (pscriptid)
addrid = static_cast<uint160>(*pscriptid);
}
if (!addrid)
if (addrid.IsNull())
return false;

LOCK(cs_main);
Expand Down Expand Up @@ -1822,7 +1822,7 @@ void static BuildAddrIndex(const CScript &script, const CExtDiskTxPos &pos, std:
while (pc < pend) {
script.GetOp(pc, opcode, data);
if (0 <= opcode && opcode <= OP_PUSHDATA4 && data.size() >= 8) { // data element
uint160 addrid = 0;
uint160 addrid;
if (data.size() <= 20) {
memcpy(&addrid, &data[0], data.size());
} else {
Expand Down Expand Up @@ -2006,12 +2006,12 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
}

if (fTxIndex)
if (!pblocktree->WriteTxIndex(vPos))
if (!pblocktree->WriteTxIndex(vPosTxid))
return AbortNode(state, "Failed to write transaction index");

if (fAddrIndex)
if (!pblocktree->AddAddrIndex(vPosAddrid))
return state.Abort(_("Failed to write address index"));
return AbortNode(state, "Failed to write address index");

// add this block to the view's block chain
view.SetBestBlock(pindex->GetBlockHash());
Expand Down
2 changes: 1 addition & 1 deletion src/rpcserver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ static const CRPCCommand vRPCCommands[] =
{ "rawtransactions", "decoderawtransaction", &decoderawtransaction, true },
{ "rawtransactions", "decodescript", &decodescript, true },
{ "rawtransactions", "getrawtransaction", &getrawtransaction, true },
{ "rawtransactions", "searchrawtransactions", &searchrawtransactions, true, false, false },
{ "rawtransactions", "searchrawtransactions", &searchrawtransactions, true },
{ "rawtransactions", "sendrawtransaction", &sendrawtransaction, false },
{ "rawtransactions", "signrawtransaction", &signrawtransaction, false }, /* uses wallet if enabled */

Expand Down

0 comments on commit db21512

Please sign in to comment.