Skip to content

Commit

Permalink
Merge pull request #79 from hyperledger/master
Browse files Browse the repository at this point in the history
Add new method getNodesServices (hyperledger#506)
  • Loading branch information
spivachuk authored Jan 23, 2018
2 parents d922f5f + 39b2e6d commit 0853815
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 0853815

Please sign in to comment.