Diff

Differences From Artifact [14c732d43e]:

To Artifact [1ad7f525dc]:


218
219
220
221
222
223
224
225

226
227
228
229
230
231
232
233
234
235

236
237
238
239
240
241
242
243
244
245
246


247
248
249
250
251
252
253
218
219
220
221
222
223
224

225
226
227
228
229
230
231
232
233
234

235
236
237
238
239
240
241
242
243
244


245
246
247
248
249
250
251
252
253







-
+









-
+









-
-
+
+







}

proc test_work {} {
	# Verification
	## Positive
	set blockhash "0CF7F1E71B6C692BD8CBCF440CB1E4DF386761E6E66609563BD62A649DF6D0BE"
	set work      "01A87EEC1B6C692B"
	set verify [::nano::internal::validateWork [binary decode hex $blockhash] [binary decode hex $work]]
	set verify [::nano::work::validate $blockhash $work]
	if {!$verify} {
		puts "\[1.FAIL\] Got: $verify"
		puts "\[1.FAIL\] Exp: true"

		return false
	}

	## Negative
	set work      "11A87EEC1B6C692B"
	set verify [::nano::internal::validateWork [binary decode hex $blockhash] [binary decode hex $work]]
	set verify [::nano::work::validate $blockhash $work]
	if {$verify} {
		puts "\[2.FAIL\] Got: $verify"
		puts "\[2.FAIL\] Exp: false"

		return false
	}

	# Generation
	set blockhash "1C840FED01000000D8CBCF440CB1E4DF386761E6E66609563BD62A649DF6D0BE"
	set work      [binary encode hex [::nano::internal::generateWork [binary decode hex $blockhash]]]
	set verify [::nano::internal::validateWork [binary decode hex $blockhash] [binary decode hex $work]]
	set work      [::nano::work::fromBlockhash $blockhash]
	set verify    [::nano::work::validate $blockhash $work]
	if {!$verify} {
		puts "\[3.FAIL\] Got: $verify"
		puts "\[3.FAIL\] Exp: true"

		return false
	}