@@ -44,41 +44,24 @@ def ducos1(
44
44
expectedHash ,
45
45
start ,
46
46
end ):
47
- '''
48
- Blatently stole it from:
49
- https://github.com/colonelwatch/nonceMiner/blob/master/src/mine_DUCO_S1.c
50
- '''
51
47
global END_JOB ,calculation_result
52
48
hashcount = 0
53
-
54
49
base_hash = hashlib .sha1 (str (lastBlockHash ).encode ('ascii' ))
55
50
temp_hash = None
56
- cache = []
57
-
58
- for ducos1xxres in range (start ,end ):
51
+ for ducos1xxres in range (int (start ),int (end )):
59
52
if END_JOB :
60
- logger .info ('JOB TERMINATED' )
61
53
calculation_result = [None ,0 ,0 ,0 ,None ]
62
54
return None
63
- if ducos1xxres < 10 :
64
- temp_hash = base_hash .copy ()
65
- temp_hash .update (str (ducos1xxres ).encode ('ascii' ))
66
- elif ducos1xxres < end // 10 :
67
- temp_hash = cache [int (ducos1xxres // 10 )].copy ()
68
- temp_hash .update (str (ducos1xxres % 10 ).encode ('ascii' ))
69
- else :
70
- temp_hash = cache [ducos1xxres // 100 ].copy ()
71
- temp_hash .update (str (ducos1xxres % 100 ).encode ('ascii' ))
72
- if (ducos1xxres < end // 100 ):
73
- cache .append (temp_hash )
74
- ducos1xx = temp_hash .hexdigest ()
55
+ temp_hash = base_hash .copy ()
56
+ temp_hash .update (str (ducos1xxres ).encode ('ascii' ))
57
+ ducos1xx = temp_hash .hexdigest ()
58
+ # Increment hash counter for hashrate calculator
75
59
hashcount += 1
60
+ # Check if result was found
76
61
if ducos1xx == expectedHash :
77
62
END_JOB = True
78
- logger .debug (str (ducos1xxres ))
79
63
calculation_result = [ducos1xxres , hashcount ,start ,end ,expectedHash ]
80
64
return None
81
- logger .info ('Empty block' )
82
65
END_JOB = True
83
66
calculation_result = [None ,hashcount ,start ,end ,expectedHash ]
84
67
@@ -89,35 +72,21 @@ def ducos1xxh(
89
72
end ):
90
73
global END_JOB ,calculation_result
91
74
hashcount = 0
92
-
93
- base_hash = xxhash .xxh64 (str (lastBlockHash ).encode ('ascii' ))
75
+ base_hash = xxhash .xxh64 (str (lastBlockHash ),seed = 2811 )
94
76
temp_hash = None
95
- cache = []
96
-
97
- for ducos1xxres in range (start ,end ):
77
+ for ducos1xxres in range (int (start ),int (end )):
98
78
if END_JOB :
99
- logger .info ('JOB TERMINATED' )
100
79
calculation_result = [None ,0 ,0 ,0 ,None ]
101
80
return None
102
- if ducos1xxres < 10 :
103
- temp_hash = base_hash .copy ()
104
- temp_hash .update (str (ducos1xxres ).encode ('ascii' ))
105
- elif ducos1xxres < end // 10 :
106
- temp_hash = cache [int (ducos1xxres // 10 )].copy ()
107
- temp_hash .update (str (ducos1xxres % 10 ).encode ('ascii' ))
108
- else :
109
- temp_hash = cache [ducos1xxres // 100 ].copy ()
110
- temp_hash .update (str (ducos1xxres % 100 ).encode ('ascii' ))
111
- if (ducos1xxres < end // 100 ):
112
- cache .append (temp_hash )
113
- ducos1xx = temp_hash .hexdigest ()
81
+
82
+ temp_hash = base_hash .copy ()
83
+ temp_hash .update (str (ducos1xxres ))
84
+ ducos1xx = temp_hash .hexdigest ()
114
85
hashcount += 1
115
86
if ducos1xx == expectedHash :
116
87
END_JOB = True
117
- logger .debug ('LEFT ' + str (ducos1xxres ))
118
88
calculation_result = [ducos1xxres , hashcount ,start ,end ,expectedHash ]
119
89
return None
120
- logger .info ('Empty block' )
121
90
END_JOB = True
122
91
calculation_result = [None ,hashcount ,start ,end ,expectedHash ]
123
92
0 commit comments