common: move json_stream helpers to common/json

Now that we have json_stream in common/, we can move all the related
helpers from lightningd/json to common/json. This way everyone can
benefit of them (including libplugin, the plugins themselves,
potentially lightning-cli), not lightningd alone!

Note that the Makefile of the common/test/ had to be modified, because
the new helpers make use of common/wireaddr... Which turns out to
\#include <lightingd/lightningd.h> ! So we couldnt just include the .c
and add mocks if we redefined some structs (hello run-param).
This commit is contained in:
darosior
2020-01-26 13:07:50 +01:00
committed by Rusty Russell
parent d35387f489
commit 3510c29e5d
25 changed files with 903 additions and 621 deletions

View File

@@ -1,6 +1,4 @@
#include "config.h"
#include "../amount.c"
#include "../json.c"
#include "../json_tok.c"
#include "../param.c"
#include <ccan/array_size/array_size.h>
@@ -40,9 +38,6 @@ struct command_result *command_fail(struct command *cmd,
}
/* AUTOGENERATED MOCKS START */
/* Generated stub for fromwire_fail */
const void *fromwire_fail(const u8 **cursor UNNEEDED, size_t *max UNNEEDED)
{ fprintf(stderr, "fromwire_fail called!\n"); abort(); }
/* Generated stub for json_to_channel_id */
bool json_to_channel_id(const char *buffer UNNEEDED, const jsmntok_t *tok UNNEEDED,
struct channel_id *cid UNNEEDED)