-
Notifications
You must be signed in to change notification settings - Fork 296
SynchronizationEvent: removed blocks observable #2212
Conversation
Signed-off-by: Mikhail Boldyrev <[email protected]>
Signed-off-by: Mikhail Boldyrev <[email protected]>
Signed-off-by: Mikhail Boldyrev <[email protected]>
@@ -70,6 +72,7 @@ namespace iroha { | |||
block->height(), | |||
block->hash().hex()); | |||
|
|||
// TODO add height check to predicate |
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.
Pls, leave a task number for the TODO.
irohad/ametsuchi/ledger_state.hpp
Outdated
: ledger_peers(std::move(peers)) {} | ||
LedgerState(std::shared_ptr<PeerList> peers, | ||
shared_model::interface::types::HeightType height) | ||
: ledger_peers(std::move(peers)), height(height) {} | ||
LedgerState() = default; |
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 suggest removing default ctor because it doesn't have a case in irohad.
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.
Looks good.
I tested synchronization on rejects - works.
Nothing seems to be broken.
🤞 🌐 👉 👷
Signed-off-by: Mikhail Boldyrev <[email protected]>
a7e6167
to
b5d51e4
Compare
Signed-off-by: Mikhail Boldyrev <[email protected]>
b5d51e4
to
61b925c
Compare
if (ledger_state) { | ||
new_height = (*ledger_state)->height; | ||
} else { | ||
const auto opt_new_height = getTopBlockHeight(); |
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.
It might be simpler to assume that a missing ledger state is a fatal error at the moment.
: alternative_outcome, | ||
higher_than_expected ? consensus::Round{new_height, 0} : msg.round, | ||
ledger_state ? std::move(*ledger_state) | ||
: std::unique_ptr<LedgerState>{}}); |
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.
And to ensure that this pointer is never nullptr
.
|
||
namespace iroha { | ||
using PeerList = std::vector<std::shared_ptr<shared_model::interface::Peer>>; | ||
|
||
struct LedgerState { | ||
std::shared_ptr<PeerList> ledger_peers; | ||
shared_model::interface::types::HeightType height; |
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.
Top hash can be added here.
@@ -79,6 +82,7 @@ namespace iroha { | |||
block_index_->index(*block); | |||
|
|||
top_hash_ = block->hash(); | |||
top_height_ = block->height(); |
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.
Top ledger peers can be added here, and used in chainvalidator instead of peerquery.
return boost::optional<std::unique_ptr<LedgerState>>( | ||
std::make_unique<LedgerState>( | ||
std::make_shared<PeerList>(std::move(peers)))); | ||
std::make_shared<PeerList>(std::move(peers)), |
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.
Top peers list from mutablestorage can be queried here.
Signed-off-by: Mikhail Boldyrev <[email protected]>
…eature/sync-event-without-blocks Signed-off-by: Mikhail Boldyrev <[email protected]>
…into feature/sync-event-without-blocks Signed-off-by: Mikhail Boldyrev <[email protected]>
Signed-off-by: Mikhail Boldyrev <[email protected]>
3aef52d
to
463e09e
Compare
Description of the Change
It is not needed anymore.
Benefits
Performance. Deduplication.
Possible Drawbacks
Less ways to see the blocks.
Usage Examples or Tests [optional]
Alternate Designs [optional]