You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

2039 lines
55 KiB

/* This file was generated by generate-wire.py */
/* Do not modify this file! Modify the .csv file it was generated from. */
#include "wire/peer_printgen.h"
#include <ccan/array_size/array_size.h>
#include <ccan/mem/mem.h>
#include <ccan/tal/str/str.h>
#include <common/utils.h>
#include <inttypes.h>
#include <stdio.h>
void printpeer_wire_message(const u8 *msg)
{
switch ((enum peer_wire)fromwire_peektype(msg)) {
case WIRE_INIT:
printf("WIRE_INIT:\n");
printwire_init("init", msg);
return;
case WIRE_ERROR:
printf("WIRE_ERROR:\n");
printwire_error("error", msg);
return;
case WIRE_PING:
printf("WIRE_PING:\n");
printwire_ping("ping", msg);
return;
case WIRE_PONG:
printf("WIRE_PONG:\n");
printwire_pong("pong", msg);
return;
case WIRE_OPEN_CHANNEL:
printf("WIRE_OPEN_CHANNEL:\n");
printwire_open_channel("open_channel", msg);
return;
case WIRE_ACCEPT_CHANNEL:
printf("WIRE_ACCEPT_CHANNEL:\n");
printwire_accept_channel("accept_channel", msg);
return;
case WIRE_FUNDING_CREATED:
printf("WIRE_FUNDING_CREATED:\n");
printwire_funding_created("funding_created", msg);
return;
case WIRE_FUNDING_SIGNED:
printf("WIRE_FUNDING_SIGNED:\n");
printwire_funding_signed("funding_signed", msg);
return;
case WIRE_FUNDING_LOCKED:
printf("WIRE_FUNDING_LOCKED:\n");
printwire_funding_locked("funding_locked", msg);
return;
case WIRE_SHUTDOWN:
printf("WIRE_SHUTDOWN:\n");
printwire_shutdown("shutdown", msg);
return;
case WIRE_CLOSING_SIGNED:
printf("WIRE_CLOSING_SIGNED:\n");
printwire_closing_signed("closing_signed", msg);
return;
case WIRE_UPDATE_ADD_HTLC:
printf("WIRE_UPDATE_ADD_HTLC:\n");
printwire_update_add_htlc("update_add_htlc", msg);
return;
case WIRE_UPDATE_FULFILL_HTLC:
printf("WIRE_UPDATE_FULFILL_HTLC:\n");
printwire_update_fulfill_htlc("update_fulfill_htlc", msg);
return;
case WIRE_UPDATE_FAIL_HTLC:
printf("WIRE_UPDATE_FAIL_HTLC:\n");
printwire_update_fail_htlc("update_fail_htlc", msg);
return;
case WIRE_UPDATE_FAIL_MALFORMED_HTLC:
printf("WIRE_UPDATE_FAIL_MALFORMED_HTLC:\n");
printwire_update_fail_malformed_htlc("update_fail_malformed_htlc", msg);
return;
case WIRE_COMMITMENT_SIGNED:
printf("WIRE_COMMITMENT_SIGNED:\n");
printwire_commitment_signed("commitment_signed", msg);
return;
case WIRE_REVOKE_AND_ACK:
printf("WIRE_REVOKE_AND_ACK:\n");
printwire_revoke_and_ack("revoke_and_ack", msg);
return;
case WIRE_UPDATE_FEE:
printf("WIRE_UPDATE_FEE:\n");
printwire_update_fee("update_fee", msg);
return;
case WIRE_CHANNEL_REESTABLISH:
printf("WIRE_CHANNEL_REESTABLISH:\n");
printwire_channel_reestablish("channel_reestablish", msg);
return;
case WIRE_ANNOUNCEMENT_SIGNATURES:
printf("WIRE_ANNOUNCEMENT_SIGNATURES:\n");
printwire_announcement_signatures("announcement_signatures", msg);
return;
case WIRE_CHANNEL_ANNOUNCEMENT:
printf("WIRE_CHANNEL_ANNOUNCEMENT:\n");
printwire_channel_announcement("channel_announcement", msg);
return;
case WIRE_NODE_ANNOUNCEMENT:
printf("WIRE_NODE_ANNOUNCEMENT:\n");
printwire_node_announcement("node_announcement", msg);
return;
case WIRE_CHANNEL_UPDATE:
printf("WIRE_CHANNEL_UPDATE:\n");
printwire_channel_update("channel_update", msg);
return;
case WIRE_QUERY_SHORT_CHANNEL_IDS:
printf("WIRE_QUERY_SHORT_CHANNEL_IDS:\n");
printwire_query_short_channel_ids("query_short_channel_ids", msg);
return;
case WIRE_REPLY_SHORT_CHANNEL_IDS_END:
printf("WIRE_REPLY_SHORT_CHANNEL_IDS_END:\n");
printwire_reply_short_channel_ids_end("reply_short_channel_ids_end", msg);
return;
case WIRE_QUERY_CHANNEL_RANGE:
printf("WIRE_QUERY_CHANNEL_RANGE:\n");
printwire_query_channel_range("query_channel_range", msg);
return;
case WIRE_REPLY_CHANNEL_RANGE:
printf("WIRE_REPLY_CHANNEL_RANGE:\n");
printwire_reply_channel_range("reply_channel_range", msg);
return;
case WIRE_GOSSIP_TIMESTAMP_FILTER:
printf("WIRE_GOSSIP_TIMESTAMP_FILTER:\n");
printwire_gossip_timestamp_filter("gossip_timestamp_filter", msg);
return;
}
printf("UNKNOWN: %s\\n", tal_hex(msg, msg));
}
void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("checksum_node_id_1=");
u32 checksum_node_id_1 = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.checksum_node_id_1", fieldname), &checksum_node_id_1);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("checksum_node_id_2=");
u32 checksum_node_id_2 = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.checksum_node_id_2", fieldname), &checksum_node_id_2);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("timestamp_node_id_1=");
u32 timestamp_node_id_1 = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.timestamp_node_id_1", fieldname), &timestamp_node_id_1);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("timestamp_node_id_2=");
u32 timestamp_node_id_2 = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.timestamp_node_id_2", fieldname), &timestamp_node_id_2);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_init_tlvs_networks(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "networks");
printf("chains=");
printf("[");
for (size_t i = 0; i < *plen; i++) {
struct bitcoin_blkid v;
fromwire_bitcoin_blkid(cursor, plen, &v);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chains", fieldname), &v);
}
printf("]");
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_init_tlvs[] = {
{ 1, printwire_tlv_init_tlvs_networks },
};
static void printwire_tlv_n1_tlv1(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "tlv1");
printf("amount_msat=");
u64 amount_msat = fromwire_tu64(cursor, plen);
printwire_u64(tal_fmt(NULL, "%s.amount_msat", fieldname), &amount_msat);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_n1_tlv2(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "tlv2");
printf("scid=");
struct short_channel_id scid;
fromwire_short_channel_id(cursor, plen, &scid);
printwire_short_channel_id(tal_fmt(NULL, "%s.scid", fieldname), &scid);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_n1_tlv3(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "tlv3");
printf("node_id=");
struct pubkey node_id;
fromwire_pubkey(cursor, plen, &node_id);
printwire_pubkey(tal_fmt(NULL, "%s.node_id", fieldname), &node_id);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("amount_msat_1=");
struct amount_msat amount_msat_1 = fromwire_amount_msat(cursor, plen);
printwire_amount_msat(tal_fmt(NULL, "%s.amount_msat_1", fieldname), &amount_msat_1);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("amount_msat_2=");
struct amount_msat amount_msat_2 = fromwire_amount_msat(cursor, plen);
printwire_amount_msat(tal_fmt(NULL, "%s.amount_msat_2", fieldname), &amount_msat_2);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_n1_tlv4(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "tlv4");
printf("cltv_delta=");
u16 cltv_delta = fromwire_u16(cursor, plen);
printwire_u16(tal_fmt(NULL, "%s.cltv_delta", fieldname), &cltv_delta);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_n1[] = {
{ 1, printwire_tlv_n1_tlv1 },
{ 2, printwire_tlv_n1_tlv2 },
{ 3, printwire_tlv_n1_tlv3 },
{ 254, printwire_tlv_n1_tlv4 },
};
static void printwire_tlv_n2_tlv1(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "tlv1");
printf("amount_msat=");
u64 amount_msat = fromwire_tu64(cursor, plen);
printwire_u64(tal_fmt(NULL, "%s.amount_msat", fieldname), &amount_msat);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_n2_tlv2(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "tlv2");
printf("cltv_expiry=");
u32 cltv_expiry = fromwire_tu32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.cltv_expiry", fieldname), &cltv_expiry);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_n2[] = {
{ 0, printwire_tlv_n2_tlv1 },
{ 11, printwire_tlv_n2_tlv2 },
};
static void printwire_tlv_open_channel_tlvs_upfront_shutdown_script(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "upfront_shutdown_script");
printf("shutdown_scriptpubkey=");
printwire_u8_array(tal_fmt(NULL, "%s.shutdown_scriptpubkey", fieldname), cursor, plen, *plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_open_channel_tlvs[] = {
{ 0, printwire_tlv_open_channel_tlvs_upfront_shutdown_script },
};
static void printwire_tlv_accept_channel_tlvs_upfront_shutdown_script(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "upfront_shutdown_script");
printf("shutdown_scriptpubkey=");
printwire_u8_array(tal_fmt(NULL, "%s.shutdown_scriptpubkey", fieldname), cursor, plen, *plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_accept_channel_tlvs[] = {
{ 0, printwire_tlv_accept_channel_tlvs_upfront_shutdown_script },
};
static void printwire_tlv_query_short_channel_ids_tlvs_query_flags(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "query_flags");
printf("encoding_type=");
u8 encoding_type = fromwire_u8(cursor, plen);
printwire_u8(tal_fmt(NULL, "%s.encoding_type", fieldname), &encoding_type);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("encoded_query_flags=");
printwire_u8_array(tal_fmt(NULL, "%s.encoded_query_flags", fieldname), cursor, plen, *plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_query_short_channel_ids_tlvs[] = {
{ 1, printwire_tlv_query_short_channel_ids_tlvs_query_flags },
};
static void printwire_tlv_query_channel_range_tlvs_query_option(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "query_option");
printf("query_option_flags=");
bigsize query_option_flags = fromwire_bigsize(cursor, plen);
printwire_bigsize(tal_fmt(NULL, "%s.query_option_flags", fieldname), &query_option_flags);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_query_channel_range_tlvs[] = {
{ 1, printwire_tlv_query_channel_range_tlvs_query_option },
};
static void printwire_tlv_reply_channel_range_tlvs_timestamps_tlv(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "timestamps_tlv");
printf("encoding_type=");
u8 encoding_type = fromwire_u8(cursor, plen);
printwire_u8(tal_fmt(NULL, "%s.encoding_type", fieldname), &encoding_type);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("encoded_timestamps=");
printwire_u8_array(tal_fmt(NULL, "%s.encoded_timestamps", fieldname), cursor, plen, *plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_reply_channel_range_tlvs_checksums_tlv(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "checksums_tlv");
printf("checksums=");
printf("[");
for (size_t i = 0; i < *plen; i++) {
printf("{\n");
printwire_channel_update_checksums(tal_fmt(NULL, "%s.checksums", fieldname), cursor, plen);
printf("}\n");
}
printf("]");
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_reply_channel_range_tlvs[] = {
{ 1, printwire_tlv_reply_channel_range_tlvs_timestamps_tlv },
{ 3, printwire_tlv_reply_channel_range_tlvs_checksums_tlv },
};
void printwire_init(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_INIT) {
printf("WRONG TYPE?!\n");
return;
}
u16 gflen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("globalfeatures=");
printwire_u8_array(tal_fmt(NULL, "%s.globalfeatures", fieldname), &cursor, &plen, gflen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 flen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("features=");
printwire_u8_array(tal_fmt(NULL, "%s.features", fieldname), &cursor, &plen, flen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_init_tlvs, ARRAY_SIZE(print_tlvs_init_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_error(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ERROR) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("data=");
printwire_u8_array(tal_fmt(NULL, "%s.data", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_ping(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_PING) {
printf("WRONG TYPE?!\n");
return;
}
printf("num_pong_bytes=");
u16 num_pong_bytes = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.num_pong_bytes", fieldname), &num_pong_bytes);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 byteslen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("ignored=");
printwire_u8_array(tal_fmt(NULL, "%s.ignored", fieldname), &cursor, &plen, byteslen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_pong(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_PONG) {
printf("WRONG TYPE?!\n");
return;
}
u16 byteslen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("ignored=");
printwire_u8_array(tal_fmt(NULL, "%s.ignored", fieldname), &cursor, &plen, byteslen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_open_channel(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_OPEN_CHANNEL) {
printf("WRONG TYPE?!\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("temporary_channel_id=");
struct channel_id temporary_channel_id;
fromwire_channel_id(&cursor, &plen, &temporary_channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.temporary_channel_id", fieldname), &temporary_channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("funding_satoshis=");
struct amount_sat funding_satoshis = fromwire_amount_sat(&cursor, &plen);
printwire_amount_sat(tal_fmt(NULL, "%s.funding_satoshis", fieldname), &funding_satoshis);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("push_msat=");
struct amount_msat push_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.push_msat", fieldname), &push_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("dust_limit_satoshis=");
struct amount_sat dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen);
printwire_amount_sat(tal_fmt(NULL, "%s.dust_limit_satoshis", fieldname), &dust_limit_satoshis);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("max_htlc_value_in_flight_msat=");
struct amount_msat max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.max_htlc_value_in_flight_msat", fieldname), &max_htlc_value_in_flight_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("channel_reserve_satoshis=");
struct amount_sat channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen);
printwire_amount_sat(tal_fmt(NULL, "%s.channel_reserve_satoshis", fieldname), &channel_reserve_satoshis);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("htlc_minimum_msat=");
struct amount_msat htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.htlc_minimum_msat", fieldname), &htlc_minimum_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("feerate_per_kw=");
u32 feerate_per_kw = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.feerate_per_kw", fieldname), &feerate_per_kw);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("to_self_delay=");
u16 to_self_delay = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.to_self_delay", fieldname), &to_self_delay);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("max_accepted_htlcs=");
u16 max_accepted_htlcs = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.max_accepted_htlcs", fieldname), &max_accepted_htlcs);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("funding_pubkey=");
struct pubkey funding_pubkey;
fromwire_pubkey(&cursor, &plen, &funding_pubkey);
printwire_pubkey(tal_fmt(NULL, "%s.funding_pubkey", fieldname), &funding_pubkey);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("revocation_basepoint=");
struct pubkey revocation_basepoint;
fromwire_pubkey(&cursor, &plen, &revocation_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.revocation_basepoint", fieldname), &revocation_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("payment_basepoint=");
struct pubkey payment_basepoint;
fromwire_pubkey(&cursor, &plen, &payment_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.payment_basepoint", fieldname), &payment_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("delayed_payment_basepoint=");
struct pubkey delayed_payment_basepoint;
fromwire_pubkey(&cursor, &plen, &delayed_payment_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.delayed_payment_basepoint", fieldname), &delayed_payment_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("htlc_basepoint=");
struct pubkey htlc_basepoint;
fromwire_pubkey(&cursor, &plen, &htlc_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.htlc_basepoint", fieldname), &htlc_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("first_per_commitment_point=");
struct pubkey first_per_commitment_point;
fromwire_pubkey(&cursor, &plen, &first_per_commitment_point);
printwire_pubkey(tal_fmt(NULL, "%s.first_per_commitment_point", fieldname), &first_per_commitment_point);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("channel_flags=");
u8 channel_flags = fromwire_u8(&cursor, &plen);
printwire_u8(tal_fmt(NULL, "%s.channel_flags", fieldname), &channel_flags);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_open_channel_tlvs, ARRAY_SIZE(print_tlvs_open_channel_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_accept_channel(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ACCEPT_CHANNEL) {
printf("WRONG TYPE?!\n");
return;
}
printf("temporary_channel_id=");
struct channel_id temporary_channel_id;
fromwire_channel_id(&cursor, &plen, &temporary_channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.temporary_channel_id", fieldname), &temporary_channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("dust_limit_satoshis=");
struct amount_sat dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen);
printwire_amount_sat(tal_fmt(NULL, "%s.dust_limit_satoshis", fieldname), &dust_limit_satoshis);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("max_htlc_value_in_flight_msat=");
struct amount_msat max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.max_htlc_value_in_flight_msat", fieldname), &max_htlc_value_in_flight_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("channel_reserve_satoshis=");
struct amount_sat channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen);
printwire_amount_sat(tal_fmt(NULL, "%s.channel_reserve_satoshis", fieldname), &channel_reserve_satoshis);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("htlc_minimum_msat=");
struct amount_msat htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.htlc_minimum_msat", fieldname), &htlc_minimum_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("minimum_depth=");
u32 minimum_depth = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.minimum_depth", fieldname), &minimum_depth);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("to_self_delay=");
u16 to_self_delay = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.to_self_delay", fieldname), &to_self_delay);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("max_accepted_htlcs=");
u16 max_accepted_htlcs = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.max_accepted_htlcs", fieldname), &max_accepted_htlcs);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("funding_pubkey=");
struct pubkey funding_pubkey;
fromwire_pubkey(&cursor, &plen, &funding_pubkey);
printwire_pubkey(tal_fmt(NULL, "%s.funding_pubkey", fieldname), &funding_pubkey);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("revocation_basepoint=");
struct pubkey revocation_basepoint;
fromwire_pubkey(&cursor, &plen, &revocation_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.revocation_basepoint", fieldname), &revocation_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("payment_basepoint=");
struct pubkey payment_basepoint;
fromwire_pubkey(&cursor, &plen, &payment_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.payment_basepoint", fieldname), &payment_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("delayed_payment_basepoint=");
struct pubkey delayed_payment_basepoint;
fromwire_pubkey(&cursor, &plen, &delayed_payment_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.delayed_payment_basepoint", fieldname), &delayed_payment_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("htlc_basepoint=");
struct pubkey htlc_basepoint;
fromwire_pubkey(&cursor, &plen, &htlc_basepoint);
printwire_pubkey(tal_fmt(NULL, "%s.htlc_basepoint", fieldname), &htlc_basepoint);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("first_per_commitment_point=");
struct pubkey first_per_commitment_point;
fromwire_pubkey(&cursor, &plen, &first_per_commitment_point);
printwire_pubkey(tal_fmt(NULL, "%s.first_per_commitment_point", fieldname), &first_per_commitment_point);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_accept_channel_tlvs, ARRAY_SIZE(print_tlvs_accept_channel_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_funding_created(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_FUNDING_CREATED) {
printf("WRONG TYPE?!\n");
return;
}
printf("temporary_channel_id=");
struct channel_id temporary_channel_id;
fromwire_channel_id(&cursor, &plen, &temporary_channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.temporary_channel_id", fieldname), &temporary_channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("funding_txid=");
struct bitcoin_txid funding_txid;
fromwire_bitcoin_txid(&cursor, &plen, &funding_txid);
printwire_bitcoin_txid(tal_fmt(NULL, "%s.funding_txid", fieldname), &funding_txid);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("funding_output_index=");
u16 funding_output_index = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.funding_output_index", fieldname), &funding_output_index);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("signature=");
secp256k1_ecdsa_signature signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.signature", fieldname), &signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_funding_signed(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_FUNDING_SIGNED) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("signature=");
secp256k1_ecdsa_signature signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.signature", fieldname), &signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_funding_locked(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_FUNDING_LOCKED) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("next_per_commitment_point=");
struct pubkey next_per_commitment_point;
fromwire_pubkey(&cursor, &plen, &next_per_commitment_point);
printwire_pubkey(tal_fmt(NULL, "%s.next_per_commitment_point", fieldname), &next_per_commitment_point);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_shutdown(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_SHUTDOWN) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("scriptpubkey=");
printwire_u8_array(tal_fmt(NULL, "%s.scriptpubkey", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_closing_signed(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_CLOSING_SIGNED) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("fee_satoshis=");
struct amount_sat fee_satoshis = fromwire_amount_sat(&cursor, &plen);
printwire_amount_sat(tal_fmt(NULL, "%s.fee_satoshis", fieldname), &fee_satoshis);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("signature=");
secp256k1_ecdsa_signature signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.signature", fieldname), &signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_update_add_htlc(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_ADD_HTLC) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("id=");
u64 id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.id", fieldname), &id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("amount_msat=");
struct amount_msat amount_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.amount_msat", fieldname), &amount_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("payment_hash=");
struct sha256 payment_hash;
fromwire_sha256(&cursor, &plen, &payment_hash);
printwire_sha256(tal_fmt(NULL, "%s.payment_hash", fieldname), &payment_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("cltv_expiry=");
u32 cltv_expiry = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.cltv_expiry", fieldname), &cltv_expiry);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("onion_routing_packet=");
printwire_u8_array(tal_fmt(NULL, "%s.onion_routing_packet", fieldname), &cursor, &plen, 1366);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_update_fulfill_htlc(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FULFILL_HTLC) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("id=");
u64 id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.id", fieldname), &id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("payment_preimage=");
struct preimage payment_preimage;
fromwire_preimage(&cursor, &plen, &payment_preimage);
printwire_preimage(tal_fmt(NULL, "%s.payment_preimage", fieldname), &payment_preimage);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_update_fail_htlc(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FAIL_HTLC) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("id=");
u64 id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.id", fieldname), &id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("reason=");
printwire_u8_array(tal_fmt(NULL, "%s.reason", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_update_fail_malformed_htlc(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FAIL_MALFORMED_HTLC) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("id=");
u64 id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.id", fieldname), &id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("sha256_of_onion=");
struct sha256 sha256_of_onion;
fromwire_sha256(&cursor, &plen, &sha256_of_onion);
printwire_sha256(tal_fmt(NULL, "%s.sha256_of_onion", fieldname), &sha256_of_onion);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("failure_code=");
u16 failure_code = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.failure_code", fieldname), &failure_code);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_commitment_signed(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_COMMITMENT_SIGNED) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("signature=");
secp256k1_ecdsa_signature signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.signature", fieldname), &signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 num_htlcs = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("htlc_signature=");
printf("[");
for (size_t i = 0; i < num_htlcs; i++) {
secp256k1_ecdsa_signature v;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &v);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.htlc_signature", fieldname), &v);
}
printf("]");
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_revoke_and_ack(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_REVOKE_AND_ACK) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("per_commitment_secret=");
struct secret per_commitment_secret;
fromwire_secret(&cursor, &plen, &per_commitment_secret);
printwire_secret(tal_fmt(NULL, "%s.per_commitment_secret", fieldname), &per_commitment_secret);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("next_per_commitment_point=");
struct pubkey next_per_commitment_point;
fromwire_pubkey(&cursor, &plen, &next_per_commitment_point);
printwire_pubkey(tal_fmt(NULL, "%s.next_per_commitment_point", fieldname), &next_per_commitment_point);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_update_fee(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FEE) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("feerate_per_kw=");
u32 feerate_per_kw = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.feerate_per_kw", fieldname), &feerate_per_kw);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_channel_reestablish(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_REESTABLISH) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("next_commitment_number=");
u64 next_commitment_number = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.next_commitment_number", fieldname), &next_commitment_number);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("next_revocation_number=");
u64 next_revocation_number = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.next_revocation_number", fieldname), &next_revocation_number);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("your_last_per_commitment_secret=");
struct secret your_last_per_commitment_secret;
fromwire_secret(&cursor, &plen, &your_last_per_commitment_secret);
printwire_secret(tal_fmt(NULL, "%s.your_last_per_commitment_secret", fieldname), &your_last_per_commitment_secret);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("my_current_per_commitment_point=");
struct pubkey my_current_per_commitment_point;
fromwire_pubkey(&cursor, &plen, &my_current_per_commitment_point);
printwire_pubkey(tal_fmt(NULL, "%s.my_current_per_commitment_point", fieldname), &my_current_per_commitment_point);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_announcement_signatures(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ANNOUNCEMENT_SIGNATURES) {
printf("WRONG TYPE?!\n");
return;
}
printf("channel_id=");
struct channel_id channel_id;
fromwire_channel_id(&cursor, &plen, &channel_id);
printwire_channel_id(tal_fmt(NULL, "%s.channel_id", fieldname), &channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("short_channel_id=");
struct short_channel_id short_channel_id;
fromwire_short_channel_id(&cursor, &plen, &short_channel_id);
printwire_short_channel_id(tal_fmt(NULL, "%s.short_channel_id", fieldname), &short_channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("node_signature=");
secp256k1_ecdsa_signature node_signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &node_signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.node_signature", fieldname), &node_signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("bitcoin_signature=");
secp256k1_ecdsa_signature bitcoin_signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &bitcoin_signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.bitcoin_signature", fieldname), &bitcoin_signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_channel_announcement(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_ANNOUNCEMENT) {
printf("WRONG TYPE?!\n");
return;
}
printf("node_signature_1=");
secp256k1_ecdsa_signature node_signature_1;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &node_signature_1);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.node_signature_1", fieldname), &node_signature_1);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("node_signature_2=");
secp256k1_ecdsa_signature node_signature_2;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &node_signature_2);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.node_signature_2", fieldname), &node_signature_2);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("bitcoin_signature_1=");
secp256k1_ecdsa_signature bitcoin_signature_1;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &bitcoin_signature_1);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.bitcoin_signature_1", fieldname), &bitcoin_signature_1);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("bitcoin_signature_2=");
secp256k1_ecdsa_signature bitcoin_signature_2;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &bitcoin_signature_2);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.bitcoin_signature_2", fieldname), &bitcoin_signature_2);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("features=");
printwire_u8_array(tal_fmt(NULL, "%s.features", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("short_channel_id=");
struct short_channel_id short_channel_id;
fromwire_short_channel_id(&cursor, &plen, &short_channel_id);
printwire_short_channel_id(tal_fmt(NULL, "%s.short_channel_id", fieldname), &short_channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("node_id_1=");
struct node_id node_id_1;
fromwire_node_id(&cursor, &plen, &node_id_1);
printwire_node_id(tal_fmt(NULL, "%s.node_id_1", fieldname), &node_id_1);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("node_id_2=");
struct node_id node_id_2;
fromwire_node_id(&cursor, &plen, &node_id_2);
printwire_node_id(tal_fmt(NULL, "%s.node_id_2", fieldname), &node_id_2);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("bitcoin_key_1=");
struct pubkey bitcoin_key_1;
fromwire_pubkey(&cursor, &plen, &bitcoin_key_1);
printwire_pubkey(tal_fmt(NULL, "%s.bitcoin_key_1", fieldname), &bitcoin_key_1);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("bitcoin_key_2=");
struct pubkey bitcoin_key_2;
fromwire_pubkey(&cursor, &plen, &bitcoin_key_2);
printwire_pubkey(tal_fmt(NULL, "%s.bitcoin_key_2", fieldname), &bitcoin_key_2);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_node_announcement(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_NODE_ANNOUNCEMENT) {
printf("WRONG TYPE?!\n");
return;
}
printf("signature=");
secp256k1_ecdsa_signature signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.signature", fieldname), &signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 flen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("features=");
printwire_u8_array(tal_fmt(NULL, "%s.features", fieldname), &cursor, &plen, flen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("timestamp=");
u32 timestamp = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.timestamp", fieldname), &timestamp);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("node_id=");
struct node_id node_id;
fromwire_node_id(&cursor, &plen, &node_id);
printwire_node_id(tal_fmt(NULL, "%s.node_id", fieldname), &node_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("rgb_color=");
printwire_u8_array(tal_fmt(NULL, "%s.rgb_color", fieldname), &cursor, &plen, 3);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("alias=");
printwire_u8_array(tal_fmt(NULL, "%s.alias", fieldname), &cursor, &plen, 32);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 addrlen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("addresses=");
printwire_u8_array(tal_fmt(NULL, "%s.addresses", fieldname), &cursor, &plen, addrlen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_channel_update(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_UPDATE) {
printf("WRONG TYPE?!\n");
return;
}
printf("signature=");
secp256k1_ecdsa_signature signature;
fromwire_secp256k1_ecdsa_signature(&cursor, &plen, &signature);
printwire_secp256k1_ecdsa_signature(tal_fmt(NULL, "%s.signature", fieldname), &signature);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("short_channel_id=");
struct short_channel_id short_channel_id;
fromwire_short_channel_id(&cursor, &plen, &short_channel_id);
printwire_short_channel_id(tal_fmt(NULL, "%s.short_channel_id", fieldname), &short_channel_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("timestamp=");
u32 timestamp = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.timestamp", fieldname), &timestamp);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("message_flags=");
u8 message_flags = fromwire_u8(&cursor, &plen);
printwire_u8(tal_fmt(NULL, "%s.message_flags", fieldname), &message_flags);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("channel_flags=");
u8 channel_flags = fromwire_u8(&cursor, &plen);
printwire_u8(tal_fmt(NULL, "%s.channel_flags", fieldname), &channel_flags);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("cltv_expiry_delta=");
u16 cltv_expiry_delta = fromwire_u16(&cursor, &plen);
printwire_u16(tal_fmt(NULL, "%s.cltv_expiry_delta", fieldname), &cltv_expiry_delta);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("htlc_minimum_msat=");
struct amount_msat htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.htlc_minimum_msat", fieldname), &htlc_minimum_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("fee_base_msat=");
u32 fee_base_msat = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.fee_base_msat", fieldname), &fee_base_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("fee_proportional_millionths=");
u32 fee_proportional_millionths = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.fee_proportional_millionths", fieldname), &fee_proportional_millionths);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen <= 0)
return;
printf("(option_channel_htlc_max):");
printf("htlc_maximum_msat=");
struct amount_msat htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen);
printwire_amount_msat(tal_fmt(NULL, "%s.htlc_maximum_msat", fieldname), &htlc_maximum_msat);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_query_short_channel_ids(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_QUERY_SHORT_CHANNEL_IDS) {
printf("WRONG TYPE?!\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("encoded_short_ids=");
printwire_u8_array(tal_fmt(NULL, "%s.encoded_short_ids", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_query_short_channel_ids_tlvs, ARRAY_SIZE(print_tlvs_query_short_channel_ids_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_reply_short_channel_ids_end(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_REPLY_SHORT_CHANNEL_IDS_END) {
printf("WRONG TYPE?!\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("full_information=");
u8 full_information = fromwire_u8(&cursor, &plen);
printwire_u8(tal_fmt(NULL, "%s.full_information", fieldname), &full_information);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_query_channel_range(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_QUERY_CHANNEL_RANGE) {
printf("WRONG TYPE?!\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("first_blocknum=");
u32 first_blocknum = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.first_blocknum", fieldname), &first_blocknum);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("number_of_blocks=");
u32 number_of_blocks = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.number_of_blocks", fieldname), &number_of_blocks);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_query_channel_range_tlvs, ARRAY_SIZE(print_tlvs_query_channel_range_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_reply_channel_range(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_REPLY_CHANNEL_RANGE) {
printf("WRONG TYPE?!\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("first_blocknum=");
u32 first_blocknum = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.first_blocknum", fieldname), &first_blocknum);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("number_of_blocks=");
u32 number_of_blocks = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.number_of_blocks", fieldname), &number_of_blocks);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("full_information=");
u8 full_information = fromwire_u8(&cursor, &plen);
printwire_u8(tal_fmt(NULL, "%s.full_information", fieldname), &full_information);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("encoded_short_ids=");
printwire_u8_array(tal_fmt(NULL, "%s.encoded_short_ids", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_reply_channel_range_tlvs, ARRAY_SIZE(print_tlvs_reply_channel_range_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_gossip_timestamp_filter(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_TIMESTAMP_FILTER) {
printf("WRONG TYPE?!\n");
return;
}
printf("chain_hash=");
struct bitcoin_blkid chain_hash;
fromwire_bitcoin_blkid(&cursor, &plen, &chain_hash);
printwire_bitcoin_blkid(tal_fmt(NULL, "%s.chain_hash", fieldname), &chain_hash);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("first_timestamp=");
u32 first_timestamp = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.first_timestamp", fieldname), &first_timestamp);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("timestamp_range=");
u32 timestamp_range = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.timestamp_range", fieldname), &timestamp_range);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg) {
size_t plen = tal_count(msg);
if (strcmp(tlv_name, "init_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_init_tlvs, ARRAY_SIZE(print_tlvs_init_tlvs));
}
if (strcmp(tlv_name, "n1") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_n1, ARRAY_SIZE(print_tlvs_n1));
}
if (strcmp(tlv_name, "n2") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_n2, ARRAY_SIZE(print_tlvs_n2));
}
if (strcmp(tlv_name, "open_channel_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_open_channel_tlvs, ARRAY_SIZE(print_tlvs_open_channel_tlvs));
}
if (strcmp(tlv_name, "accept_channel_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_accept_channel_tlvs, ARRAY_SIZE(print_tlvs_accept_channel_tlvs));
}
if (strcmp(tlv_name, "query_short_channel_ids_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_query_short_channel_ids_tlvs, ARRAY_SIZE(print_tlvs_query_short_channel_ids_tlvs));
}
if (strcmp(tlv_name, "query_channel_range_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_query_channel_range_tlvs, ARRAY_SIZE(print_tlvs_query_channel_range_tlvs));
}
if (strcmp(tlv_name, "reply_channel_range_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_reply_channel_range_tlvs, ARRAY_SIZE(print_tlvs_reply_channel_range_tlvs));
}
}
// SHA256STAMP:c950ebb221bc14a97d377d804daa828196be344fa4addae32351ec8a135ed45a