@ -4,6 +4,7 @@
# include <lightningd/jsonrpc.h>
# include <lightningd/jsonrpc.h>
# include <lightningd/param.c>
# include <lightningd/param.c>
# include <lightningd/json.c>
# include <common/json.c>
# include <common/json.c>
# include <common/json_escaped.c>
# include <common/json_escaped.c>
# include <ccan/array_size/array_size.h>
# include <ccan/array_size/array_size.h>
@ -44,6 +45,9 @@ void command_fail_detailed(struct command *cmd, int code,
}
}
/* AUTOGENERATED MOCKS START */
/* AUTOGENERATED MOCKS START */
/* Generated stub for fmt_wireaddr_without_port */
char * fmt_wireaddr_without_port ( const tal_t * ctx UNNEEDED , const struct wireaddr * a UNNEEDED )
{ fprintf ( stderr , " fmt_wireaddr_without_port called! \n " ) ; abort ( ) ; }
/* Generated stub for json_tok_newaddr */
/* Generated stub for json_tok_newaddr */
bool json_tok_newaddr ( const char * buffer UNNEEDED , const jsmntok_t * tok UNNEEDED , bool * is_p2wpkh UNNEEDED )
bool json_tok_newaddr ( const char * buffer UNNEEDED , const jsmntok_t * tok UNNEEDED , bool * is_p2wpkh UNNEEDED )
{ fprintf ( stderr , " json_tok_newaddr called! \n " ) ; abort ( ) ; }
{ fprintf ( stderr , " json_tok_newaddr called! \n " ) ; abort ( ) ; }
@ -169,7 +173,7 @@ static void tok_tok(void)
struct json * j = json_parse ( cmd , " { 'satoshi', '546' } " ) ;
struct json * j = json_parse ( cmd , " { 'satoshi', '546' } " ) ;
assert ( param ( cmd , j - > buffer , j - > toks ,
assert ( param ( cmd , j - > buffer , j - > toks ,
p_req ( " satoshi " , json_tok_tok , & tok ) , NULL ) ) ;
p_req_tal ( " satoshi " , json_tok_tok , & tok ) , NULL ) ) ;
assert ( tok ) ;
assert ( tok ) ;
assert ( json_tok_number ( j - > buffer , tok , & n ) ) ;
assert ( json_tok_number ( j - > buffer , tok , & n ) ) ;
assert ( n = = 546 ) ;
assert ( n = = 546 ) ;
@ -181,7 +185,7 @@ static void tok_tok(void)
struct json * j = json_parse ( cmd , " {} " ) ;
struct json * j = json_parse ( cmd , " {} " ) ;
assert ( param ( cmd , j - > buffer , j - > toks ,
assert ( param ( cmd , j - > buffer , j - > toks ,
p_opt_tok ( " satoshi " , & tok ) , NULL ) ) ;
p_opt_tal ( " satoshi " , json_tok_tok , & tok ) , NULL ) ) ;
/* make sure it *is* NULL */
/* make sure it *is* NULL */
assert ( tok = = NULL ) ;
assert ( tok = = NULL ) ;
@ -369,9 +373,9 @@ static void sendpay(void)
unsigned cltv ;
unsigned cltv ;
if ( ! param ( cmd , j - > buffer , j - > toks ,
if ( ! param ( cmd , j - > buffer , j - > toks ,
p_req ( " route " , json_tok_tok , & routetok ) ,
p_req_tal ( " route " , json_tok_tok , & routetok ) ,
p_req ( " cltv " , json_tok_number , & cltv ) ,
p_req ( " cltv " , json_tok_number , & cltv ) ,
p_opt_tok ( " note " , & note ) ,
p_opt_tal ( " note " , json_tok_tok , & note ) ,
p_opt ( " msatoshi " , json_tok_u64 , & msatoshi ) ,
p_opt ( " msatoshi " , json_tok_u64 , & msatoshi ) ,
NULL ) )
NULL ) )
assert ( false ) ;
assert ( false ) ;
@ -392,9 +396,9 @@ static void sendpay_nulltok(void)
unsigned cltv ;
unsigned cltv ;
if ( ! param ( cmd , j - > buffer , j - > toks ,
if ( ! param ( cmd , j - > buffer , j - > toks ,
p_req ( " route " , json_tok_tok , & routetok ) ,
p_req_tal ( " route " , json_tok_tok , & routetok ) ,
p_req ( " cltv " , json_tok_number , & cltv ) ,
p_req ( " cltv " , json_tok_number , & cltv ) ,
p_opt_tok ( " note " , & note ) ,
p_opt_tal ( " note " , json_tok_tok , & note ) ,
p_opt ( " msatoshi " , json_tok_u64 , & msatoshi ) ,
p_opt ( " msatoshi " , json_tok_u64 , & msatoshi ) ,
NULL ) )
NULL ) )
assert ( false ) ;
assert ( false ) ;
@ -426,17 +430,6 @@ static bool json_tok_msat(struct command *cmd,
return false ;
return false ;
}
}
/* This can eventually replace json_tok_tok and we can remove the special p_opt_tok()
* macro . */
static bool json_tok_tok_x ( struct command * cmd ,
const char * name ,
const char * buffer ,
const jsmntok_t * tok ,
const jsmntok_t * * arg )
{
return ( * arg = tok ) ;
}
/*
/*
* New version of json_tok_label conforming to advanced style . This can eventually
* New version of json_tok_label conforming to advanced style . This can eventually
* replace the existing json_tok_label .
* replace the existing json_tok_label .
@ -482,7 +475,7 @@ static void advanced(void)
assert ( param ( cmd , j - > buffer , j - > toks ,
assert ( param ( cmd , j - > buffer , j - > toks ,
p_req_tal ( " description " , json_tok_label_x , & label ) ,
p_req_tal ( " description " , json_tok_label_x , & label ) ,
p_req_tal ( " msat " , json_tok_msat , & msat ) ,
p_req_tal ( " msat " , json_tok_msat , & msat ) ,
p_req_tal ( " tok " , json_tok_tok_x , & tok ) ,
p_req_tal ( " tok " , json_tok_tok , & tok ) ,
p_opt_tal ( " msat_opt1 " , json_tok_msat , & msat_opt1 ) ,
p_opt_tal ( " msat_opt1 " , json_tok_msat , & msat_opt1 ) ,
p_opt_tal ( " msat_opt2 " , json_tok_msat , & msat_opt2 ) ,
p_opt_tal ( " msat_opt2 " , json_tok_msat , & msat_opt2 ) ,
NULL ) ) ;
NULL ) ) ;