aboutsummaryrefslogtreecommitdiff
path: root/src/rpc
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2018-09-13 09:25:49 -0400
committerMarcoFalke <falke.marco@gmail.com>2018-09-13 09:28:46 -0400
commit962c302710cd6556a85ba953bac236f33b8e1a09 (patch)
tree9f1bc81bd321fdcf679b78b45d4008aacd73db47 /src/rpc
parentb9ed2fd026926cafe38a1ee23d47eb891a94ddb1 (diff)
parentfa6ab8ada14dd265e224496440ab0b5d99dfd0ef (diff)
downloadbitcoin-962c302710cd6556a85ba953bac236f33b8e1a09.tar.xz
Merge #13983: rpc: Return more specific reject reason for submitblock
fa6ab8ada1 rpc: Return more specific reject reason for submitblock (MarcoFalke) Pull request description: The second commit in #13439 made the `TODO` in the first commit impossible to solve. The meaning of `fNewBlock` changed from "This is the first time we process this block" to "We are about to write the new *valid* block". So whenever `fNewBlock` is true, the block was valid. And whenever the `fNewBlock` is false, the block is either valid or invalid. If it was valid and not new, we know it is a `"duplicate"`. In all other cases, the `BIP22ValidationResult()` will return the reason why it is invalid. Tree-SHA512: 4b6edf7a912339c3acb0fccfabbdd6d812a0321fb1639c244c2714e58dc119aa2b8c6bf8f7d61ea609a1b861bbc23f920370fcf989c48452721e259a8ce93d24
Diffstat (limited to 'src/rpc')
-rw-r--r--src/rpc/mining.cpp6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp
index 885ad834cf..b1bea85fef 100644
--- a/src/rpc/mining.cpp
+++ b/src/rpc/mining.cpp
@@ -750,11 +750,7 @@ static UniValue submitblock(const JSONRPCRequest& request)
RegisterValidationInterface(&sc);
bool accepted = ProcessNewBlock(Params(), blockptr, /* fForceProcessing */ true, /* fNewBlock */ &new_block);
UnregisterValidationInterface(&sc);
- if (!new_block) {
- if (!accepted) {
- // TODO Maybe pass down fNewBlock to AcceptBlockHeader, so it is properly set to true in this case?
- return "invalid";
- }
+ if (!new_block && accepted) {
return "duplicate";
}
if (!sc.found) {