Changeset View
Changeset View
Standalone View
Standalone View
src/rpc/avalanche.cpp
Show First 20 Lines • Show All 609 Lines • ▼ Show 20 Lines | if (!g_avalanche) { | ||||
throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | throw JSONRPCError(RPC_INTERNAL_ERROR, "Avalanche is not initialized"); | ||||
} | } | ||||
const avalanche::ProofId proofid = | const avalanche::ProofId proofid = | ||||
avalanche::ProofId::fromHex(request.params[0].get_str()); | avalanche::ProofId::fromHex(request.params[0].get_str()); | ||||
bool isOrphan = false; | bool isOrphan = false; | ||||
auto proof = g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) { | auto proof = g_avalanche->withPeerManager([&](avalanche::PeerManager &pm) { | ||||
auto proof = pm.getProof(proofid); | isOrphan = pm.isOrphan(proofid); | ||||
if (!proof) { | return pm.getProof(proofid); | ||||
proof = pm.getOrphan(proofid); | |||||
isOrphan = true; | |||||
} | |||||
return proof; | |||||
}); | }); | ||||
if (!proof) { | if (!proof) { | ||||
throw JSONRPCError(RPC_INVALID_PARAMETER, "Proof not found"); | throw JSONRPCError(RPC_INVALID_PARAMETER, "Proof not found"); | ||||
} | } | ||||
UniValue ret(UniValue::VOBJ); | UniValue ret(UniValue::VOBJ); | ||||
▲ Show 20 Lines • Show All 98 Lines • Show Last 20 Lines |