Check-in [0180d2cb81]
Overview
Comment:Added more tests explicitly covering balances on old blocks
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 0180d2cb817717eb93c2ed52ecf230b28b50a63adba01c1bfaffd231736282e7
User & Date: rkeene on 2018-07-09 05:07:14
Other Links: manifest | tags
Context
2018-07-09
05:11
Updated testing to handle errors and print a cleaner output check-in: e0f108b17b user: rkeene tags: trunk
05:07
Added more tests explicitly covering balances on old blocks check-in: 0180d2cb81 user: rkeene tags: trunk
05:00
Fixed path to man page check-in: 67b692be66 user: rkeene tags: trunk
Changes

Modified test/test.tcl from [f9d5f0aa5f] to [0c80f46849].

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
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
254
255
256


257
258
259
260
261
262
263
264
265


266
267
268
269
270
271
272
273
274







+
+
+
+
+
+
+
+
+
+
+


+
+
+
+
+
+
+
+
+
+




-
-
+
+







-
-
+
+







			"type"        : "send",
			"previous"    : "F685856D73A488894F7F3A62BC3A88E17E985F9969629FF3FDD4A0D4FD823F24",
			"work"        : "efe5bf06a43d0e0a",
			"signature"   : "E373A1A38C9A239F4D2AAE52B40EF6DFC8BFEDCEB476588958073B7F462746854282FFE4B98FA6782E92798DAD0E5483C3356550A31339E1D7934B487EF4570D",
			"balance"     : "00F035A9C7D818E7C34148C524FFFFEE"
		}
	}]

	## Ensure the balance was converted
	set balance [dict get $block "balance"]
	set balance_expected "1247239665165579623600346831066759150"
	if {$balance != $balance_expected} {
		puts "\[5.FAIL\] Got: $balance"
		puts "\[5.FAIL\] Exp: $balance_expected"

		return false
	}

	## Convert to JSON
	set block [::nano::block::json::fromDict $block]

	## Ensure balance is in hex again
	set balance [dict get [::json::json2dict $block] "balance"]
	set balance_expected "00F035A9C7D818E7C34148C524FFFFEE"
	if {$balance != $balance_expected} {
		puts "\[6.FAIL\] Got: $balance"
		puts "\[6.FAIL\] Exp: $balance_expected"

		return false
	}

	## Convert back and verify signature
	set verify [::nano::block::json::verifySignature $block]
	if {!$verify} {
		puts "\[5.FAIL\] Got: $verify"
		puts "\[5.FAIL\] Exp: true"
		puts "\[7.FAIL\] Got: $verify"
		puts "\[7.FAIL\] Exp: true"

		return false
	}

	## Verify Proof of Work
	set verify [::nano::block::json::validateWork $block]
	if {!$verify} {
		puts "\[6.FAIL\] Got: $verify"
		puts "\[6.FAIL\] Exp: true"
		puts "\[8.FAIL\] Got: $verify"
		puts "\[8.FAIL\] Exp: true"

		return false
	}

	return true
}