Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/mining.cpp
Show First 20 Lines • Show All 311 Lines • ▼ Show 20 Lines | |||||
// NOTE: Assumes a conclusive result; if result is inconclusive, it must be | // NOTE: Assumes a conclusive result; if result is inconclusive, it must be | ||||
// handled by caller | // handled by caller | ||||
static UniValue BIP22ValidationResult(const Config &config, | static UniValue BIP22ValidationResult(const Config &config, | ||||
const CValidationState &state) { | const CValidationState &state) { | ||||
if (state.IsValid()) { | if (state.IsValid()) { | ||||
return NullUniValue; | return NullUniValue; | ||||
} | } | ||||
std::string strRejectReason = state.GetRejectReason(); | |||||
if (state.IsError()) { | if (state.IsError()) { | ||||
throw JSONRPCError(RPC_VERIFY_ERROR, strRejectReason); | throw JSONRPCError(RPC_VERIFY_ERROR, FormatStateMessage(state)); | ||||
} | } | ||||
if (state.IsInvalid()) { | if (state.IsInvalid()) { | ||||
std::string strRejectReason = state.GetRejectReason(); | |||||
if (strRejectReason.empty()) { | if (strRejectReason.empty()) { | ||||
return "rejected"; | return "rejected"; | ||||
} | } | ||||
return strRejectReason; | return strRejectReason; | ||||
} | } | ||||
// Should be impossible. | // Should be impossible. | ||||
return "valid?"; | return "valid?"; | ||||
▲ Show 20 Lines • Show All 481 Lines • Show Last 20 Lines |