From e2e069dabcd7e61e14bb7bceda6c19ec3afa358a Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 8 Nov 2016 17:39:44 -0800 Subject: Revert "RPC: Give more details when "generate" fails" This only returned information in the case of CheckBlock failure, but breaks future changes. --- src/rpc/mining.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/rpc') diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 8824898feb..3e91a79a64 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -133,7 +133,7 @@ UniValue generateBlocks(boost::shared_ptr coinbaseScript, int nG } CValidationState state; if (!ProcessNewBlock(state, Params(), NULL, pblock, true, NULL, false)) - throw JSONRPCError(RPC_INTERNAL_ERROR, strprintf("ProcessNewBlock: block not accepted: %s", FormatStateMessage(state))); + throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted"); ++nHeight; blockHashes.push_back(pblock->GetHash().GetHex()); -- cgit v1.2.3 From 7c98ce584ec23bcddcba8cdb33efa6547212f6ef Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Sun, 2 Oct 2016 11:04:49 -0400 Subject: Remove pfrom parameter from ProcessNewBlock This further decouples ProcessNewBlock from networking/peer logic. --- src/rpc/mining.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 3e91a79a64..d9fe9530a1 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -132,7 +132,7 @@ UniValue generateBlocks(boost::shared_ptr coinbaseScript, int nG continue; } CValidationState state; - if (!ProcessNewBlock(state, Params(), NULL, pblock, true, NULL, false)) + if (!ProcessNewBlock(state, Params(), pblock, true, NULL, NULL)) throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted"); ++nHeight; blockHashes.push_back(pblock->GetHash().GetHex()); @@ -757,7 +757,7 @@ UniValue submitblock(const JSONRPCRequest& request) CValidationState state; submitblock_StateCatcher sc(block.GetHash()); RegisterValidationInterface(&sc); - bool fAccepted = ProcessNewBlock(state, Params(), NULL, &block, true, NULL, false); + bool fAccepted = ProcessNewBlock(state, Params(), &block, true, NULL, NULL); UnregisterValidationInterface(&sc); if (fBlockPresent) { -- cgit v1.2.3 From ae223576077448bd4ec250c73f5d8fe5e9a9ac7d Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Thu, 27 Oct 2016 16:30:17 -0400 Subject: Replace CValidationState param in ProcessNewBlock with BlockChecked --- src/rpc/mining.cpp | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) (limited to 'src/rpc') diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index d9fe9530a1..ad545bdf0d 100644 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -131,8 +131,7 @@ UniValue generateBlocks(boost::shared_ptr coinbaseScript, int nG if (pblock->nNonce == nInnerLoopCount) { continue; } - CValidationState state; - if (!ProcessNewBlock(state, Params(), pblock, true, NULL, NULL)) + if (!ProcessNewBlock(Params(), pblock, true, NULL, NULL)) throw JSONRPCError(RPC_INTERNAL_ERROR, "ProcessNewBlock, block not accepted"); ++nHeight; blockHashes.push_back(pblock->GetHash().GetHex()); @@ -754,10 +753,9 @@ UniValue submitblock(const JSONRPCRequest& request) } } - CValidationState state; submitblock_StateCatcher sc(block.GetHash()); RegisterValidationInterface(&sc); - bool fAccepted = ProcessNewBlock(state, Params(), &block, true, NULL, NULL); + bool fAccepted = ProcessNewBlock(Params(), &block, true, NULL, NULL); UnregisterValidationInterface(&sc); if (fBlockPresent) { @@ -765,13 +763,9 @@ UniValue submitblock(const JSONRPCRequest& request) return "duplicate-inconclusive"; return "duplicate"; } - if (fAccepted) - { - if (!sc.found) - return "inconclusive"; - state = sc.state; - } - return BIP22ValidationResult(state); + if (!sc.found) + return "inconclusive"; + return BIP22ValidationResult(sc.state); } UniValue estimatefee(const JSONRPCRequest& request) -- cgit v1.2.3