Changeset View
Changeset View
Standalone View
Standalone View
src/net_processing.cpp
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
Show First 20 Lines • Show All 5,182 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVARESPONSE) { | ||||
voteOutcome = "rejected"; | voteOutcome = "rejected"; | ||||
break; | break; | ||||
case avalanche::VoteStatus::Accepted: | case avalanche::VoteStatus::Accepted: | ||||
voteOutcome = "accepted"; | voteOutcome = "accepted"; | ||||
break; | break; | ||||
case avalanche::VoteStatus::Finalized: | case avalanche::VoteStatus::Finalized: | ||||
voteOutcome = "finalized"; | voteOutcome = "finalized"; | ||||
break; | break; | ||||
case avalanche::VoteStatus::Stale: | |||||
voteOutcome = "flagged as stale"; | |||||
break; | |||||
// No default case, so the compiler can warn about missing | // No default case, so the compiler can warn about missing | ||||
// cases | // cases | ||||
} | } | ||||
LogPrint(BCLog::AVALANCHE, "Avalanche %s %s %s\n", voteOutcome, | LogPrint(BCLog::AVALANCHE, "Avalanche %s %s %s\n", voteOutcome, | ||||
voteItemTypeStr, voteItemId.ToString()); | voteItemTypeStr, voteItemId.ToString()); | ||||
}; | }; | ||||
▲ Show 20 Lines • Show All 42 Lines • ▼ Show 20 Lines | if (msg_type == NetMsgType::AVARESPONSE) { | ||||
return true; | return true; | ||||
}); | }); | ||||
})) { | })) { | ||||
LogPrint(BCLog::AVALANCHE, | LogPrint(BCLog::AVALANCHE, | ||||
"ERROR: Failed to accept proof: %s\n", | "ERROR: Failed to accept proof: %s\n", | ||||
proofid.GetHex()); | proofid.GetHex()); | ||||
} | } | ||||
break; | break; | ||||
case avalanche::VoteStatus::Stale: | |||||
// This proof is likely conflicting and unknown to most | |||||
// peers. | |||||
// TODO: Initiate peer discovery requests so we can resolve | |||||
// the conflict with the best proof. | |||||
break; | |||||
} | } | ||||
} | } | ||||
if (blockUpdates.size()) { | if (blockUpdates.size()) { | ||||
for (avalanche::BlockUpdate &u : blockUpdates) { | for (avalanche::BlockUpdate &u : blockUpdates) { | ||||
CBlockIndex *pindex = u.getVoteItem(); | CBlockIndex *pindex = u.getVoteItem(); | ||||
logVoteUpdate(u, "block", pindex->GetBlockHash()); | logVoteUpdate(u, "block", pindex->GetBlockHash()); | ||||
Show All 9 Lines | if (msg_type == NetMsgType::AVARESPONSE) { | ||||
return; | return; | ||||
} | } | ||||
} break; | } break; | ||||
case avalanche::VoteStatus::Accepted: | case avalanche::VoteStatus::Accepted: | ||||
case avalanche::VoteStatus::Finalized: { | case avalanche::VoteStatus::Finalized: { | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
::ChainstateActive().UnparkBlock(pindex); | ::ChainstateActive().UnparkBlock(pindex); | ||||
} break; | } break; | ||||
case avalanche::VoteStatus::Stale: | |||||
// For now, we shouldn't need to do anything in this | |||||
// situation, since we rely on aggressive block | |||||
// relaying. | |||||
LogPrintf("Warning: Unexpected avalanche marked block " | |||||
"%s as stale.\n", | |||||
pindex->GetBlockHash().ToString()); | |||||
break; | |||||
} | } | ||||
} | } | ||||
BlockValidationState state; | BlockValidationState state; | ||||
if (!::ChainstateActive().ActivateBestChain(config, state)) { | if (!::ChainstateActive().ActivateBestChain(config, state)) { | ||||
LogPrintf("failed to activate chain (%s)\n", state.ToString()); | LogPrintf("failed to activate chain (%s)\n", state.ToString()); | ||||
} | } | ||||
} | } | ||||
▲ Show 20 Lines • Show All 1,757 Lines • Show Last 20 Lines |