Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/processor.cpp
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | if (argsman.IsArgSet("-avaproof")) { | ||||
default: | default: | ||||
error = _("the avalanche proof is invalid"); | error = _("the avalanche proof is invalid"); | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
} | } | ||||
// Generate the delegation to the session key. | // Generate the delegation to the session key. | ||||
DelegationBuilder dgb(peerData->proof); | DelegationBuilder dgb(peerData->proof); | ||||
if (sessionKey.GetPubKey() != peerData->proof.getMaster()) { | if (!dgb.addLevel(masterKey, sessionKey.GetPubKey())) { | ||||
dgb.addLevel(masterKey, sessionKey.GetPubKey()); | error = _("failed to add a level of delegation"); | ||||
return nullptr; | |||||
} | } | ||||
peerData->delegation = dgb.build(); | peerData->delegation = dgb.build(); | ||||
} | } | ||||
// We can't use std::make_unique with a private constructor | // We can't use std::make_unique with a private constructor | ||||
return std::unique_ptr<Processor>( | return std::unique_ptr<Processor>( | ||||
new Processor(chain, connman, nodePeerManager, std::move(peerData), | new Processor(chain, connman, nodePeerManager, std::move(peerData), | ||||
std::move(sessionKey))); | std::move(sessionKey))); | ||||
▲ Show 20 Lines • Show All 424 Lines • Show Last 20 Lines |