Skip to content

Commit

Permalink
Add new method getNodesServices (hyperledger#506)
Browse files Browse the repository at this point in the history
* Add new method getNodesServices

Signed-off-by: dsurnin <[email protected]>

* Add whitespace - fix flake warn

Signed-off-by: dsurnin <[email protected]>
  • Loading branch information
dsurnin authored and andkononykhin committed Jan 23, 2018
1 parent 59cf160 commit 39b2e6d
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions plenum/common/stack_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,14 @@ def getNodeInfoFromLedger(self, nym, excludeLast=True):
self.updateNodeTxns(info, txn)
return nodeTxnSeqNos, info

def getNodesServices(self):
# Returns services for each node
srvs = dict()
for _, txn in self.ledger.getAllTxn():
if txn[TXN_TYPE] == NODE:
srvs.update({txn[TARGET_NYM]: txn[DATA][SERVICES]})
return srvs

@staticmethod
def updateNodeTxns(oldTxn, newTxn):
updateNestedDict(oldTxn, newTxn, nestedKeysToUpdate=[DATA, ])

0 comments on commit 39b2e6d

Please sign in to comment.