Refactor/encapsulate chain globals into a CChain class
This commit is contained in:
@@ -76,7 +76,7 @@ Value getinfo(const Array& params, bool fHelp)
|
||||
obj.push_back(Pair("walletversion", pwalletMain->GetVersion()));
|
||||
obj.push_back(Pair("balance", ValueFromAmount(pwalletMain->GetBalance())));
|
||||
}
|
||||
obj.push_back(Pair("blocks", (int)nBestHeight));
|
||||
obj.push_back(Pair("blocks", (int)chainActive.Height()));
|
||||
obj.push_back(Pair("timeoffset", (boost::int64_t)GetTimeOffset()));
|
||||
obj.push_back(Pair("connections", (int)vNodes.size()));
|
||||
obj.push_back(Pair("proxy", (proxy.first.IsValid() ? proxy.first.ToStringIPPort() : string())));
|
||||
@@ -1180,7 +1180,7 @@ Value listsinceblock(const Array& params, bool fHelp)
|
||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Invalid parameter");
|
||||
}
|
||||
|
||||
int depth = pindex ? (1 + nBestHeight - pindex->nHeight) : -1;
|
||||
int depth = pindex ? (1 + chainActive.Height() - pindex->nHeight) : -1;
|
||||
|
||||
Array transactions;
|
||||
|
||||
@@ -1192,23 +1192,8 @@ Value listsinceblock(const Array& params, bool fHelp)
|
||||
ListTransactions(tx, "*", 0, true, transactions);
|
||||
}
|
||||
|
||||
uint256 lastblock;
|
||||
|
||||
if (target_confirms == 1)
|
||||
{
|
||||
lastblock = hashBestChain;
|
||||
}
|
||||
else
|
||||
{
|
||||
int target_height = pindexBest->nHeight + 1 - target_confirms;
|
||||
|
||||
CBlockIndex *block;
|
||||
for (block = pindexBest;
|
||||
block && block->nHeight > target_height;
|
||||
block = block->pprev) { }
|
||||
|
||||
lastblock = block ? block->GetBlockHash() : 0;
|
||||
}
|
||||
CBlockIndex *pblockLast = chainActive[chainActive.Height() + 1 - target_confirms];
|
||||
uint256 lastblock = pblockLast ? pblockLast->GetBlockHash() : 0;
|
||||
|
||||
Object ret;
|
||||
ret.push_back(Pair("transactions", transactions));
|
||||
|
||||
Reference in New Issue
Block a user