Check-in [3a03259f8f]
Overview
Comment:Added a "filter" JSON command to filter out attributes which other implementations hate
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 3a03259f8f8139b36bd84944247fa5fac6b884a67b9cd4c948015741d5f9b1c9
User & Date: rkeene on 2018-07-11 16:28:31
Other Links: manifest | tags
Context
2018-07-11
16:47
Add a manual link for releases check-in: 2fdb28505d user: rkeene tags: trunk
16:28
Added a "filter" JSON command to filter out attributes which other implementations hate check-in: 3a03259f8f user: rkeene tags: trunk
14:26
Fixed bugs with computing work check-in: 7ffe38e93e user: rkeene tags: trunk
Changes

Modified nano.man from [b53f68eda0] to [64858d5e00].

97
98
99
100
101
102
103



104
105
106
107
108
109
110
.br
.B json::work
.I blockJSON
.RB ? -update | -work " ?" -hex | -binary ??
.br
.B json::validateWork
.I blockJSON




.B dict::toBlock
.I blockDict
.br
.B dict::fromJSON
.I blockJSON
.br







>
>
>







97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
.br
.B json::work
.I blockJSON
.RB ? -update | -work " ?" -hex | -binary ??
.br
.B json::validateWork
.I blockJSON
.br
.B json::filter
.I blockJSON

.B dict::toBlock
.I blockDict
.br
.B dict::fromJSON
.I blockJSON
.br
458
459
460
461
462
463
464









465
466
467
468
469
470
471
.TP
.B ::nano::block::json::fromDict
.I blockDict
.RI " -> " blockJSON

Converts from a Tcl dictionary representation to a JSON representation of a block.










.TP
.B ::nano::block::dict::fromJSON
.I blockJSON
.RI " -> " blockDict

Converts from a JSON object representation to a Tcl dictionary representation of a block.








>
>
>
>
>
>
>
>
>







461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
.TP
.B ::nano::block::json::fromDict
.I blockDict
.RI " -> " blockJSON

Converts from a Tcl dictionary representation to a JSON representation of a block.

.TP
.B ::nano::block::json::filter
.I blockJSON
.RI " -> " blockJSON

Filters out JSON object attributes which are not suitable for using with other
implementations, such as
.IR _comment ", " _workData ", and " _blockHash .

.TP
.B ::nano::block::dict::fromJSON
.I blockJSON
.RI " -> " blockDict

Converts from a JSON object representation to a Tcl dictionary representation of a block.

Modified nano.tcl from [e923d129c3] to [7620b741b7].

811
812
813
814
815
816
817













818
819
820
821
822
823
824
}

proc ::nano::block::json::validateWork {blockJSON} {
	set blockDict [::nano::block::dict::fromJSON $blockJSON]

	tailcall ::nano::block::dict::validateWork $blockDict
}














#   send from <account> to <account> previousBalance <balance>
#        amount <amount> sourceBlock <sourceBlockHash>
#        previous <previousBlockHash> ?representative <representative>?
proc ::nano::block::create::send {args} {
	array set block $args
	if {![info exists block(representative)]} {







>
>
>
>
>
>
>
>
>
>
>
>
>







811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
}

proc ::nano::block::json::validateWork {blockJSON} {
	set blockDict [::nano::block::dict::fromJSON $blockJSON]

	tailcall ::nano::block::dict::validateWork $blockDict
}

proc ::nano::block::json::filter {blockJSON} {
	set blockDict [::nano::block::dict::fromJSON $blockJSON]
	set blockDict [dict filter $blockDict script {key _} {
		if {[string match "_*" $key]} {
			continue
		}

		return -level 0 true
	}]
	set blockJSON [::nano::block::json::fromDict $blockDict]
	return $blockJSON
}

#   send from <account> to <account> previousBalance <balance>
#        amount <amount> sourceBlock <sourceBlockHash>
#        previous <previousBlockHash> ?representative <representative>?
proc ::nano::block::create::send {args} {
	array set block $args
	if {![info exists block(representative)]} {