-
Notifications
You must be signed in to change notification settings - Fork 54
Use threads to parallelize tx_flood scenario #395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
willcl-ark
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Just left a few Qs, but would also be happy to merge in this state
| self.wallet = ensure_miner(self.node) | ||
| self.addr = self.wallet.getnewaddress() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Really glad to finally see this abstracted away and only called once. been meaning to do that for ages!
| try: | ||
| bal = wallet.getbalance() | ||
| if bal < 1: | ||
| continue |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we mine a block here or top-up somehow?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm leaving the block mining to other scenarios for composability. Given the randomness of this scenario, i thought it best just to skip low balance wallets. Keep in mind that even without new blocks, other nodes will be sending you bitcoin as well.
src/scenarios/tx_flood.py
Outdated
|
|
||
| BLOCKS = 100 | ||
| TXS = 100 | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps you could remove
BLOCKS = 100
TXS = 100
While you're in here? (unused?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice thanks will do
src/scenarios/tx_flood.py
Outdated
| sats = int(float((bal / 20) / num_out) * 1e8) | ||
| amounts[choice(self.addrs)] = randrange(sats // 4, sats) / 1e8 | ||
| wallet.sendmany(dummy="", amounts=amounts) | ||
| self.log.error(f"node {node.index} sent tx with {num_out} outputs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| self.log.error(f"node {node.index} sent tx with {num_out} outputs") | |
| self.log.info(f"node {node.index} sent tx with {num_out} outputs") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
whoopsie doodle
|
ACK |
This PR also improves the random attributes of transactions generated, and improves
miner_stdas well.warcli scenarios run miner_std --interval=1 --allnodes --matureWill generate 101 blocks on each tank (so something is immediately spendable) and then generate 1 block per tank after that, all at 1 second intervals
warcli scenarios run tx_floodSpawns a separate thread in
rpc-0for every tank, which tries to spend a transaction every second. An address book of all address types from all tanks is maintained in the scenario and random amounts of bitcoin are sent to a random number of addresses from that table. Each tx spends up to half the wallet's available balance although that could probably be reduced so the wallet can send more transactions between blocks. Will play with the values or maybe add some options.Going to test on 200 node cluster before switching out of draft.