mirror of
https://github.com/dashpay/dash.git
synced 2024-12-28 13:32:47 +01:00
Merge remote-tracking branch 'bitcoin/0.10' into v0.12.0.x
This commit is contained in:
commit
e6c9d5720c
@ -666,6 +666,9 @@ Value submitblock(const Array& params, bool fHelp)
|
|||||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, "Block decode failed");
|
||||||
|
|
||||||
uint256 hash = block.GetHash();
|
uint256 hash = block.GetHash();
|
||||||
|
bool fBlockPresent = false;
|
||||||
|
{
|
||||||
|
LOCK(cs_main);
|
||||||
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
BlockMap::iterator mi = mapBlockIndex.find(hash);
|
||||||
if (mi != mapBlockIndex.end()) {
|
if (mi != mapBlockIndex.end()) {
|
||||||
CBlockIndex *pindex = mi->second;
|
CBlockIndex *pindex = mi->second;
|
||||||
@ -674,6 +677,8 @@ Value submitblock(const Array& params, bool fHelp)
|
|||||||
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
if (pindex->nStatus & BLOCK_FAILED_MASK)
|
||||||
return "duplicate-invalid";
|
return "duplicate-invalid";
|
||||||
// Otherwise, we might only have the header - process the block before returning
|
// Otherwise, we might only have the header - process the block before returning
|
||||||
|
fBlockPresent = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
CValidationState state;
|
CValidationState state;
|
||||||
@ -681,7 +686,7 @@ Value submitblock(const Array& params, bool fHelp)
|
|||||||
RegisterValidationInterface(&sc);
|
RegisterValidationInterface(&sc);
|
||||||
bool fAccepted = ProcessNewBlock(state, NULL, &block);
|
bool fAccepted = ProcessNewBlock(state, NULL, &block);
|
||||||
UnregisterValidationInterface(&sc);
|
UnregisterValidationInterface(&sc);
|
||||||
if (mi != mapBlockIndex.end())
|
if (fBlockPresent)
|
||||||
{
|
{
|
||||||
if (fAccepted && !sc.found)
|
if (fAccepted && !sc.found)
|
||||||
return "duplicate-inconclusive";
|
return "duplicate-inconclusive";
|
||||||
|
Loading…
Reference in New Issue
Block a user