dev-forget-channel: accept passing in channel_id

This patch adds a channel_id parameter to allow for specifying
channels that are lacking a short_channel_id.

Useful in the case where a peer has 1) multiple channels (ONCHAIN etc)
and 2) a channel where the funding transaction hasn't been
broadcast/mined.
This commit is contained in:
lisa neigut
2019-09-30 11:31:27 -05:00
committed by Rusty Russell
parent cbfa045f91
commit af4ffe5fcd
8 changed files with 62 additions and 0 deletions

View File

@@ -1,5 +1,6 @@
#include <bitcoin/pubkey.h>
#include <bitcoin/short_channel_id.h>
#include <ccan/ccan/str/hex/hex.h>
#include <common/amount.h>
#include <common/json_helpers.h>
#include <common/node_id.h>
@@ -84,6 +85,13 @@ bool json_to_txid(const char *buffer, const jsmntok_t *tok,
tok->end - tok->start, txid);
}
bool json_to_channel_id(const char *buffer, const jsmntok_t *tok,
struct channel_id *cid)
{
return hex_decode(buffer + tok->start, tok->end - tok->start,
cid, sizeof(*cid));
}
bool split_tok(const char *buffer, const jsmntok_t *tok,
char split,
jsmntok_t *a,