Demote error message for missing quorum in handling non-standard txes (#769)

This commit is contained in:
Doyle 2019-07-31 12:22:07 +10:00 committed by GitHub
parent 384e9c5ff6
commit 1155232048
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 15 deletions

View file

@ -180,8 +180,7 @@ namespace service_nodes
std::shared_ptr<const testing_quorum> quorum = get_testing_quorum(type, height); std::shared_ptr<const testing_quorum> quorum = get_testing_quorum(type, height);
if (!quorum) if (!quorum)
{ {
// TODO(loki): Not being able to find a quorum is fatal! We want better caching abilities. LOG_PRINT_L1("Quorum for height: " << height << ", was not stored by the daemon");
MERROR("Quorum for height: " << height << ", was not stored by the daemon");
return false; return false;
} }

View file

@ -134,14 +134,16 @@ namespace cryptonote
return false; return false;
} }
auto const quorum_type = service_nodes::quorum_type::obligations;
auto const quorum_group = service_nodes::quorum_group::worker;
crypto::public_key service_node_to_change; crypto::public_key service_node_to_change;
if (!service_node_list.get_quorum_pubkey(quorum_type, quorum_group, state_change.block_height, state_change.service_node_index, service_node_to_change)) auto const quorum_type = service_nodes::quorum_type::obligations;
{ auto const quorum_group = service_nodes::quorum_group::worker;
MERROR("Could not resolve the service node public key from the information in the state change, possibly outdated tx: " << get_transaction_hash(tx));
return false; // NOTE: We can fail to resolve a public key if we are popping blocks greater than the number of quorums we store.
} bool const can_resolve_quorum_pubkey = service_node_list.get_quorum_pubkey(quorum_type,
quorum_group,
state_change.block_height,
state_change.service_node_index,
service_node_to_change);
std::vector<transaction> pool_txs; std::vector<transaction> pool_txs;
get_transactions(pool_txs); get_transactions(pool_txs);
@ -160,18 +162,17 @@ namespace cryptonote
if (hard_fork_version >= cryptonote::network_version_12_checkpointing) if (hard_fork_version >= cryptonote::network_version_12_checkpointing)
{ {
crypto::public_key service_node_to_change_in_the_pool; crypto::public_key service_node_to_change_in_the_pool;
bool specifying_same_service_node = false; bool same_service_node = false;
if (service_node_list.get_quorum_pubkey(quorum_type, quorum_group, pool_tx_state_change.block_height, pool_tx_state_change.service_node_index, service_node_to_change_in_the_pool)) if (can_resolve_quorum_pubkey && service_node_list.get_quorum_pubkey(quorum_type, quorum_group, pool_tx_state_change.block_height, pool_tx_state_change.service_node_index, service_node_to_change_in_the_pool))
{ {
specifying_same_service_node = (service_node_to_change == service_node_to_change_in_the_pool); same_service_node = (service_node_to_change == service_node_to_change_in_the_pool);
} }
else else
{ {
MWARNING("Could not resolve the service node public key from the pooled tx state change, falling back to primitive checking method"); same_service_node = (state_change == pool_tx_state_change);
specifying_same_service_node = (state_change == pool_tx_state_change);
} }
if (specifying_same_service_node && pool_tx_state_change.state == state_change.state) if (same_service_node && pool_tx_state_change.state == state_change.state)
return true; return true;
} }
else else