Skip to content

Commit

Permalink
Remove hardcoded version checks to support Leap v3.1 and below.
Browse files Browse the repository at this point in the history
  • Loading branch information
greg7mdp committed Oct 18, 2024
1 parent d3d51ff commit eaf60f0
Showing 1 changed file with 7 additions and 20 deletions.
27 changes: 7 additions & 20 deletions tests/TestHarness/Node.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,26 +82,13 @@ def __init__(self, host, port, nodeId: int, data_dir: Path, config_dir: Path, cm
self.configureVersion()

def configureVersion(self):
if 'v2' in self.nodeosVers:
self.fetchTransactionCommand = lambda: "get transaction"
self.fetchTransactionFromTrace = lambda trx: trx['trx']['id']
self.fetchBlock = lambda blockNum: self.processUrllibRequest("chain", "get_block", {"block_num_or_id":blockNum}, silentErrors=False, exitOnError=True)
self.fetchKeyCommand = lambda: "[trx][trx][ref_block_num]"
self.fetchRefBlock = lambda trans: trans["trx"]["trx"]["ref_block_num"]
self.fetchHeadBlock = lambda node, headBlock: node.processUrllibRequest("chain", "get_block", {"block_num_or_id":headBlock}, silentErrors=False, exitOnError=True)
self.cleosLimit = ""

else:
self.fetchTransactionCommand = lambda: "get transaction_trace"
self.fetchTransactionFromTrace = lambda trx: trx['id']
self.fetchBlock = lambda blockNum: self.processUrllibRequest("trace_api", "get_block", {"block_num":blockNum}, silentErrors=False, exitOnError=True)
self.fetchKeyCommand = lambda: "[transaction][transaction_header][ref_block_num]"
self.fetchRefBlock = lambda trans: trans["block_num"]
self.fetchHeadBlock = lambda node, headBlock: node.processUrllibRequest("chain", "get_block_info", {"block_num":headBlock}, silentErrors=False, exitOnError=True)
if 'v3.1' in self.nodeosVers:
self.cleosLimit = ""
else:
self.cleosLimit = "--time-limit 999"
self.fetchTransactionCommand = lambda: "get transaction_trace"
self.fetchTransactionFromTrace = lambda trx: trx['id']
self.fetchBlock = lambda blockNum: self.processUrllibRequest("trace_api", "get_block", {"block_num":blockNum}, silentErrors=False, exitOnError=True)
self.fetchKeyCommand = lambda: "[transaction][transaction_header][ref_block_num]"
self.fetchRefBlock = lambda trans: trans["block_num"]
self.fetchHeadBlock = lambda node, headBlock: node.processUrllibRequest("chain", "get_block_info", {"block_num":headBlock}, silentErrors=False, exitOnError=True)
self.cleosLimit = "--time-limit 999"

def __str__(self):
return "Host: %s, Port:%d, NodeNum:%s, Pid:%s" % (self.host, self.port, self.nodeId, self.pid)
Expand Down

0 comments on commit eaf60f0

Please sign in to comment.