Skip to content

Conversation

@pinheadmz
Copy link
Contributor

This PR also improves the random attributes of transactions generated, and improves miner_std as well.

warcli scenarios run miner_std --interval=1 --allnodes --mature
Will 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_flood
Spawns a separate thread in rpc-0 for 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.

@pinheadmz pinheadmz marked this pull request as ready for review July 8, 2024 14:00
Copy link
Contributor

@willcl-ark willcl-ark left a 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

Comment on lines +15 to +16
self.wallet = ensure_miner(self.node)
self.addr = self.wallet.getnewaddress()
Copy link
Contributor

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
Copy link
Contributor

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?

Copy link
Contributor Author

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.


BLOCKS = 100
TXS = 100

Copy link
Contributor

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?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice thanks will do

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")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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")

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whoopsie doodle

@willcl-ark
Copy link
Contributor

ACK

@willcl-ark willcl-ark merged commit 3b12269 into bitcoin-dev-project:main Jul 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

No open projects
Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants