Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 735 Lines • ▼ Show 20 Lines | static UniValue submitblock(const Config &config, | ||||
bool new_block; | bool new_block; | ||||
submitblock_StateCatcher sc(block.GetHash()); | submitblock_StateCatcher sc(block.GetHash()); | ||||
RegisterValidationInterface(&sc); | RegisterValidationInterface(&sc); | ||||
bool accepted = | bool accepted = | ||||
ProcessNewBlock(config, blockptr, /* fForceProcessing */ true, | ProcessNewBlock(config, blockptr, /* fForceProcessing */ true, | ||||
/* fNewBlock */ &new_block); | /* fNewBlock */ &new_block); | ||||
UnregisterValidationInterface(&sc); | UnregisterValidationInterface(&sc); | ||||
if (!new_block) { | if (!new_block && accepted) { | ||||
if (!accepted) { | |||||
// TODO Maybe pass down fNewBlock to AcceptBlockHeader, so it is | |||||
// properly set to true in this case? | |||||
return "invalid"; | |||||
} | |||||
return "duplicate"; | return "duplicate"; | ||||
} | } | ||||
if (!sc.found) { | if (!sc.found) { | ||||
return "inconclusive"; | return "inconclusive"; | ||||
} | } | ||||
return BIP22ValidationResult(config, sc.state); | return BIP22ValidationResult(config, sc.state); | ||||
▲ Show 20 Lines • Show All 82 Lines • Show Last 20 Lines |