Index: nano.man ================================================================== --- nano.man +++ nano.man @@ -99,10 +99,13 @@ .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 @@ -460,10 +463,19 @@ .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 Index: nano.tcl ================================================================== --- nano.tcl +++ nano.tcl @@ -813,10 +813,23 @@ 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 to previousBalance # amount sourceBlock # previous ?representative ? proc ::nano::block::create::send {args} {