-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
IF: Add logger for vote related logging #28
Changes from 5 commits
51728b5
b9a4ea6
8deae48
9249e47
8f8526b
c8975e6
3e6d836
2781b0f
6eb9d32
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -46,7 +46,7 @@ block_state::block_state(const block_header_state& bhs, | |
block->transactions = std::move(trx_receipts); | ||
|
||
if( qc ) { | ||
dlog("integrate qc ${qc} into block ${bn} ${id}", ("qc", qc->to_qc_claim())("bn", block_num())("id", id())); | ||
fc_dlog(vote_logger, "integrate qc ${qc} into block ${bn} ${id}", ("qc", qc->to_qc_claim())("bn", block_num())("id", id())); | ||
emplace_extension(block->block_extensions, quorum_certificate_extension::extension_id(), fc::raw::pack( *qc )); | ||
} | ||
|
||
|
@@ -141,8 +141,8 @@ void block_state::set_trxs_metas( deque<transaction_metadata_ptr>&& trxs_metas, | |
cached_trxs = std::move( trxs_metas ); | ||
} | ||
|
||
// Called from net threads | ||
vote_status block_state::aggregate_vote(const vote_message& vote) { | ||
// Called from vote threads | ||
vote_status block_state::aggregate_vote(uint32_t connection_id, const vote_message& vote) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be slightly better to pass There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Currently it uses There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Totally up to you. |
||
const auto& finalizers = active_finalizer_policy->finalizers; | ||
auto it = std::find_if(finalizers.begin(), | ||
finalizers.end(), | ||
|
@@ -151,15 +151,16 @@ vote_status block_state::aggregate_vote(const vote_message& vote) { | |
if (it != finalizers.end()) { | ||
auto index = std::distance(finalizers.begin(), it); | ||
auto digest = vote.strong ? strong_digest.to_uint8_span() : std::span<const uint8_t>(weak_digest); | ||
return pending_qc.add_vote(block_num(), | ||
return pending_qc.add_vote(connection_id, | ||
block_num(), | ||
vote.strong, | ||
digest, | ||
index, | ||
vote.finalizer_key, | ||
vote.sig, | ||
finalizers[index].weight); | ||
} else { | ||
wlog( "finalizer_key (${k}) in vote is not in finalizer policy", ("k", vote.finalizer_key) ); | ||
fc_wlog(vote_logger, "finalizer_key (${k}) in vote is not in finalizer policy", ("k", vote.finalizer_key)); | ||
return vote_status::unknown_public_key; | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
connection_id
has nothing to do with voting, it is here only for logging. Not sure if it is appropriate to add it as a parameter to vote related functions. No other ways to logconnection_id
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or hide it inside vote_message?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can't put it in
vote_message
. It is really nice to have it for debugging.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. Just add a comment in the function interface indicating connection_id is only for debugging.