Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 79 Lines • ▼ Show 20 Lines | static void verifyProofOrThrow(const NodeContext &node, avalanche::Proof &proof, | ||||
bilingual_str error; | bilingual_str error; | ||||
if (!avalanche::Proof::FromHex(proof, proofHex, error)) { | if (!avalanche::Proof::FromHex(proof, proofHex, error)) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, error.original); | throw JSONRPCError(RPC_DESERIALIZATION_ERROR, error.original); | ||||
} | } | ||||
avalanche::ProofValidationState state; | avalanche::ProofValidationState state; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (!proof.verify(state, | if (!proof.verify(state, *Assert(node.chainman))) { | ||||
node.chainman->ActiveChainstate().CoinsTip())) { | |||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"The proof is invalid: " + state.ToString()); | "The proof is invalid: " + state.ToString()); | ||||
} | } | ||||
} | } | ||||
} | } | ||||
static RPCHelpMan addavalanchenode() { | static RPCHelpMan addavalanchenode() { | ||||
return RPCHelpMan{ | return RPCHelpMan{ | ||||
▲ Show 20 Lines • Show All 956 Lines • Show Last 20 Lines |