mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Add LookupBlockIndex function
This commit is contained in:
parent
43a32b7395
commit
92fabcd443
14 changed files with 139 additions and 133 deletions
|
|
@ -396,9 +396,8 @@ UniValue getblocktemplate(const JSONRPCRequest& request)
|
|||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||
|
||||
uint256 hash = block.GetHash();
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
||||
if (mi != mapBlockIndex.end()) {
|
||||
CBlockIndex *pindex = mi->second;
|
||||
const CBlockIndex* pindex = LookupBlockIndex(hash);
|
||||
if (pindex) {
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS))
|
||||
return "duplicate";
|
||||
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||
|
|
@ -727,9 +726,8 @@ UniValue submitblock(const JSONRPCRequest& request)
|
|||
bool fBlockPresent = false;
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
||||
if (mi != mapBlockIndex.end()) {
|
||||
CBlockIndex *pindex = mi->second;
|
||||
const CBlockIndex* pindex = LookupBlockIndex(hash);
|
||||
if (pindex) {
|
||||
if (pindex->IsValid(BLOCK_VALID_SCRIPTS)) {
|
||||
return "duplicate";
|
||||
}
|
||||
|
|
@ -743,9 +741,9 @@ UniValue submitblock(const JSONRPCRequest& request)
|
|||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BlockMap::iterator mi = mapBlockIndex.find(block.hashPrevBlock);
|
||||
if (mi != mapBlockIndex.end()) {
|
||||
UpdateUncommittedBlockStructures(block, mi->second, Params().GetConsensus());
|
||||
const CBlockIndex* pindex = LookupBlockIndex(block.hashPrevBlock);
|
||||
if (pindex) {
|
||||
UpdateUncommittedBlockStructures(block, pindex, Params().GetConsensus());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue