Artifact [727a1db77d]

Artifact 727a1db77dd1a672edd8cb5c61d86bc37533672e972266f695955a09f37265df:


#! /usr/bin/env tclsh

package require nano

if {[llength $argv] < 2} {
	puts stderr "Usage: generate-work-rpc <rpcURL> <hash>..."

	exit 1
}

set rpcURL [lindex $argv 0]
set argv [lrange $argv 1 end]

package require http 2
::nano::rpc::client::init url $rpcURL

foreach arg $argv {
	if {[catch {
		set work [::nano::rpc::client work_generate -hash $arg -use_peers true]
		set work [dict get $work work]
	} err]} {
		puts stderr "Error generating work for \"$arg\": $err"
	} else {
		puts "WORK($arg) = $work"
	}
}