cardano-miners / fortuna

All the "greatness" of proof of work, now in smart contract form
https://minefortuna.com
Apache License 2.0
52 stars 23 forks source link

set timer val on each loop iter too #9

Closed zachyking closed 1 year ago

zachyking commented 1 year ago

missed this in last pr, timer wasn't being updated

MicroProofs commented 1 year ago

I think this actually breaks the miner by setting the timer every run.

MicroProofs commented 1 year ago

Also feel free to blow away my commit. Git commands didn't go well.

zachyking commented 1 year ago

I think this actually breaks the miner by setting the timer every run.

I added this because the previous one was breaking it little too, as timer wasn't being increased unless it found some hash and tried to do tx.

It would make sense to just do number of iterations before updating the state, instead of getting time on every iteration, to keep it simple.

However ideally it could use some worker threads and have main thread post messages with a new state for the worker threads (then separate thread for making txs maybe), I can probably make PR with this if you want it here?

zachyking commented 1 year ago

I added this because the previous one was breaking it little too, as timer wasn't being increased unless it found some hash and tried to do tx.

oh I am dumb yeah timer gets reset every X secs inside the condition and that's enough, it was late and I blame @Riley-Kilgore for not telling me I am wrong 😄

It would make sense to just do number of iterations before updating the state, instead of getting time on every iteration, to keep it simple.

then this could still make sense but it doesn't really matter

No other changes needed, I apologize for my confusion 😄

However ideally it could use some worker threads and have main thread post messages with a new state for the worker threads (then separate thread for making txs maybe), I can probably make PR with this if you want it here?

Though this still makes sense I think