Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 11 additions & 1 deletion resources/scenarios/miner_std.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#!/usr/bin/env python3

from random import randint
from time import sleep

from commander import Commander
Expand Down Expand Up @@ -35,6 +36,12 @@ def add_options(self, parser):
type=int,
help="Number of seconds between block generation (default 60 seconds)",
)
parser.add_argument(
"--random-interval",
dest="random_interval",
action="store_true",
help="Should the interval be randomized between 0 and the interval value",
)
parser.add_argument(
"--mature",
dest="mature",
Expand Down Expand Up @@ -71,7 +78,10 @@ def run_test(self):
)
except Exception as e:
self.log.error(f"node {miner.node.index} error: {e}")
sleep(self.options.interval)
if self.options.random_interval:
sleep(randint(0, self.options.interval))
else:
sleep(self.options.interval)


def main():
Expand Down
Loading