-
Notifications
You must be signed in to change notification settings - Fork 377
INDY-1879: faster way for pool transactions ordering #1010
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
INDY-1879: faster way for pool transactions ordering #1010
Conversation
Signed-off-by: toktar <[email protected]>
Signed-off-by: toktar <[email protected]>
Signed-off-by: toktar <[email protected]>
plenum/server/pool_manager.py
Outdated
# `onPoolMembershipChange` method can be called only after txn added to ledger | ||
if len(seqNos) == 0: | ||
if self.ledger.getBySeqNo(get_seq_no(txn)) is None: | ||
self._set_node_order(nodeNym, node_services=txn_data[DATA].get(SERVICES, None)) |
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.
If the condition is True, the this is a logic error, that's why we just raise and Exception.
Why do we call _set_node_order
here?
Moreover, maybe we should remove the check if self.ledger.getBySeqNo(get_seq_no(txn))
at all, since onPoolMembershipChange
can be called only after txn is already in the ledger.
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 call _set_node_order to bring state _ordered_node_services in the same way as _ordered_node_ids. To add to both dicts data of a new transaction. But this is not important and can be removed.
We can remove this check but if error will happen it will not be checked. If it's ok, I will remove this check.
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.
Removed.
# Assuming ALIAS does not change | ||
_, nodeTxn = self.getNodeInfoFromLedger(nym) | ||
return nodeTxn[DATA][ALIAS] | ||
return self._ordered_node_ids[nym] |
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.
The comment # Assuming ALIAS does not change
needs to be kept.
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.
Done.
@@ -391,10 +391,6 @@ def merkleRootHash(self) -> str: | |||
def txnSeqNo(self) -> int: | |||
return self.ledger.seqNo | |||
|
|||
def getNodeData(self, nym): | |||
_, nodeTxn = self.getNodeInfoFromLedger(nym) |
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.
Can we remove getNodeInfoFromLedger
as well?
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.
Removed.
plenum/server/pool_manager.py
Outdated
@@ -421,23 +417,28 @@ def id(self): | |||
|
|||
def _load_nodes_order_from_ledger(self): | |||
self._ordered_node_ids = OrderedDict() | |||
self._ordered_node_services = dict() |
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.
Its better to use {}
instead of dict()
.
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.
Done.
plenum/server/pool_manager.py
Outdated
self._set_node_order(txn_data[TARGET_NYM], | ||
node_name=txn_data[DATA][ALIAS]) | ||
|
||
def _set_node_order(self, node_nym, node_name=None, node_services=None): |
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.
Please create a separate method for setting node_services for a node. There is no sense to do two distinct operations in one method.
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.
Done.
sdk_node_theta_added, | ||
tdir, tconf): | ||
""" | ||
An running node's port is changed |
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.
A running
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.
Done.
Signed-off-by: toktar <[email protected]>
Signed-off-by: toktar <[email protected]>
Uh oh!
There was an error while loading. Please reload this page.