-
-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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
cryptonote_core: skip block notify on blockchain switching rollback #6347
Conversation
Presumably you already got notifications for the blocks in the alt chain that untimately failed, right ? If so, it seems to make more sense to not omit those notifications ? |
e0e8475
to
fcb06f7
Compare
Updated.
|
@@ -1044,6 +1044,11 @@ bool Blockchain::switch_to_alternative_blockchain(std::list<block_extended_info> | |||
reorg_notify->notify("%s", std::to_string(split_height).c_str(), "%h", std::to_string(m_db->height()).c_str(), | |||
"%n", std::to_string(m_db->height() - split_height).c_str(), "%d", std::to_string(discarded_blocks).c_str(), NULL); | |||
|
|||
std::shared_ptr<tools::Notify> block_notify = m_block_notify; |
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.
I don't see any benefit to copying the std::shared_ptr
in the original code. The copy is not atomic/thread-safe (with respect to assignment of the same std::shared_ptr
object) unless the appropriate functions are used. Was std::atomic_store
and std::atomic_load
intended to be used here?
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.
Sorry ping @moneromooo-monero
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.
Yes, I thought the pointer copy was atomic.
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.
I think the risks of issue here is low due to the init process. But something to remember for sure.
No description provided.