core-lightning/wire/peer_printgen.c
niftynei 23a6c00496 Makefile: import latest spec, which includes quickclose.
It also gets rid of the requirement that close negotiation fee maximum
is the old commitment transaction.  We still do that, however, to
avoid surprising old peers.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
2021-09-09 12:04:48 +09:30

3143 lines
85 KiB
C
Generated

/* 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_WARNING:
printf("WIRE_WARNING:\n");
printwire_warning("warning", 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_TX_ADD_INPUT:
printf("WIRE_TX_ADD_INPUT:\n");
printwire_tx_add_input("tx_add_input", msg);
return;
case WIRE_TX_ADD_OUTPUT:
printf("WIRE_TX_ADD_OUTPUT:\n");
printwire_tx_add_output("tx_add_output", msg);
return;
case WIRE_TX_REMOVE_INPUT:
printf("WIRE_TX_REMOVE_INPUT:\n");
printwire_tx_remove_input("tx_remove_input", msg);
return;
case WIRE_TX_REMOVE_OUTPUT:
printf("WIRE_TX_REMOVE_OUTPUT:\n");
printwire_tx_remove_output("tx_remove_output", msg);
return;
case WIRE_TX_COMPLETE:
printf("WIRE_TX_COMPLETE:\n");
printwire_tx_complete("tx_complete", msg);
return;
case WIRE_TX_SIGNATURES:
printf("WIRE_TX_SIGNATURES:\n");
printwire_tx_signatures("tx_signatures", 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_OPEN_CHANNEL2:
printf("WIRE_OPEN_CHANNEL2:\n");
printwire_open_channel2("open_channel2", msg);
return;
case WIRE_ACCEPT_CHANNEL2:
printf("WIRE_ACCEPT_CHANNEL2:\n");
printwire_accept_channel2("accept_channel2", msg);
return;
case WIRE_INIT_RBF:
printf("WIRE_INIT_RBF:\n");
printwire_init_rbf("init_rbf", msg);
return;
case WIRE_ACK_RBF:
printf("WIRE_ACK_RBF:\n");
printwire_ack_rbf("ack_rbf", 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_UPDATE_BLOCKHEIGHT:
printf("WIRE_UPDATE_BLOCKHEIGHT:\n");
printwire_update_blockheight("update_blockheight", 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;
case WIRE_ONION_MESSAGE:
printf("WIRE_ONION_MESSAGE:\n");
printwire_onion_message("onion_message", msg);
return;
}
printf("UNKNOWN: %s\\n", tal_hex(msg, msg));
}
void printwire_witness_element(const char *fieldname, const u8 **cursor, size_t *plen)
{
u16 len = fromwire_u16(cursor, plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("witness=");
printwire_u8_array(tal_fmt(NULL, "%s.witness", fieldname), cursor, plen, len);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
void printwire_lease_rates(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("funding_weight=");
u16 funding_weight = fromwire_u16(cursor, plen);
printwire_u16(tal_fmt(NULL, "%s.funding_weight", fieldname), &funding_weight);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("lease_fee_basis=");
u16 lease_fee_basis = fromwire_u16(cursor, plen);
printwire_u16(tal_fmt(NULL, "%s.lease_fee_basis", fieldname), &lease_fee_basis);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("channel_fee_max_proportional_thousandths=");
u16 channel_fee_max_proportional_thousandths = fromwire_u16(cursor, plen);
printwire_u16(tal_fmt(NULL, "%s.channel_fee_max_proportional_thousandths", fieldname), &channel_fee_max_proportional_thousandths);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("lease_fee_base_sat=");
u32 lease_fee_base_sat = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.lease_fee_base_sat", fieldname), &lease_fee_base_sat);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("channel_fee_max_base_msat=");
u32 channel_fee_max_base_msat = fromwire_tu32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.channel_fee_max_base_msat", fieldname), &channel_fee_max_base_msat);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
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;
}
}
void printwire_witness_stack(const char *fieldname, const u8 **cursor, size_t *plen)
{
u16 num_input_witness = fromwire_u16(cursor, plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("witness_element=");
printf("[");
for (size_t i = 0; i < num_input_witness; i++) {
printf("{\n");
printwire_witness_element(tal_fmt(NULL, "%s.witness_element", fieldname), cursor, plen);
printf("}\n");
}
printf("]");
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 void printwire_tlv_open_channel_tlvs_channel_type(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "channel_type");
printf("type=");
printwire_u8_array(tal_fmt(NULL, "%s.type", 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 },
{ 1, printwire_tlv_open_channel_tlvs_channel_type },
};
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 void printwire_tlv_accept_channel_tlvs_channel_type(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "channel_type");
printf("type=");
printwire_u8_array(tal_fmt(NULL, "%s.type", 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 },
{ 1, printwire_tlv_accept_channel_tlvs_channel_type },
};
static void printwire_tlv_opening_tlvs_option_upfront_shutdown_script(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "option_upfront_shutdown_script");
u16 shutdown_len = fromwire_u16(cursor, plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("shutdown_scriptpubkey=");
printwire_u8_array(tal_fmt(NULL, "%s.shutdown_scriptpubkey", fieldname), cursor, plen, shutdown_len);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_opening_tlvs_request_funds(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "request_funds");
printf("requested_sats=");
u64 requested_sats = fromwire_u64(cursor, plen);
printwire_u64(tal_fmt(NULL, "%s.requested_sats", fieldname), &requested_sats);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("blockheight=");
u32 blockheight = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.blockheight", fieldname), &blockheight);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_opening_tlvs[] = {
{ 1, printwire_tlv_opening_tlvs_option_upfront_shutdown_script },
{ 3, printwire_tlv_opening_tlvs_request_funds },
};
static void printwire_tlv_accept_tlvs_option_upfront_shutdown_script(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "option_upfront_shutdown_script");
u16 shutdown_len = fromwire_u16(cursor, plen);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("shutdown_scriptpubkey=");
printwire_u8_array(tal_fmt(NULL, "%s.shutdown_scriptpubkey", fieldname), cursor, plen, shutdown_len);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static void printwire_tlv_accept_tlvs_will_fund(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "will_fund");
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("lease_rates=");
printf("{\n");
printwire_lease_rates(tal_fmt(NULL, "%s.lease_rates", fieldname), cursor, plen);
printf("}\n");
}
static const struct tlv_print_record_type print_tlvs_accept_tlvs[] = {
{ 1, printwire_tlv_accept_tlvs_option_upfront_shutdown_script },
{ 2, printwire_tlv_accept_tlvs_will_fund },
};
static void printwire_tlv_shutdown_tlvs_wrong_funding(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "wrong_funding");
printf("txid=");
struct bitcoin_txid txid;
fromwire_bitcoin_txid(cursor, plen, &txid);
printwire_bitcoin_txid(tal_fmt(NULL, "%s.txid", fieldname), &txid);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("outnum=");
u32 outnum = fromwire_u32(cursor, plen);
printwire_u32(tal_fmt(NULL, "%s.outnum", fieldname), &outnum);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_shutdown_tlvs[] = {
{ 100, printwire_tlv_shutdown_tlvs_wrong_funding },
};
static void printwire_tlv_closing_signed_tlvs_fee_range(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "fee_range");
printf("min_fee_satoshis=");
struct amount_sat min_fee_satoshis = fromwire_amount_sat(cursor, plen);
printwire_amount_sat(tal_fmt(NULL, "%s.min_fee_satoshis", fieldname), &min_fee_satoshis);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("max_fee_satoshis=");
struct amount_sat max_fee_satoshis = fromwire_amount_sat(cursor, plen);
printwire_amount_sat(tal_fmt(NULL, "%s.max_fee_satoshis", fieldname), &max_fee_satoshis);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_closing_signed_tlvs[] = {
{ 1, printwire_tlv_closing_signed_tlvs_fee_range },
};
static void printwire_tlv_node_ann_tlvs_option_will_fund(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "option_will_fund");
printf("lease_rates=");
printf("{\n");
printwire_lease_rates(tal_fmt(NULL, "%s.lease_rates", fieldname), cursor, plen);
printf("}\n");
}
static const struct tlv_print_record_type print_tlvs_node_ann_tlvs[] = {
{ 1, printwire_tlv_node_ann_tlvs_option_will_fund },
};
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 },
};
static void printwire_tlv_onion_message_tlvs_blinding(const char *fieldname, const u8 **cursor, size_t *plen)
{
printf("(msg_name=%s)\n", "blinding");
printf("blinding=");
struct pubkey blinding;
fromwire_pubkey(cursor, plen, &blinding);
printwire_pubkey(tal_fmt(NULL, "%s.blinding", fieldname), &blinding);
if (!*cursor) {
printf("**TRUNCATED**\n");
return;
}
}
static const struct tlv_print_record_type print_tlvs_onion_message_tlvs[] = {
{ 2, printwire_tlv_onion_message_tlvs_blinding },
};
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_warning(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_WARNING) {
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_tx_add_input(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_TX_ADD_INPUT) {
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("serial_id=");
u64 serial_id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.serial_id", fieldname), &serial_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 prevtx_len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("prevtx=");
printwire_u8_array(tal_fmt(NULL, "%s.prevtx", fieldname), &cursor, &plen, prevtx_len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("prevtx_vout=");
u32 prevtx_vout = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.prevtx_vout", fieldname), &prevtx_vout);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("sequence=");
u32 sequence = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.sequence", fieldname), &sequence);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 script_sig_len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("script_sig=");
printwire_u8_array(tal_fmt(NULL, "%s.script_sig", fieldname), &cursor, &plen, script_sig_len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_tx_add_output(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_TX_ADD_OUTPUT) {
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("serial_id=");
u64 serial_id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.serial_id", fieldname), &serial_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("sats=");
u64 sats = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.sats", fieldname), &sats);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 scriptlen = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("script=");
printwire_u8_array(tal_fmt(NULL, "%s.script", fieldname), &cursor, &plen, scriptlen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_tx_remove_input(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_TX_REMOVE_INPUT) {
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("serial_id=");
u64 serial_id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.serial_id", fieldname), &serial_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_tx_remove_output(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_TX_REMOVE_OUTPUT) {
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("serial_id=");
u64 serial_id = fromwire_u64(&cursor, &plen);
printwire_u64(tal_fmt(NULL, "%s.serial_id", fieldname), &serial_id);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_tx_complete(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_TX_COMPLETE) {
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;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_tx_signatures(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_TX_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("txid=");
struct bitcoin_txid txid;
fromwire_bitcoin_txid(&cursor, &plen, &txid);
printwire_bitcoin_txid(tal_fmt(NULL, "%s.txid", fieldname), &txid);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
u16 num_witnesses = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("witness_stack=");
printf("[");
for (size_t i = 0; i < num_witnesses; i++) {
printf("{\n");
printwire_witness_stack(tal_fmt(NULL, "%s.witness_stack", fieldname), &cursor, &plen);
printf("}\n");
}
printf("]");
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_open_channel2(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_OPEN_CHANNEL2) {
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("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("funding_feerate_perkw=");
u32 funding_feerate_perkw = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.funding_feerate_perkw", fieldname), &funding_feerate_perkw);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("commitment_feerate_perkw=");
u32 commitment_feerate_perkw = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.commitment_feerate_perkw", fieldname), &commitment_feerate_perkw);
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("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("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("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("locktime=");
u32 locktime = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.locktime", fieldname), &locktime);
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_opening_tlvs, ARRAY_SIZE(print_tlvs_opening_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_accept_channel2(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ACCEPT_CHANNEL2) {
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("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("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("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_tlvs, ARRAY_SIZE(print_tlvs_accept_tlvs));
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_init_rbf(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_INIT_RBF) {
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("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("locktime=");
u32 locktime = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.locktime", fieldname), &locktime);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("funding_feerate_perkw=");
u32 funding_feerate_perkw = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.funding_feerate_perkw", fieldname), &funding_feerate_perkw);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
if (plen != 0)
printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen));
}
void printwire_ack_rbf(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ACK_RBF) {
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("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;
}
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;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_shutdown_tlvs, ARRAY_SIZE(print_tlvs_shutdown_tlvs));
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;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_closing_signed_tlvs, ARRAY_SIZE(print_tlvs_closing_signed_tlvs));
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_update_blockheight(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_BLOCKHEIGHT) {
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("blockheight=");
u32 blockheight = fromwire_u32(&cursor, &plen);
printwire_u32(tal_fmt(NULL, "%s.blockheight", fieldname), &blockheight);
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;
}
printf("tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.tlvs", fieldname), &cursor, &plen, print_tlvs_node_ann_tlvs, ARRAY_SIZE(print_tlvs_node_ann_tlvs));
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("sync_complete=");
u8 sync_complete = fromwire_u8(&cursor, &plen);
printwire_u8(tal_fmt(NULL, "%s.sync_complete", fieldname), &sync_complete);
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 printwire_onion_message(const char *fieldname, const u8 *cursor)
{
size_t plen = tal_count(cursor);
if (fromwire_u16(&cursor, &plen) != WIRE_ONION_MESSAGE) {
printf("WRONG TYPE?!\n");
return;
}
u16 len = fromwire_u16(&cursor, &plen);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("onionmsg=");
printwire_u8_array(tal_fmt(NULL, "%s.onionmsg", fieldname), &cursor, &plen, len);
if (!cursor) {
printf("**TRUNCATED**\n");
return;
}
printf("onion_message_tlvs=");
printwire_tlvs(tal_fmt(NULL, "%s.onion_message_tlvs", fieldname), &cursor, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs));
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, "opening_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_opening_tlvs, ARRAY_SIZE(print_tlvs_opening_tlvs));
}
if (strcmp(tlv_name, "accept_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_accept_tlvs, ARRAY_SIZE(print_tlvs_accept_tlvs));
}
if (strcmp(tlv_name, "shutdown_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_shutdown_tlvs, ARRAY_SIZE(print_tlvs_shutdown_tlvs));
}
if (strcmp(tlv_name, "closing_signed_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_closing_signed_tlvs, ARRAY_SIZE(print_tlvs_closing_signed_tlvs));
}
if (strcmp(tlv_name, "node_ann_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_node_ann_tlvs, ARRAY_SIZE(print_tlvs_node_ann_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));
}
if (strcmp(tlv_name, "onion_message_tlvs") == 0) {
printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs));
}
}
// SHA256STAMP:c55c98a2d8cac53c9f0db9ca4eb5ef1caac507e2f7cf4d1988cfc548efe40bbf