@@ -925,6 +925,19 @@ static struct command_result *reply_with_rune(struct command *cmd,
925
925
return command_finished (cmd , js );
926
926
}
927
927
928
+ static struct command_result * save_rune (struct command * cmd ,
929
+ const char * buf UNUSED ,
930
+ const jsmntok_t * result UNUSED ,
931
+ struct rune * rune )
932
+ {
933
+ const char * path = tal_fmt (cmd , "commando/runes/%s" , rune -> unique_id );
934
+ return jsonrpc_set_datastore_string (plugin , cmd , path ,
935
+ rune_to_base64 (tmpctx , rune ),
936
+ "must-create" , reply_with_rune ,
937
+ forward_error , rune );
938
+ }
939
+
940
+
928
941
static struct command_result * json_commando_rune (struct command * cmd ,
929
942
const char * buffer ,
930
943
const jsmntok_t * params )
@@ -953,7 +966,7 @@ static struct command_result *json_commando_rune(struct command *cmd,
953
966
954
967
/* Now update datastore, before returning rune */
955
968
req = jsonrpc_request_start (plugin , cmd , "datastore" ,
956
- reply_with_rune , forward_error , rune );
969
+ save_rune , forward_error , rune );
957
970
json_array_start (req -> js , "key" );
958
971
json_add_string (req -> js , NULL , "commando" );
959
972
json_add_string (req -> js , NULL , "rune_counter" );
0 commit comments