Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 337 Lines • ▼ Show 20 Lines | if (!privkey.IsValid()) { | ||||
"The private key is invalid"); | "The private key is invalid"); | ||||
} | } | ||||
const CPubKey pubkey = ParsePubKey(request.params[2]); | const CPubKey pubkey = ParsePubKey(request.params[2]); | ||||
std::unique_ptr<avalanche::DelegationBuilder> dgb; | std::unique_ptr<avalanche::DelegationBuilder> dgb; | ||||
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, | bilingual_str error; | ||||
PROTOCOL_VERSION); | if (!avalanche::Delegation::FromHex(dg, request.params[3].get_str(), | ||||
ss >> dg; | error)) { | ||||
throw JSONRPCError(RPC_DESERIALIZATION_ERROR, error.original); | |||||
} | |||||
if (dg.getProofId() != | if (dg.getProofId() != | ||||
limitedProofId.computeProofId(dg.getProofMaster())) { | limitedProofId.computeProofId(dg.getProofMaster())) { | ||||
throw JSONRPCError( | throw JSONRPCError( | ||||
RPC_INVALID_PARAMETER, | RPC_INVALID_PARAMETER, | ||||
"The supplied delegation does not match the proof"); | "The supplied delegation does not match the proof"); | ||||
} | } | ||||
▲ Show 20 Lines • Show All 247 Lines • Show Last 20 Lines |