5
{ show-options-help 1 halt } : usage
11
" <index> <new-value-boc> [-x <expire-in>] [-c] [-H <old-hash>] [<savefile>]" +cr +tab
12
+"Creates a new configuration proposal for setting configuration parameter <index> to <new-value-boc> (`null` means no new value), "
13
+"and saves it as an internal message body into <savefile>.boc ('config-msg-body.boc' by default)"
14
disable-digit-options generic-help-setopt
15
"c" "--critical" { true =: critical } short-long-option
16
"Creates a critical parameter change proposal" option-help
17
"x" "--expires-in" { parse-int =: expire-in } short-long-option-arg
18
"Sets proposal expiration time in seconds (default " expire-in (.) $+ +")" option-help
19
"H" "--old-hash" { (hex-number) 1 = not .s abort"256-bit hex number expected as hash" =: old-hash }
21
"Sets the required cell hash of existing parameter value (0 means no value)" option-help
22
"h" "--help" { usage } short-long-option
23
"Shows a help message" option-help
26
$# dup 2 < swap 3 > or ' usage if
29
$1 parse-int dup =: param-idx
30
32 fits not abort"parameter index out of range"
32
$3 "config-msg-body.boc" replace-if-null =: savefile
33
expire-in now + =: expire-at
35
boc-filename dup "null" $= {
36
."New value of configuration parameter" param-idx . ."is null" cr drop null
38
."Loading new value of configuration parameter " param-idx . ."from file " dup type cr
39
boc-filename file>B B>boc
44
param-value param-idx is-valid-config? not abort"not a valid value for chosen configuration parameter"
46
critical { ."Critical" } { ."Non-critical" } cond
47
." configuration proposal will expire at " expire-at . ."(in " expire-in . ."seconds)" cr
49
now 32 << param-idx + =: query-id
50
."Query id is " query-id . cr
53
<b x{6e565052} s, query-id 64 u, expire-at 32 u,
54
<b x{f3} s, param-idx 32 i, param-value dict,
55
old-hash tuck 0>= tuck 1 i, -rot { 256 u, } { drop } cond b> ref,
58
dup ."resulting internal message body: " <s csr. cr
61
param-value dup null? { drop } {
62
totalcsize swap ."(a total of " . ."data bits, " . ."cell references -> "
63
drop dup Blen . ."BoC data bytes)" cr
67
."(Saved to file " type .")" cr