NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller
| 615 | |
| 616 | // NOTE: Assumes a conclusive result; if result is inconclusive, it must be handled by caller |
| 617 | static UniValue BIP22ValidationResult(const BlockValidationState& state) |
| 618 | { |
| 619 | if (state.IsValid()) |
| 620 | return UniValue::VNULL; |
| 621 | |
| 622 | if (state.IsError()) |
| 623 | throw JSONRPCError(RPC_VERIFY_ERROR, state.ToString()); |
| 624 | if (state.IsInvalid()) |
| 625 | { |
| 626 | std::string strRejectReason = state.GetRejectReason(); |
| 627 | if (strRejectReason.empty()) |
| 628 | return "rejected"; |
| 629 | return strRejectReason; |
| 630 | } |
| 631 | // Should be impossible |
| 632 | return "valid?"; |
| 633 | } |
| 634 | |
| 635 | // Prefix rule name with ! if not optional, see BIP9 |
| 636 | static std::string gbt_rule_value(const std::string& name, bool gbt_optional_rule) |
no test coverage detected