Skip to content

Commit

Permalink
GH-2100 Fix threshold specification
Browse files Browse the repository at this point in the history
  • Loading branch information
heifner committed Jan 18, 2024
1 parent 7cbb392 commit 26c33c4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions tests/TestHarness/Cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -992,11 +992,14 @@ def parseClusterKeys(totalNodes):
Utils.Print(f'Found {len(producerKeys)} producer keys')
return producerKeys

def activateInstantFinality(self, launcher):
def activateInstantFinality(self, launcher, pnodes):
# call setfinalizer
numFins = len(launcher.network.nodes.values())
numFins = pnodes
threshold = int(numFins * 2 / 3 + 1)
if threshold >= pnodes:
threshold = pnodes - 1
setFinStr = f'{{"finalizer_policy": {{'
setFinStr += f' "threshold": {int(numFins * 2 / 3 + 1)}, '
setFinStr += f' "threshold": {threshold}, '
setFinStr += f' "finalizers": ['
finNum = 1
for n in launcher.network.nodes.values():
Expand Down Expand Up @@ -1091,7 +1094,7 @@ def bootstrap(self, launcher, biosNode, totalNodes, prodCount, totalProducers,
return None

if activateIF:
self.activateInstantFinality(launcher)
self.activateInstantFinality(launcher, self.productionNodesCount)

Utils.Print("Creating accounts: %s " % ", ".join(producerKeys.keys()))
producerKeys.pop(eosioName)
Expand Down

0 comments on commit 26c33c4

Please sign in to comment.