Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 347 Lines • ▼ Show 20 Lines | static UniValue delegateavalancheproof(const Config &config, | ||||
CPubKey auth; | CPubKey auth; | ||||
if (request.params.size() >= 4 && !request.params[3].isNull()) { | if (request.params.size() >= 4 && !request.params[3].isNull()) { | ||||
avalanche::Delegation dg; | avalanche::Delegation dg; | ||||
CDataStream ss(ParseHexV(request.params[3], "delegation"), SER_NETWORK, | CDataStream ss(ParseHexV(request.params[3], "delegation"), SER_NETWORK, | ||||
PROTOCOL_VERSION); | PROTOCOL_VERSION); | ||||
ss >> dg; | ss >> dg; | ||||
avalanche::DelegationState dgState; | avalanche::DelegationState dgState; | ||||
if (!dg.verify(dgState, proof, auth)) { | if (!dg.verify(dgState, proof.getMaster(), proof.getLimitedId(), | ||||
auth)) { | |||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"The supplied delegation is not valid"); | "The supplied delegation is not valid"); | ||||
} | } | ||||
if (!dgb.importDelegation(dg)) { | if (!dgb.importDelegation(dg)) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, | throw JSONRPCError(RPC_INVALID_PARAMETER, | ||||
"Failed to import the delegation"); | "Failed to import the delegation"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |