Skip to content
This repository has been archived by the owner on Jun 30, 2021. It is now read-only.

Pull starting slice from redis instead of extrapolating #154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

sbwdlihao
Copy link
Contributor

fix #146

start index may be not exist when chain first join or rejoin in mine
@sbwdlihao sbwdlihao mentioned this pull request Oct 31, 2014
@coveralls
Copy link

Coverage Status

Coverage increased (+0.01%) when pulling 1c51806 on sbwdlihao:patch-3 into 50ceb67 on simplecrypto:master.

@@ -569,8 +571,10 @@ def credit_block(redis_key, simulate=False):
for id, chain in chain_data.iteritems():
if chain['shares'] == 0:
continue
start_slice = chain['start_index'] if chain.has_key('start_index') else chain['solve_index'] - 1
Copy link
Member

Choose a reason for hiding this comment

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

I'm unsure about the correctness of this. In scenarios involving merge-mined blocks this will definitely be wrong at certain times. Effectively, something can occur where "slice 0" has most of the shares, and was rotated by a merge mined block solve. "slice 1" has a small number of shares, and was rotated due to a main network block solve.

The simplest fix is to require the "start_index" value if there are other blocks solved on the same chain already. This has it's own problems tho if the redis database gets wiped.

I'll keep thinking on this. For the large majority of cases tho this should work fine. Thanks for the work!

@icook icook changed the title Patch 3 Pull starting slice from redis instead of extrapolating Nov 6, 2014
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants