added new reason field to status change

This commit is contained in:
Sean Darcy 2020-12-04 16:40:10 +11:00 committed by Jason Rhinelander
parent 41f389b128
commit 99ad4b5c31
4 changed files with 13 additions and 3 deletions

View File

@ -350,6 +350,7 @@ namespace cryptonote
service_nodes::new_state state;
uint64_t block_height;
uint32_t service_node_index;
uint16_t reason;
std::vector<vote> votes;
tx_extra_service_node_state_change() = default;
@ -371,6 +372,14 @@ namespace cryptonote
END_SERIALIZE()
};
// Describes the reason for a service node being decommissioned. Included in demerit votes and the decommission transaction itself.
enum Decommission_Reason {
missed_uptime_proof = 0x1,
missed_checkpoints = 0x2,
missed_pulse_participations = 0x4,
storage_server_unreachable = 0x8
};
// Pre-Heimdall service node deregistration data; it doesn't carry the state change (it is only
// used for deregistrations), and is stored slightly less efficiently in the tx extra data.
struct tx_extra_service_node_deregister_old

View File

@ -415,7 +415,7 @@ namespace service_nodes
}
}
quorum_vote_t vote = service_nodes::make_state_change_vote(m_obligations_height, static_cast<uint16_t>(index_in_group), node_index, vote_for_state, my_keys);
quorum_vote_t vote = service_nodes::make_state_change_vote(m_obligations_height, static_cast<uint16_t>(index_in_group), node_index, vote_for_state, reason,my_keys);
cryptonote::vote_verification_context vvc;
if (!handle_vote(vote, vvc))
LOG_ERROR("Failed to add state change vote; reason: " << print_vote_verification_context(vvc, &vote));

View File

@ -378,7 +378,7 @@ namespace service_nodes
return true;
}
quorum_vote_t make_state_change_vote(uint64_t block_height, uint16_t validator_index, uint16_t worker_index, new_state state, const service_node_keys &keys)
quorum_vote_t make_state_change_vote(uint64_t block_height, uint16_t validator_index, uint16_t worker_index, new_state state, uint16_t reason, const service_node_keys &keys)
{
quorum_vote_t result = {};
result.type = quorum_type::obligations;
@ -387,6 +387,7 @@ namespace service_nodes
result.index_in_group = validator_index;
result.state_change.worker_index = worker_index;
result.state_change.state = state;
result.state_change.reason = reason;
result.signature = make_signature_from_vote(result, keys);
return result;
}

View File

@ -52,7 +52,7 @@ namespace service_nodes
struct quorum;
struct checkpoint_vote { crypto::hash block_hash; };
struct state_change_vote { uint16_t worker_index; new_state state; };
struct state_change_vote { uint16_t worker_index; new_state state; uint16_t reason;};
enum struct quorum_type : uint8_t
{