Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 473 Lines • ▼ Show 20 Lines | if (!avalanche::Proof::FromHex(proof, request.params[0].get_str(), error)) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, error.original); | throw JSONRPCError(RPC_INVALID_PARAMETER, error.original); | ||||
} | } | ||||
NodeContext &node = EnsureNodeContext(request.context); | NodeContext &node = EnsureNodeContext(request.context); | ||||
avalanche::ProofValidationState state; | avalanche::ProofValidationState state; | ||||
{ | { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
if (!proof.verify(state, | if (!proof.verify(state, node.chainman->ActiveChainstate().CoinsTip(), | ||||
node.chainman->ActiveChainstate().CoinsTip())) { | node.chainman->ActiveChain().Tip())) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"The proof is invalid: " + state.ToString()); | "The proof is invalid: " + state.ToString()); | ||||
} | } | ||||
} | } | ||||
return true; | return true; | ||||
} | } | ||||
Show All 19 Lines |