diff --git a/channeld/channeld_wiregen.c b/channeld/channeld_wiregen.c deleted file mode 100644 index f9feaf4c8..000000000 --- a/channeld/channeld_wiregen.c +++ /dev/null @@ -1,1182 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *channeld_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum channeld_wire)e) { - case WIRE_CHANNELD_INIT: return "WIRE_CHANNELD_INIT"; - case WIRE_CHANNELD_FUNDING_DEPTH: return "WIRE_CHANNELD_FUNDING_DEPTH"; - case WIRE_CHANNELD_OFFER_HTLC: return "WIRE_CHANNELD_OFFER_HTLC"; - case WIRE_CHANNELD_OFFER_HTLC_REPLY: return "WIRE_CHANNELD_OFFER_HTLC_REPLY"; - case WIRE_CHANNELD_FULFILL_HTLC: return "WIRE_CHANNELD_FULFILL_HTLC"; - case WIRE_CHANNELD_FAIL_HTLC: return "WIRE_CHANNELD_FAIL_HTLC"; - case WIRE_CHANNELD_GOT_FUNDING_LOCKED: return "WIRE_CHANNELD_GOT_FUNDING_LOCKED"; - case WIRE_CHANNELD_SENDING_COMMITSIG: return "WIRE_CHANNELD_SENDING_COMMITSIG"; - case WIRE_CHANNELD_SENDING_COMMITSIG_REPLY: return "WIRE_CHANNELD_SENDING_COMMITSIG_REPLY"; - case WIRE_CHANNELD_GOT_COMMITSIG: return "WIRE_CHANNELD_GOT_COMMITSIG"; - case WIRE_CHANNELD_GOT_COMMITSIG_REPLY: return "WIRE_CHANNELD_GOT_COMMITSIG_REPLY"; - case WIRE_CHANNELD_GOT_REVOKE: return "WIRE_CHANNELD_GOT_REVOKE"; - case WIRE_CHANNELD_GOT_REVOKE_REPLY: return "WIRE_CHANNELD_GOT_REVOKE_REPLY"; - case WIRE_CHANNELD_SEND_SHUTDOWN: return "WIRE_CHANNELD_SEND_SHUTDOWN"; - case WIRE_CHANNELD_GOT_SHUTDOWN: return "WIRE_CHANNELD_GOT_SHUTDOWN"; - case WIRE_CHANNELD_SHUTDOWN_COMPLETE: return "WIRE_CHANNELD_SHUTDOWN_COMPLETE"; - case WIRE_CHANNELD_DEV_REENABLE_COMMIT: return "WIRE_CHANNELD_DEV_REENABLE_COMMIT"; - case WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY: return "WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY"; - case WIRE_CHANNELD_FEERATES: return "WIRE_CHANNELD_FEERATES"; - case WIRE_CHANNELD_DEV_MEMLEAK: return "WIRE_CHANNELD_DEV_MEMLEAK"; - case WIRE_CHANNELD_DEV_MEMLEAK_REPLY: return "WIRE_CHANNELD_DEV_MEMLEAK_REPLY"; - case WIRE_CHANNELD_FAIL_FALLEN_BEHIND: return "WIRE_CHANNELD_FAIL_FALLEN_BEHIND"; - case WIRE_CHANNELD_SPECIFIC_FEERATES: return "WIRE_CHANNELD_SPECIFIC_FEERATES"; - case WIRE_CHANNELD_GOT_ANNOUNCEMENT: return "WIRE_CHANNELD_GOT_ANNOUNCEMENT"; - case WIRE_CHANNELD_SEND_ERROR: return "WIRE_CHANNELD_SEND_ERROR"; - case WIRE_CHANNELD_SEND_ERROR_REPLY: return "WIRE_CHANNELD_SEND_ERROR_REPLY"; - case WIRE_CHANNELD_DEV_QUIESCE: return "WIRE_CHANNELD_DEV_QUIESCE"; - case WIRE_CHANNELD_DEV_QUIESCE_REPLY: return "WIRE_CHANNELD_DEV_QUIESCE_REPLY"; - case WIRE_CHANNELD_UPGRADED: return "WIRE_CHANNELD_UPGRADED"; - case WIRE_CHANNELD_BLOCKHEIGHT: return "WIRE_CHANNELD_BLOCKHEIGHT"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool channeld_wire_is_defined(u16 type) -{ - switch ((enum channeld_wire)type) { - case WIRE_CHANNELD_INIT:; - case WIRE_CHANNELD_FUNDING_DEPTH:; - case WIRE_CHANNELD_OFFER_HTLC:; - case WIRE_CHANNELD_OFFER_HTLC_REPLY:; - case WIRE_CHANNELD_FULFILL_HTLC:; - case WIRE_CHANNELD_FAIL_HTLC:; - case WIRE_CHANNELD_GOT_FUNDING_LOCKED:; - case WIRE_CHANNELD_SENDING_COMMITSIG:; - case WIRE_CHANNELD_SENDING_COMMITSIG_REPLY:; - case WIRE_CHANNELD_GOT_COMMITSIG:; - case WIRE_CHANNELD_GOT_COMMITSIG_REPLY:; - case WIRE_CHANNELD_GOT_REVOKE:; - case WIRE_CHANNELD_GOT_REVOKE_REPLY:; - case WIRE_CHANNELD_SEND_SHUTDOWN:; - case WIRE_CHANNELD_GOT_SHUTDOWN:; - case WIRE_CHANNELD_SHUTDOWN_COMPLETE:; - case WIRE_CHANNELD_DEV_REENABLE_COMMIT:; - case WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY:; - case WIRE_CHANNELD_FEERATES:; - case WIRE_CHANNELD_DEV_MEMLEAK:; - case WIRE_CHANNELD_DEV_MEMLEAK_REPLY:; - case WIRE_CHANNELD_FAIL_FALLEN_BEHIND:; - case WIRE_CHANNELD_SPECIFIC_FEERATES:; - case WIRE_CHANNELD_GOT_ANNOUNCEMENT:; - case WIRE_CHANNELD_SEND_ERROR:; - case WIRE_CHANNELD_SEND_ERROR_REPLY:; - case WIRE_CHANNELD_DEV_QUIESCE:; - case WIRE_CHANNELD_DEV_QUIESCE_REPLY:; - case WIRE_CHANNELD_UPGRADED:; - case WIRE_CHANNELD_BLOCKHEIGHT:; - return true; - } - return false; -} - - - - - -/* WIRE: CHANNELD_INIT */ -/* Begin! (passes gossipd-client fd) */ -u8 *towire_channeld_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, u32 minimum_depth, u32 our_blockheight, const struct height_states *blockheight_states, u32 lease_expiry, const struct channel_config *our_config, const struct channel_config *their_config, const struct fee_states *fee_states, u32 feerate_min, u32 feerate_max, u32 feerate_penalty, const struct bitcoin_signature *first_commit_sig, const struct per_peer_state *per_peer_state, const struct pubkey *remote_fundingkey, const struct basepoints *remote_basepoints, const struct pubkey *remote_per_commit, const struct pubkey *old_remote_per_commit, enum side opener, u32 fee_base, u32 fee_proportional, struct amount_msat local_msatoshi, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct node_id *local_node_id, const struct node_id *remote_node_id, u32 commit_msec, u16 cltv_delta, bool last_was_revoke, const struct changed_htlc *last_sent_commit, u64 next_index_local, u64 next_index_remote, u64 revocations_received, u64 next_htlc_id, const struct existing_htlc **htlcs, bool local_funding_locked, bool remote_funding_locked, const struct short_channel_id *funding_short_id, bool reestablish, bool send_shutdown, bool remote_shutdown_received, const u8 *final_scriptpubkey, u8 flags, const u8 *init_peer_pkt, bool reached_announce_depth, const struct secret *last_remote_secret, const u8 *their_features, const u8 *upfront_shutdown_script, const secp256k1_ecdsa_signature *remote_ann_node_sig, const secp256k1_ecdsa_signature *remote_ann_bitcoin_sig, const struct channel_type *desired_type, bool dev_fast_gossip, bool dev_fail_process_onionpacket, const struct penalty_base *pbases, const u8 *reestablish_only) -{ - u16 num_last_sent_commit = tal_count(last_sent_commit); - u16 num_existing_htlcs = tal_count(htlcs); - u16 final_scriptpubkey_len = tal_count(final_scriptpubkey); - u16 init_peer_pkt_len = tal_count(init_peer_pkt); - u16 flen = tal_count(their_features); - u16 upfront_shutdown_script_len = tal_count(upfront_shutdown_script); - u32 num_penalty_bases = tal_count(pbases); - u16 reestablish_only_len = tal_count(reestablish_only); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_INIT); - towire_chainparams(&p, chainparams); - towire_feature_set(&p, our_features); - towire_channel_id(&p, channel_id); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_amount_sat(&p, funding_satoshi); - towire_u32(&p, minimum_depth); - towire_u32(&p, our_blockheight); - towire_height_states(&p, blockheight_states); - towire_u32(&p, lease_expiry); - towire_channel_config(&p, our_config); - towire_channel_config(&p, their_config); - towire_fee_states(&p, fee_states); - towire_u32(&p, feerate_min); - towire_u32(&p, feerate_max); - towire_u32(&p, feerate_penalty); - towire_bitcoin_signature(&p, first_commit_sig); - towire_per_peer_state(&p, per_peer_state); - towire_pubkey(&p, remote_fundingkey); - towire_basepoints(&p, remote_basepoints); - towire_pubkey(&p, remote_per_commit); - towire_pubkey(&p, old_remote_per_commit); - towire_side(&p, opener); - towire_u32(&p, fee_base); - towire_u32(&p, fee_proportional); - towire_amount_msat(&p, local_msatoshi); - towire_basepoints(&p, our_basepoints); - towire_pubkey(&p, our_funding_pubkey); - towire_node_id(&p, local_node_id); - towire_node_id(&p, remote_node_id); - towire_u32(&p, commit_msec); - towire_u16(&p, cltv_delta); - towire_bool(&p, last_was_revoke); - towire_u16(&p, num_last_sent_commit); - for (size_t i = 0; i < num_last_sent_commit; i++) - towire_changed_htlc(&p, last_sent_commit + i); - towire_u64(&p, next_index_local); - towire_u64(&p, next_index_remote); - towire_u64(&p, revocations_received); - towire_u64(&p, next_htlc_id); - towire_u16(&p, num_existing_htlcs); - for (size_t i = 0; i < num_existing_htlcs; i++) - towire_existing_htlc(&p, htlcs[i]); - towire_bool(&p, local_funding_locked); - towire_bool(&p, remote_funding_locked); - towire_short_channel_id(&p, funding_short_id); - towire_bool(&p, reestablish); - towire_bool(&p, send_shutdown); - towire_bool(&p, remote_shutdown_received); - towire_u16(&p, final_scriptpubkey_len); - towire_u8_array(&p, final_scriptpubkey, final_scriptpubkey_len); - towire_u8(&p, flags); - towire_u16(&p, init_peer_pkt_len); - towire_u8_array(&p, init_peer_pkt, init_peer_pkt_len); - towire_bool(&p, reached_announce_depth); - towire_secret(&p, last_remote_secret); - towire_u16(&p, flen); - towire_u8_array(&p, their_features, flen); - towire_u16(&p, upfront_shutdown_script_len); - towire_u8_array(&p, upfront_shutdown_script, upfront_shutdown_script_len); - if (!remote_ann_node_sig) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secp256k1_ecdsa_signature(&p, remote_ann_node_sig); - } - if (!remote_ann_bitcoin_sig) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secp256k1_ecdsa_signature(&p, remote_ann_bitcoin_sig); - } - towire_channel_type(&p, desired_type); - towire_bool(&p, dev_fast_gossip); - towire_bool(&p, dev_fail_process_onionpacket); - towire_u32(&p, num_penalty_bases); - for (size_t i = 0; i < num_penalty_bases; i++) - towire_penalty_base(&p, pbases + i); - towire_u16(&p, reestablish_only_len); - towire_u8_array(&p, reestablish_only, reestablish_only_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, u32 *minimum_depth, u32 *our_blockheight, struct height_states **blockheight_states, u32 *lease_expiry, struct channel_config *our_config, struct channel_config *their_config, struct fee_states **fee_states, u32 *feerate_min, u32 *feerate_max, u32 *feerate_penalty, struct bitcoin_signature *first_commit_sig, struct per_peer_state **per_peer_state, struct pubkey *remote_fundingkey, struct basepoints *remote_basepoints, struct pubkey *remote_per_commit, struct pubkey *old_remote_per_commit, enum side *opener, u32 *fee_base, u32 *fee_proportional, struct amount_msat *local_msatoshi, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct node_id *local_node_id, struct node_id *remote_node_id, u32 *commit_msec, u16 *cltv_delta, bool *last_was_revoke, struct changed_htlc **last_sent_commit, u64 *next_index_local, u64 *next_index_remote, u64 *revocations_received, u64 *next_htlc_id, struct existing_htlc ***htlcs, bool *local_funding_locked, bool *remote_funding_locked, struct short_channel_id *funding_short_id, bool *reestablish, bool *send_shutdown, bool *remote_shutdown_received, u8 **final_scriptpubkey, u8 *flags, u8 **init_peer_pkt, bool *reached_announce_depth, struct secret *last_remote_secret, u8 **their_features, u8 **upfront_shutdown_script, secp256k1_ecdsa_signature **remote_ann_node_sig, secp256k1_ecdsa_signature **remote_ann_bitcoin_sig, struct channel_type **desired_type, bool *dev_fast_gossip, bool *dev_fail_process_onionpacket, struct penalty_base **pbases, u8 **reestablish_only) -{ - u16 num_last_sent_commit; - u16 num_existing_htlcs; - u16 final_scriptpubkey_len; - u16 init_peer_pkt_len; - u16 flen; - u16 upfront_shutdown_script_len; - u32 num_penalty_bases; - u16 reestablish_only_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_INIT) - return false; - fromwire_chainparams(&cursor, &plen, chainparams); - *our_features = fromwire_feature_set(ctx, &cursor, &plen); - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *funding_satoshi = fromwire_amount_sat(&cursor, &plen); - *minimum_depth = fromwire_u32(&cursor, &plen); - *our_blockheight = fromwire_u32(&cursor, &plen); - *blockheight_states = fromwire_height_states(ctx, &cursor, &plen); - *lease_expiry = fromwire_u32(&cursor, &plen); - fromwire_channel_config(&cursor, &plen, our_config); - fromwire_channel_config(&cursor, &plen, their_config); - *fee_states = fromwire_fee_states(ctx, &cursor, &plen); - *feerate_min = fromwire_u32(&cursor, &plen); - *feerate_max = fromwire_u32(&cursor, &plen); - *feerate_penalty = fromwire_u32(&cursor, &plen); - fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig); - *per_peer_state = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, remote_fundingkey); - fromwire_basepoints(&cursor, &plen, remote_basepoints); - fromwire_pubkey(&cursor, &plen, remote_per_commit); - fromwire_pubkey(&cursor, &plen, old_remote_per_commit); - *opener = fromwire_side(&cursor, &plen); - *fee_base = fromwire_u32(&cursor, &plen); - *fee_proportional = fromwire_u32(&cursor, &plen); - *local_msatoshi = fromwire_amount_msat(&cursor, &plen); - fromwire_basepoints(&cursor, &plen, our_basepoints); - fromwire_pubkey(&cursor, &plen, our_funding_pubkey); - fromwire_node_id(&cursor, &plen, local_node_id); - fromwire_node_id(&cursor, &plen, remote_node_id); - *commit_msec = fromwire_u32(&cursor, &plen); - *cltv_delta = fromwire_u16(&cursor, &plen); - *last_was_revoke = fromwire_bool(&cursor, &plen); - num_last_sent_commit = fromwire_u16(&cursor, &plen); - // 2nd case last_sent_commit - *last_sent_commit = num_last_sent_commit ? tal_arr(ctx, struct changed_htlc, num_last_sent_commit) : NULL; - for (size_t i = 0; i < num_last_sent_commit; i++) - fromwire_changed_htlc(&cursor, &plen, *last_sent_commit + i); - *next_index_local = fromwire_u64(&cursor, &plen); - *next_index_remote = fromwire_u64(&cursor, &plen); - *revocations_received = fromwire_u64(&cursor, &plen); - *next_htlc_id = fromwire_u64(&cursor, &plen); - num_existing_htlcs = fromwire_u16(&cursor, &plen); - // 2nd case htlcs - *htlcs = num_existing_htlcs ? tal_arr(ctx, struct existing_htlc *, num_existing_htlcs) : NULL; - for (size_t i = 0; i < num_existing_htlcs; i++) - (*htlcs)[i] = fromwire_existing_htlc(*htlcs, &cursor, &plen); - *local_funding_locked = fromwire_bool(&cursor, &plen); - *remote_funding_locked = fromwire_bool(&cursor, &plen); - fromwire_short_channel_id(&cursor, &plen, funding_short_id); - *reestablish = fromwire_bool(&cursor, &plen); - *send_shutdown = fromwire_bool(&cursor, &plen); - *remote_shutdown_received = fromwire_bool(&cursor, &plen); - final_scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case final_scriptpubkey - *final_scriptpubkey = final_scriptpubkey_len ? tal_arr(ctx, u8, final_scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *final_scriptpubkey, final_scriptpubkey_len); - *flags = fromwire_u8(&cursor, &plen); - init_peer_pkt_len = fromwire_u16(&cursor, &plen); - // 2nd case init_peer_pkt - *init_peer_pkt = init_peer_pkt_len ? tal_arr(ctx, u8, init_peer_pkt_len) : NULL; - fromwire_u8_array(&cursor, &plen, *init_peer_pkt, init_peer_pkt_len); - *reached_announce_depth = fromwire_bool(&cursor, &plen); - fromwire_secret(&cursor, &plen, last_remote_secret); - flen = fromwire_u16(&cursor, &plen); - // 2nd case their_features - *their_features = flen ? tal_arr(ctx, u8, flen) : NULL; - fromwire_u8_array(&cursor, &plen, *their_features, flen); - upfront_shutdown_script_len = fromwire_u16(&cursor, &plen); - // 2nd case upfront_shutdown_script - *upfront_shutdown_script = upfront_shutdown_script_len ? tal_arr(ctx, u8, upfront_shutdown_script_len) : NULL; - fromwire_u8_array(&cursor, &plen, *upfront_shutdown_script, upfront_shutdown_script_len); - if (!fromwire_bool(&cursor, &plen)) - *remote_ann_node_sig = NULL; - else { - *remote_ann_node_sig = tal(ctx, secp256k1_ecdsa_signature); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *remote_ann_node_sig); - } - if (!fromwire_bool(&cursor, &plen)) - *remote_ann_bitcoin_sig = NULL; - else { - *remote_ann_bitcoin_sig = tal(ctx, secp256k1_ecdsa_signature); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *remote_ann_bitcoin_sig); - } - *desired_type = fromwire_channel_type(ctx, &cursor, &plen); - *dev_fast_gossip = fromwire_bool(&cursor, &plen); - *dev_fail_process_onionpacket = fromwire_bool(&cursor, &plen); - num_penalty_bases = fromwire_u32(&cursor, &plen); - // 2nd case pbases - *pbases = num_penalty_bases ? tal_arr(ctx, struct penalty_base, num_penalty_bases) : NULL; - for (size_t i = 0; i < num_penalty_bases; i++) - fromwire_penalty_base(&cursor, &plen, *pbases + i); - reestablish_only_len = fromwire_u16(&cursor, &plen); - // 2nd case reestablish_only - *reestablish_only = reestablish_only_len ? tal_arr(ctx, u8, reestablish_only_len) : NULL; - fromwire_u8_array(&cursor, &plen, *reestablish_only, reestablish_only_len); - return cursor != NULL; -} - -/* WIRE: CHANNELD_FUNDING_DEPTH */ -/* master->channeld funding hit new depth(funding locked if >= lock depth) */ -u8 *towire_channeld_funding_depth(const tal_t *ctx, const struct short_channel_id *short_channel_id, u32 depth) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_FUNDING_DEPTH); - if (!short_channel_id) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_short_channel_id(&p, short_channel_id); - } - towire_u32(&p, depth); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_funding_depth(const tal_t *ctx, const void *p, struct short_channel_id **short_channel_id, u32 *depth) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_FUNDING_DEPTH) - return false; - if (!fromwire_bool(&cursor, &plen)) - *short_channel_id = NULL; - else { - *short_channel_id = tal(ctx, struct short_channel_id); - fromwire_short_channel_id(&cursor, &plen, *short_channel_id); - } - *depth = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_OFFER_HTLC */ -/* Tell channel to offer this htlc */ -u8 *towire_channeld_offer_htlc(const tal_t *ctx, struct amount_msat amount_msat, u32 cltv_expiry, const struct sha256 *payment_hash, const u8 onion_routing_packet[1366], const struct pubkey *blinding) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_OFFER_HTLC); - towire_amount_msat(&p, amount_msat); - towire_u32(&p, cltv_expiry); - towire_sha256(&p, payment_hash); - towire_u8_array(&p, onion_routing_packet, 1366); - if (!blinding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, blinding); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_offer_htlc(const tal_t *ctx, const void *p, struct amount_msat *amount_msat, u32 *cltv_expiry, struct sha256 *payment_hash, u8 onion_routing_packet[1366], struct pubkey **blinding) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_OFFER_HTLC) - return false; - *amount_msat = fromwire_amount_msat(&cursor, &plen); - *cltv_expiry = fromwire_u32(&cursor, &plen); - fromwire_sha256(&cursor, &plen, payment_hash); - fromwire_u8_array(&cursor, &plen, onion_routing_packet, 1366); - if (!fromwire_bool(&cursor, &plen)) - *blinding = NULL; - else { - *blinding = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *blinding); - } - return cursor != NULL; -} - -/* WIRE: CHANNELD_OFFER_HTLC_REPLY */ -/* Reply; synchronous since IDs have to increment. */ -u8 *towire_channeld_offer_htlc_reply(const tal_t *ctx, u64 id, const u8 *failuremsg, const wirestring *failurestr) -{ - u16 len = tal_count(failuremsg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_OFFER_HTLC_REPLY); - towire_u64(&p, id); - /* Empty failure message means success. */ - towire_u16(&p, len); - towire_u8_array(&p, failuremsg, len); - towire_wirestring(&p, failurestr); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_offer_htlc_reply(const tal_t *ctx, const void *p, u64 *id, u8 **failuremsg, wirestring **failurestr) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_OFFER_HTLC_REPLY) - return false; - *id = fromwire_u64(&cursor, &plen); - /* Empty failure message means success. */ - len = fromwire_u16(&cursor, &plen); - // 2nd case failuremsg - *failuremsg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *failuremsg, len); - *failurestr = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_FULFILL_HTLC */ -/* Main daemon found out the preimage for an HTLC */ -u8 *towire_channeld_fulfill_htlc(const tal_t *ctx, const struct fulfilled_htlc *fulfilled_htlc) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_FULFILL_HTLC); - towire_fulfilled_htlc(&p, fulfilled_htlc); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_fulfill_htlc(const void *p, struct fulfilled_htlc *fulfilled_htlc) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_FULFILL_HTLC) - return false; - fromwire_fulfilled_htlc(&cursor, &plen, fulfilled_htlc); - return cursor != NULL; -} - -/* WIRE: CHANNELD_FAIL_HTLC */ -/* Main daemon says HTLC failed */ -u8 *towire_channeld_fail_htlc(const tal_t *ctx, const struct failed_htlc *failed_htlc) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_FAIL_HTLC); - towire_failed_htlc(&p, failed_htlc); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_fail_htlc(const tal_t *ctx, const void *p, struct failed_htlc **failed_htlc) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_FAIL_HTLC) - return false; - *failed_htlc = fromwire_failed_htlc(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_FUNDING_LOCKED */ -/* When we receive funding_locked. */ -u8 *towire_channeld_got_funding_locked(const tal_t *ctx, const struct pubkey *next_per_commit_point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_FUNDING_LOCKED); - towire_pubkey(&p, next_per_commit_point); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_funding_locked(const void *p, struct pubkey *next_per_commit_point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_FUNDING_LOCKED) - return false; - fromwire_pubkey(&cursor, &plen, next_per_commit_point); - return cursor != NULL; -} - -/* WIRE: CHANNELD_SENDING_COMMITSIG */ -/* When we send a commitment_signed message */ -u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const struct penalty_base *pbase, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct bitcoin_signature *commit_sig, const struct bitcoin_signature *htlc_sigs) -{ - u16 num_changed = tal_count(changed); - u16 num_htlc_sigs = tal_count(htlc_sigs); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SENDING_COMMITSIG); - towire_u64(&p, commitnum); - if (!pbase) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_penalty_base(&p, pbase); - } - towire_fee_states(&p, fee_states); - towire_height_states(&p, blockheight_states); - /* SENT_ADD_COMMIT */ - towire_u16(&p, num_changed); - for (size_t i = 0; i < num_changed; i++) - towire_changed_htlc(&p, changed + i); - towire_bitcoin_signature(&p, commit_sig); - towire_u16(&p, num_htlc_sigs); - for (size_t i = 0; i < num_htlc_sigs; i++) - towire_bitcoin_signature(&p, htlc_sigs + i); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct penalty_base **pbase, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct bitcoin_signature *commit_sig, struct bitcoin_signature **htlc_sigs) -{ - u16 num_changed; - u16 num_htlc_sigs; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SENDING_COMMITSIG) - return false; - *commitnum = fromwire_u64(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *pbase = NULL; - else { - *pbase = tal(ctx, struct penalty_base); - fromwire_penalty_base(&cursor, &plen, *pbase); - } - *fee_states = fromwire_fee_states(ctx, &cursor, &plen); - *blockheight_states = fromwire_height_states(ctx, &cursor, &plen); - /* SENT_ADD_COMMIT */ - num_changed = fromwire_u16(&cursor, &plen); - // 2nd case changed - *changed = num_changed ? tal_arr(ctx, struct changed_htlc, num_changed) : NULL; - for (size_t i = 0; i < num_changed; i++) - fromwire_changed_htlc(&cursor, &plen, *changed + i); - fromwire_bitcoin_signature(&cursor, &plen, commit_sig); - num_htlc_sigs = fromwire_u16(&cursor, &plen); - // 2nd case htlc_sigs - *htlc_sigs = num_htlc_sigs ? tal_arr(ctx, struct bitcoin_signature, num_htlc_sigs) : NULL; - for (size_t i = 0; i < num_htlc_sigs; i++) - fromwire_bitcoin_signature(&cursor, &plen, *htlc_sigs + i); - return cursor != NULL; -} - -/* WIRE: CHANNELD_SENDING_COMMITSIG_REPLY */ -/* Wait for reply */ -u8 *towire_channeld_sending_commitsig_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SENDING_COMMITSIG_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_sending_commitsig_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SENDING_COMMITSIG_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_COMMITSIG */ -/* When we have a commitment_signed message */ -u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct bitcoin_signature *signature, const struct bitcoin_signature *htlc_signature, const struct added_htlc *added, const struct fulfilled_htlc *fulfilled, const struct failed_htlc **failed, const struct changed_htlc *changed, const struct bitcoin_tx *tx) -{ - u16 num_htlcs = tal_count(htlc_signature); - u16 num_added = tal_count(added); - u16 num_fulfilled = tal_count(fulfilled); - u16 num_failed = tal_count(failed); - u16 num_changed = tal_count(changed); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_COMMITSIG); - towire_u64(&p, commitnum); - towire_fee_states(&p, fee_states); - towire_height_states(&p, blockheight_states); - towire_bitcoin_signature(&p, signature); - towire_u16(&p, num_htlcs); - for (size_t i = 0; i < num_htlcs; i++) - towire_bitcoin_signature(&p, htlc_signature + i); - /* RCVD_ADD_COMMIT: we're now committed to their new offered HTLCs. */ - towire_u16(&p, num_added); - for (size_t i = 0; i < num_added; i++) - towire_added_htlc(&p, added + i); - /* RCVD_REMOVE_COMMIT: we're now no longer committed to these HTLCs. */ - towire_u16(&p, num_fulfilled); - for (size_t i = 0; i < num_fulfilled; i++) - towire_fulfilled_htlc(&p, fulfilled + i); - towire_u16(&p, num_failed); - for (size_t i = 0; i < num_failed; i++) - towire_failed_htlc(&p, failed[i]); - /* RCVD_ADD_ACK_COMMIT */ - towire_u16(&p, num_changed); - for (size_t i = 0; i < num_changed; i++) - towire_changed_htlc(&p, changed + i); - towire_bitcoin_tx(&p, tx); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct fee_states **fee_states, struct height_states **blockheight_states, struct bitcoin_signature *signature, struct bitcoin_signature **htlc_signature, struct added_htlc **added, struct fulfilled_htlc **fulfilled, struct failed_htlc ***failed, struct changed_htlc **changed, struct bitcoin_tx **tx) -{ - u16 num_htlcs; - u16 num_added; - u16 num_fulfilled; - u16 num_failed; - u16 num_changed; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_COMMITSIG) - return false; - *commitnum = fromwire_u64(&cursor, &plen); - *fee_states = fromwire_fee_states(ctx, &cursor, &plen); - *blockheight_states = fromwire_height_states(ctx, &cursor, &plen); - fromwire_bitcoin_signature(&cursor, &plen, signature); - num_htlcs = fromwire_u16(&cursor, &plen); - // 2nd case htlc_signature - *htlc_signature = num_htlcs ? tal_arr(ctx, struct bitcoin_signature, num_htlcs) : NULL; - for (size_t i = 0; i < num_htlcs; i++) - fromwire_bitcoin_signature(&cursor, &plen, *htlc_signature + i); - /* RCVD_ADD_COMMIT: we're now committed to their new offered HTLCs. */ - num_added = fromwire_u16(&cursor, &plen); - // 2nd case added - *added = num_added ? tal_arr(ctx, struct added_htlc, num_added) : NULL; - for (size_t i = 0; i < num_added; i++) - fromwire_added_htlc(&cursor, &plen, *added + i); - /* RCVD_REMOVE_COMMIT: we're now no longer committed to these HTLCs. */ - num_fulfilled = fromwire_u16(&cursor, &plen); - // 2nd case fulfilled - *fulfilled = num_fulfilled ? tal_arr(ctx, struct fulfilled_htlc, num_fulfilled) : NULL; - for (size_t i = 0; i < num_fulfilled; i++) - fromwire_fulfilled_htlc(&cursor, &plen, *fulfilled + i); - num_failed = fromwire_u16(&cursor, &plen); - // 2nd case failed - *failed = num_failed ? tal_arr(ctx, struct failed_htlc *, num_failed) : NULL; - for (size_t i = 0; i < num_failed; i++) - (*failed)[i] = fromwire_failed_htlc(*failed, &cursor, &plen); - /* RCVD_ADD_ACK_COMMIT */ - num_changed = fromwire_u16(&cursor, &plen); - // 2nd case changed - *changed = num_changed ? tal_arr(ctx, struct changed_htlc, num_changed) : NULL; - for (size_t i = 0; i < num_changed; i++) - fromwire_changed_htlc(&cursor, &plen, *changed + i); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_COMMITSIG_REPLY */ -/* Wait for reply */ -u8 *towire_channeld_got_commitsig_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_COMMITSIG_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_commitsig_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_COMMITSIG_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_REVOKE */ -u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct secret *per_commitment_secret, const struct pubkey *next_per_commit_point, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct penalty_base *pbase, const struct bitcoin_tx *penalty_tx) -{ - u16 num_changed = tal_count(changed); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_REVOKE); - towire_u64(&p, revokenum); - towire_secret(&p, per_commitment_secret); - towire_pubkey(&p, next_per_commit_point); - /* RCVD_ADD_ACK_REVOCATION */ - towire_fee_states(&p, fee_states); - towire_height_states(&p, blockheight_states); - towire_u16(&p, num_changed); - for (size_t i = 0; i < num_changed; i++) - towire_changed_htlc(&p, changed + i); - if (!pbase) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_penalty_base(&p, pbase); - } - if (!penalty_tx) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_bitcoin_tx(&p, penalty_tx); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenum, struct secret *per_commitment_secret, struct pubkey *next_per_commit_point, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct penalty_base **pbase, struct bitcoin_tx **penalty_tx) -{ - u16 num_changed; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_REVOKE) - return false; - *revokenum = fromwire_u64(&cursor, &plen); - fromwire_secret(&cursor, &plen, per_commitment_secret); - fromwire_pubkey(&cursor, &plen, next_per_commit_point); - /* RCVD_ADD_ACK_REVOCATION */ - *fee_states = fromwire_fee_states(ctx, &cursor, &plen); - *blockheight_states = fromwire_height_states(ctx, &cursor, &plen); - num_changed = fromwire_u16(&cursor, &plen); - // 2nd case changed - *changed = num_changed ? tal_arr(ctx, struct changed_htlc, num_changed) : NULL; - for (size_t i = 0; i < num_changed; i++) - fromwire_changed_htlc(&cursor, &plen, *changed + i); - if (!fromwire_bool(&cursor, &plen)) - *pbase = NULL; - else { - *pbase = tal(ctx, struct penalty_base); - fromwire_penalty_base(&cursor, &plen, *pbase); - } - if (!fromwire_bool(&cursor, &plen)) - *penalty_tx = NULL; - else { - *penalty_tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - } - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_REVOKE_REPLY */ -/* Wait for reply */ -/* (eg. if we sent another commitment_signed */ -u8 *towire_channeld_got_revoke_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_REVOKE_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_revoke_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_REVOKE_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_SEND_SHUTDOWN */ -/* Tell peer to shut down channel. */ -u8 *towire_channeld_send_shutdown(const tal_t *ctx, const u8 *shutdown_scriptpubkey, const struct bitcoin_outpoint *wrong_funding) -{ - u16 shutdown_len = tal_count(shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SEND_SHUTDOWN); - towire_u16(&p, shutdown_len); - towire_u8_array(&p, shutdown_scriptpubkey, shutdown_len); - if (!wrong_funding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_bitcoin_outpoint(&p, wrong_funding); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_send_shutdown(const tal_t *ctx, const void *p, u8 **shutdown_scriptpubkey, struct bitcoin_outpoint **wrong_funding) -{ - u16 shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SEND_SHUTDOWN) - return false; - shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case shutdown_scriptpubkey - *shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_len); - if (!fromwire_bool(&cursor, &plen)) - *wrong_funding = NULL; - else { - *wrong_funding = tal(ctx, struct bitcoin_outpoint); - fromwire_bitcoin_outpoint(&cursor, &plen, *wrong_funding); - } - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_SHUTDOWN */ -/* Peer told us that channel is shutting down */ -u8 *towire_channeld_got_shutdown(const tal_t *ctx, const u8 *scriptpubkey, const struct bitcoin_outpoint *wrong_funding) -{ - u16 scriptpubkey_len = tal_count(scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_SHUTDOWN); - towire_u16(&p, scriptpubkey_len); - towire_u8_array(&p, scriptpubkey, scriptpubkey_len); - if (!wrong_funding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_bitcoin_outpoint(&p, wrong_funding); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_shutdown(const tal_t *ctx, const void *p, u8 **scriptpubkey, struct bitcoin_outpoint **wrong_funding) -{ - u16 scriptpubkey_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_SHUTDOWN) - return false; - scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case scriptpubkey - *scriptpubkey = scriptpubkey_len ? tal_arr(ctx, u8, scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *scriptpubkey, scriptpubkey_len); - if (!fromwire_bool(&cursor, &plen)) - *wrong_funding = NULL; - else { - *wrong_funding = tal(ctx, struct bitcoin_outpoint); - fromwire_bitcoin_outpoint(&cursor, &plen, *wrong_funding); - } - return cursor != NULL; -} - -/* WIRE: CHANNELD_SHUTDOWN_COMPLETE */ -/* Shutdown is complete */ -u8 *towire_channeld_shutdown_complete(const tal_t *ctx, const struct per_peer_state *per_peer_state) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SHUTDOWN_COMPLETE); - towire_per_peer_state(&p, per_peer_state); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_shutdown_complete(const tal_t *ctx, const void *p, struct per_peer_state **per_peer_state) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SHUTDOWN_COMPLETE) - return false; - *per_peer_state = fromwire_per_peer_state(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_DEV_REENABLE_COMMIT */ -/* Re-enable commit timer. */ -u8 *towire_channeld_dev_reenable_commit(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_DEV_REENABLE_COMMIT); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_dev_reenable_commit(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_DEV_REENABLE_COMMIT) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_DEV_REENABLE_COMMIT_REPLY */ -u8 *towire_channeld_dev_reenable_commit_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_dev_reenable_commit_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_FEERATES */ -u8 *towire_channeld_feerates(const tal_t *ctx, u32 feerate, u32 min_feerate, u32 max_feerate, u32 penalty_feerate) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_FEERATES); - towire_u32(&p, feerate); - towire_u32(&p, min_feerate); - towire_u32(&p, max_feerate); - towire_u32(&p, penalty_feerate); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_feerates(const void *p, u32 *feerate, u32 *min_feerate, u32 *max_feerate, u32 *penalty_feerate) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_FEERATES) - return false; - *feerate = fromwire_u32(&cursor, &plen); - *min_feerate = fromwire_u32(&cursor, &plen); - *max_feerate = fromwire_u32(&cursor, &plen); - *penalty_feerate = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_DEV_MEMLEAK */ -/* master -> channeld: do you have a memleak? */ -u8 *towire_channeld_dev_memleak(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_DEV_MEMLEAK); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_dev_memleak(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_DEV_MEMLEAK) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_DEV_MEMLEAK_REPLY */ -u8 *towire_channeld_dev_memleak_reply(const tal_t *ctx, bool leak) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_DEV_MEMLEAK_REPLY); - towire_bool(&p, leak); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_dev_memleak_reply(const void *p, bool *leak) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_DEV_MEMLEAK_REPLY) - return false; - *leak = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_FAIL_FALLEN_BEHIND */ -/* Peer presented proof it was from the future. */ -u8 *towire_channeld_fail_fallen_behind(const tal_t *ctx, const struct pubkey *remote_per_commitment_point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_FAIL_FALLEN_BEHIND); - /* This is NULL if option_static_remotekey. */ - if (!remote_per_commitment_point) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, remote_per_commitment_point); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_fail_fallen_behind(const tal_t *ctx, const void *p, struct pubkey **remote_per_commitment_point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_FAIL_FALLEN_BEHIND) - return false; - /* This is NULL if option_static_remotekey. */ - if (!fromwire_bool(&cursor, &plen)) - *remote_per_commitment_point = NULL; - else { - *remote_per_commitment_point = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *remote_per_commitment_point); - } - return cursor != NULL; -} - -/* WIRE: CHANNELD_SPECIFIC_FEERATES */ -/* Handle a channel specific feerate base ppm configuration */ -u8 *towire_channeld_specific_feerates(const tal_t *ctx, u32 feerate_base, u32 feerate_ppm) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SPECIFIC_FEERATES); - towire_u32(&p, feerate_base); - towire_u32(&p, feerate_ppm); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_specific_feerates(const void *p, u32 *feerate_base, u32 *feerate_ppm) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SPECIFIC_FEERATES) - return false; - *feerate_base = fromwire_u32(&cursor, &plen); - *feerate_ppm = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_GOT_ANNOUNCEMENT */ -/* When we receive announcement_signatures for channel announce */ -u8 *towire_channeld_got_announcement(const tal_t *ctx, const secp256k1_ecdsa_signature *remote_ann_node_sig, const secp256k1_ecdsa_signature *remote_ann_bitcoin_sig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_GOT_ANNOUNCEMENT); - towire_secp256k1_ecdsa_signature(&p, remote_ann_node_sig); - towire_secp256k1_ecdsa_signature(&p, remote_ann_bitcoin_sig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_got_announcement(const void *p, secp256k1_ecdsa_signature *remote_ann_node_sig, secp256k1_ecdsa_signature *remote_ann_bitcoin_sig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_GOT_ANNOUNCEMENT) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, remote_ann_node_sig); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, remote_ann_bitcoin_sig); - return cursor != NULL; -} - -/* WIRE: CHANNELD_SEND_ERROR */ -/* Ask channeld to send a error message. Used in forgetting channel case. */ -u8 *towire_channeld_send_error(const tal_t *ctx, const wirestring *reason) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SEND_ERROR); - towire_wirestring(&p, reason); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_send_error(const tal_t *ctx, const void *p, wirestring **reason) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SEND_ERROR) - return false; - *reason = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_SEND_ERROR_REPLY */ -/* Tell master channeld has sent the error message. */ -u8 *towire_channeld_send_error_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_SEND_ERROR_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_send_error_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_SEND_ERROR_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_DEV_QUIESCE */ -/* Ask channeld to quiesce. */ -u8 *towire_channeld_dev_quiesce(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_DEV_QUIESCE); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_dev_quiesce(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_DEV_QUIESCE) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_DEV_QUIESCE_REPLY */ -u8 *towire_channeld_dev_quiesce_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_DEV_QUIESCE_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_dev_quiesce_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_DEV_QUIESCE_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CHANNELD_UPGRADED */ -/* Tell master we're upgrading the commitment tx. */ -u8 *towire_channeld_upgraded(const tal_t *ctx, const struct channel_type *new_type) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_UPGRADED); - towire_channel_type(&p, new_type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_upgraded(const tal_t *ctx, const void *p, struct channel_type **new_type) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_UPGRADED) - return false; - *new_type = fromwire_channel_type(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNELD_BLOCKHEIGHT */ -/* Tell peer about our latest and greatest blockheight. */ -u8 *towire_channeld_blockheight(const tal_t *ctx, u32 blockheight) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNELD_BLOCKHEIGHT); - towire_u32(&p, blockheight); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channeld_blockheight(const void *p, u32 *blockheight) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_BLOCKHEIGHT) - return false; - *blockheight = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} -// SHA256STAMP:f02f2fc72a5382fd545bdcd1789d873d1619baefea7f26d0bde92b5091b5b880 diff --git a/channeld/channeld_wiregen.h b/channeld/channeld_wiregen.h deleted file mode 100644 index 8fe40d94c..000000000 --- a/channeld/channeld_wiregen.h +++ /dev/null @@ -1,244 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H -#define LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum channeld_wire { - /* Begin! (passes gossipd-client fd) */ - WIRE_CHANNELD_INIT = 1000, - /* master->channeld funding hit new depth(funding locked if >= lock depth) */ - WIRE_CHANNELD_FUNDING_DEPTH = 1002, - /* Tell channel to offer this htlc */ - WIRE_CHANNELD_OFFER_HTLC = 1004, - /* Reply; synchronous since IDs have to increment. */ - WIRE_CHANNELD_OFFER_HTLC_REPLY = 1104, - /* Main daemon found out the preimage for an HTLC */ - WIRE_CHANNELD_FULFILL_HTLC = 1005, - /* Main daemon says HTLC failed */ - WIRE_CHANNELD_FAIL_HTLC = 1006, - /* When we receive funding_locked. */ - WIRE_CHANNELD_GOT_FUNDING_LOCKED = 1019, - /* When we send a commitment_signed message */ - WIRE_CHANNELD_SENDING_COMMITSIG = 1020, - /* Wait for reply */ - WIRE_CHANNELD_SENDING_COMMITSIG_REPLY = 1120, - /* When we have a commitment_signed message */ - WIRE_CHANNELD_GOT_COMMITSIG = 1021, - /* Wait for reply */ - WIRE_CHANNELD_GOT_COMMITSIG_REPLY = 1121, - WIRE_CHANNELD_GOT_REVOKE = 1022, - /* Wait for reply */ - /* (eg. if we sent another commitment_signed */ - WIRE_CHANNELD_GOT_REVOKE_REPLY = 1122, - /* Tell peer to shut down channel. */ - WIRE_CHANNELD_SEND_SHUTDOWN = 1023, - /* Peer told us that channel is shutting down */ - WIRE_CHANNELD_GOT_SHUTDOWN = 1024, - /* Shutdown is complete */ - WIRE_CHANNELD_SHUTDOWN_COMPLETE = 1025, - /* Re-enable commit timer. */ - WIRE_CHANNELD_DEV_REENABLE_COMMIT = 1026, - WIRE_CHANNELD_DEV_REENABLE_COMMIT_REPLY = 1126, - WIRE_CHANNELD_FEERATES = 1027, - /* master -> channeld: do you have a memleak? */ - WIRE_CHANNELD_DEV_MEMLEAK = 1033, - WIRE_CHANNELD_DEV_MEMLEAK_REPLY = 1133, - /* Peer presented proof it was from the future. */ - WIRE_CHANNELD_FAIL_FALLEN_BEHIND = 1028, - /* Handle a channel specific feerate base ppm configuration */ - WIRE_CHANNELD_SPECIFIC_FEERATES = 1029, - /* When we receive announcement_signatures for channel announce */ - WIRE_CHANNELD_GOT_ANNOUNCEMENT = 1017, - /* Ask channeld to send a error message. Used in forgetting channel case. */ - WIRE_CHANNELD_SEND_ERROR = 1008, - /* Tell master channeld has sent the error message. */ - WIRE_CHANNELD_SEND_ERROR_REPLY = 1108, - /* Ask channeld to quiesce. */ - WIRE_CHANNELD_DEV_QUIESCE = 1009, - WIRE_CHANNELD_DEV_QUIESCE_REPLY = 1109, - /* Tell master we're upgrading the commitment tx. */ - WIRE_CHANNELD_UPGRADED = 1011, - /* Tell peer about our latest and greatest blockheight. */ - WIRE_CHANNELD_BLOCKHEIGHT = 1012, -}; - -const char *channeld_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool channeld_wire_is_defined(u16 type); - - -/* WIRE: CHANNELD_INIT */ -/* Begin! (passes gossipd-client fd) */ -u8 *towire_channeld_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, u32 minimum_depth, u32 our_blockheight, const struct height_states *blockheight_states, u32 lease_expiry, const struct channel_config *our_config, const struct channel_config *their_config, const struct fee_states *fee_states, u32 feerate_min, u32 feerate_max, u32 feerate_penalty, const struct bitcoin_signature *first_commit_sig, const struct per_peer_state *per_peer_state, const struct pubkey *remote_fundingkey, const struct basepoints *remote_basepoints, const struct pubkey *remote_per_commit, const struct pubkey *old_remote_per_commit, enum side opener, u32 fee_base, u32 fee_proportional, struct amount_msat local_msatoshi, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct node_id *local_node_id, const struct node_id *remote_node_id, u32 commit_msec, u16 cltv_delta, bool last_was_revoke, const struct changed_htlc *last_sent_commit, u64 next_index_local, u64 next_index_remote, u64 revocations_received, u64 next_htlc_id, const struct existing_htlc **htlcs, bool local_funding_locked, bool remote_funding_locked, const struct short_channel_id *funding_short_id, bool reestablish, bool send_shutdown, bool remote_shutdown_received, const u8 *final_scriptpubkey, u8 flags, const u8 *init_peer_pkt, bool reached_announce_depth, const struct secret *last_remote_secret, const u8 *their_features, const u8 *upfront_shutdown_script, const secp256k1_ecdsa_signature *remote_ann_node_sig, const secp256k1_ecdsa_signature *remote_ann_bitcoin_sig, const struct channel_type *desired_type, bool dev_fast_gossip, bool dev_fail_process_onionpacket, const struct penalty_base *pbases, const u8 *reestablish_only); -bool fromwire_channeld_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, u32 *minimum_depth, u32 *our_blockheight, struct height_states **blockheight_states, u32 *lease_expiry, struct channel_config *our_config, struct channel_config *their_config, struct fee_states **fee_states, u32 *feerate_min, u32 *feerate_max, u32 *feerate_penalty, struct bitcoin_signature *first_commit_sig, struct per_peer_state **per_peer_state, struct pubkey *remote_fundingkey, struct basepoints *remote_basepoints, struct pubkey *remote_per_commit, struct pubkey *old_remote_per_commit, enum side *opener, u32 *fee_base, u32 *fee_proportional, struct amount_msat *local_msatoshi, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct node_id *local_node_id, struct node_id *remote_node_id, u32 *commit_msec, u16 *cltv_delta, bool *last_was_revoke, struct changed_htlc **last_sent_commit, u64 *next_index_local, u64 *next_index_remote, u64 *revocations_received, u64 *next_htlc_id, struct existing_htlc ***htlcs, bool *local_funding_locked, bool *remote_funding_locked, struct short_channel_id *funding_short_id, bool *reestablish, bool *send_shutdown, bool *remote_shutdown_received, u8 **final_scriptpubkey, u8 *flags, u8 **init_peer_pkt, bool *reached_announce_depth, struct secret *last_remote_secret, u8 **their_features, u8 **upfront_shutdown_script, secp256k1_ecdsa_signature **remote_ann_node_sig, secp256k1_ecdsa_signature **remote_ann_bitcoin_sig, struct channel_type **desired_type, bool *dev_fast_gossip, bool *dev_fail_process_onionpacket, struct penalty_base **pbases, u8 **reestablish_only); - -/* WIRE: CHANNELD_FUNDING_DEPTH */ -/* master->channeld funding hit new depth(funding locked if >= lock depth) */ -u8 *towire_channeld_funding_depth(const tal_t *ctx, const struct short_channel_id *short_channel_id, u32 depth); -bool fromwire_channeld_funding_depth(const tal_t *ctx, const void *p, struct short_channel_id **short_channel_id, u32 *depth); - -/* WIRE: CHANNELD_OFFER_HTLC */ -/* Tell channel to offer this htlc */ -u8 *towire_channeld_offer_htlc(const tal_t *ctx, struct amount_msat amount_msat, u32 cltv_expiry, const struct sha256 *payment_hash, const u8 onion_routing_packet[1366], const struct pubkey *blinding); -bool fromwire_channeld_offer_htlc(const tal_t *ctx, const void *p, struct amount_msat *amount_msat, u32 *cltv_expiry, struct sha256 *payment_hash, u8 onion_routing_packet[1366], struct pubkey **blinding); - -/* WIRE: CHANNELD_OFFER_HTLC_REPLY */ -/* Reply; synchronous since IDs have to increment. */ -u8 *towire_channeld_offer_htlc_reply(const tal_t *ctx, u64 id, const u8 *failuremsg, const wirestring *failurestr); -bool fromwire_channeld_offer_htlc_reply(const tal_t *ctx, const void *p, u64 *id, u8 **failuremsg, wirestring **failurestr); - -/* WIRE: CHANNELD_FULFILL_HTLC */ -/* Main daemon found out the preimage for an HTLC */ -u8 *towire_channeld_fulfill_htlc(const tal_t *ctx, const struct fulfilled_htlc *fulfilled_htlc); -bool fromwire_channeld_fulfill_htlc(const void *p, struct fulfilled_htlc *fulfilled_htlc); - -/* WIRE: CHANNELD_FAIL_HTLC */ -/* Main daemon says HTLC failed */ -u8 *towire_channeld_fail_htlc(const tal_t *ctx, const struct failed_htlc *failed_htlc); -bool fromwire_channeld_fail_htlc(const tal_t *ctx, const void *p, struct failed_htlc **failed_htlc); - -/* WIRE: CHANNELD_GOT_FUNDING_LOCKED */ -/* When we receive funding_locked. */ -u8 *towire_channeld_got_funding_locked(const tal_t *ctx, const struct pubkey *next_per_commit_point); -bool fromwire_channeld_got_funding_locked(const void *p, struct pubkey *next_per_commit_point); - -/* WIRE: CHANNELD_SENDING_COMMITSIG */ -/* When we send a commitment_signed message */ -u8 *towire_channeld_sending_commitsig(const tal_t *ctx, u64 commitnum, const struct penalty_base *pbase, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct bitcoin_signature *commit_sig, const struct bitcoin_signature *htlc_sigs); -bool fromwire_channeld_sending_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct penalty_base **pbase, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct bitcoin_signature *commit_sig, struct bitcoin_signature **htlc_sigs); - -/* WIRE: CHANNELD_SENDING_COMMITSIG_REPLY */ -/* Wait for reply */ -u8 *towire_channeld_sending_commitsig_reply(const tal_t *ctx); -bool fromwire_channeld_sending_commitsig_reply(const void *p); - -/* WIRE: CHANNELD_GOT_COMMITSIG */ -/* When we have a commitment_signed message */ -u8 *towire_channeld_got_commitsig(const tal_t *ctx, u64 commitnum, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct bitcoin_signature *signature, const struct bitcoin_signature *htlc_signature, const struct added_htlc *added, const struct fulfilled_htlc *fulfilled, const struct failed_htlc **failed, const struct changed_htlc *changed, const struct bitcoin_tx *tx); -bool fromwire_channeld_got_commitsig(const tal_t *ctx, const void *p, u64 *commitnum, struct fee_states **fee_states, struct height_states **blockheight_states, struct bitcoin_signature *signature, struct bitcoin_signature **htlc_signature, struct added_htlc **added, struct fulfilled_htlc **fulfilled, struct failed_htlc ***failed, struct changed_htlc **changed, struct bitcoin_tx **tx); - -/* WIRE: CHANNELD_GOT_COMMITSIG_REPLY */ -/* Wait for reply */ -u8 *towire_channeld_got_commitsig_reply(const tal_t *ctx); -bool fromwire_channeld_got_commitsig_reply(const void *p); - -/* WIRE: CHANNELD_GOT_REVOKE */ -u8 *towire_channeld_got_revoke(const tal_t *ctx, u64 revokenum, const struct secret *per_commitment_secret, const struct pubkey *next_per_commit_point, const struct fee_states *fee_states, const struct height_states *blockheight_states, const struct changed_htlc *changed, const struct penalty_base *pbase, const struct bitcoin_tx *penalty_tx); -bool fromwire_channeld_got_revoke(const tal_t *ctx, const void *p, u64 *revokenum, struct secret *per_commitment_secret, struct pubkey *next_per_commit_point, struct fee_states **fee_states, struct height_states **blockheight_states, struct changed_htlc **changed, struct penalty_base **pbase, struct bitcoin_tx **penalty_tx); - -/* WIRE: CHANNELD_GOT_REVOKE_REPLY */ -/* Wait for reply */ -/* (eg. if we sent another commitment_signed */ -u8 *towire_channeld_got_revoke_reply(const tal_t *ctx); -bool fromwire_channeld_got_revoke_reply(const void *p); - -/* WIRE: CHANNELD_SEND_SHUTDOWN */ -/* Tell peer to shut down channel. */ -u8 *towire_channeld_send_shutdown(const tal_t *ctx, const u8 *shutdown_scriptpubkey, const struct bitcoin_outpoint *wrong_funding); -bool fromwire_channeld_send_shutdown(const tal_t *ctx, const void *p, u8 **shutdown_scriptpubkey, struct bitcoin_outpoint **wrong_funding); - -/* WIRE: CHANNELD_GOT_SHUTDOWN */ -/* Peer told us that channel is shutting down */ -u8 *towire_channeld_got_shutdown(const tal_t *ctx, const u8 *scriptpubkey, const struct bitcoin_outpoint *wrong_funding); -bool fromwire_channeld_got_shutdown(const tal_t *ctx, const void *p, u8 **scriptpubkey, struct bitcoin_outpoint **wrong_funding); - -/* WIRE: CHANNELD_SHUTDOWN_COMPLETE */ -/* Shutdown is complete */ -u8 *towire_channeld_shutdown_complete(const tal_t *ctx, const struct per_peer_state *per_peer_state); -bool fromwire_channeld_shutdown_complete(const tal_t *ctx, const void *p, struct per_peer_state **per_peer_state); - -/* WIRE: CHANNELD_DEV_REENABLE_COMMIT */ -/* Re-enable commit timer. */ -u8 *towire_channeld_dev_reenable_commit(const tal_t *ctx); -bool fromwire_channeld_dev_reenable_commit(const void *p); - -/* WIRE: CHANNELD_DEV_REENABLE_COMMIT_REPLY */ -u8 *towire_channeld_dev_reenable_commit_reply(const tal_t *ctx); -bool fromwire_channeld_dev_reenable_commit_reply(const void *p); - -/* WIRE: CHANNELD_FEERATES */ -u8 *towire_channeld_feerates(const tal_t *ctx, u32 feerate, u32 min_feerate, u32 max_feerate, u32 penalty_feerate); -bool fromwire_channeld_feerates(const void *p, u32 *feerate, u32 *min_feerate, u32 *max_feerate, u32 *penalty_feerate); - -/* WIRE: CHANNELD_DEV_MEMLEAK */ -/* master -> channeld: do you have a memleak? */ -u8 *towire_channeld_dev_memleak(const tal_t *ctx); -bool fromwire_channeld_dev_memleak(const void *p); - -/* WIRE: CHANNELD_DEV_MEMLEAK_REPLY */ -u8 *towire_channeld_dev_memleak_reply(const tal_t *ctx, bool leak); -bool fromwire_channeld_dev_memleak_reply(const void *p, bool *leak); - -/* WIRE: CHANNELD_FAIL_FALLEN_BEHIND */ -/* Peer presented proof it was from the future. */ -u8 *towire_channeld_fail_fallen_behind(const tal_t *ctx, const struct pubkey *remote_per_commitment_point); -bool fromwire_channeld_fail_fallen_behind(const tal_t *ctx, const void *p, struct pubkey **remote_per_commitment_point); - -/* WIRE: CHANNELD_SPECIFIC_FEERATES */ -/* Handle a channel specific feerate base ppm configuration */ -u8 *towire_channeld_specific_feerates(const tal_t *ctx, u32 feerate_base, u32 feerate_ppm); -bool fromwire_channeld_specific_feerates(const void *p, u32 *feerate_base, u32 *feerate_ppm); - -/* WIRE: CHANNELD_GOT_ANNOUNCEMENT */ -/* When we receive announcement_signatures for channel announce */ -u8 *towire_channeld_got_announcement(const tal_t *ctx, const secp256k1_ecdsa_signature *remote_ann_node_sig, const secp256k1_ecdsa_signature *remote_ann_bitcoin_sig); -bool fromwire_channeld_got_announcement(const void *p, secp256k1_ecdsa_signature *remote_ann_node_sig, secp256k1_ecdsa_signature *remote_ann_bitcoin_sig); - -/* WIRE: CHANNELD_SEND_ERROR */ -/* Ask channeld to send a error message. Used in forgetting channel case. */ -u8 *towire_channeld_send_error(const tal_t *ctx, const wirestring *reason); -bool fromwire_channeld_send_error(const tal_t *ctx, const void *p, wirestring **reason); - -/* WIRE: CHANNELD_SEND_ERROR_REPLY */ -/* Tell master channeld has sent the error message. */ -u8 *towire_channeld_send_error_reply(const tal_t *ctx); -bool fromwire_channeld_send_error_reply(const void *p); - -/* WIRE: CHANNELD_DEV_QUIESCE */ -/* Ask channeld to quiesce. */ -u8 *towire_channeld_dev_quiesce(const tal_t *ctx); -bool fromwire_channeld_dev_quiesce(const void *p); - -/* WIRE: CHANNELD_DEV_QUIESCE_REPLY */ -u8 *towire_channeld_dev_quiesce_reply(const tal_t *ctx); -bool fromwire_channeld_dev_quiesce_reply(const void *p); - -/* WIRE: CHANNELD_UPGRADED */ -/* Tell master we're upgrading the commitment tx. */ -u8 *towire_channeld_upgraded(const tal_t *ctx, const struct channel_type *new_type); -bool fromwire_channeld_upgraded(const tal_t *ctx, const void *p, struct channel_type **new_type); - -/* WIRE: CHANNELD_BLOCKHEIGHT */ -/* Tell peer about our latest and greatest blockheight. */ -u8 *towire_channeld_blockheight(const tal_t *ctx, u32 blockheight); -bool fromwire_channeld_blockheight(const void *p, u32 *blockheight); - - -#endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */ -// SHA256STAMP:f02f2fc72a5382fd545bdcd1789d873d1619baefea7f26d0bde92b5091b5b880 diff --git a/closingd/closingd_wiregen.c b/closingd/closingd_wiregen.c deleted file mode 100644 index 1fe5305ae..000000000 --- a/closingd/closingd_wiregen.c +++ /dev/null @@ -1,238 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *closingd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum closingd_wire)e) { - case WIRE_CLOSINGD_INIT: return "WIRE_CLOSINGD_INIT"; - case WIRE_CLOSINGD_NOTIFICATION: return "WIRE_CLOSINGD_NOTIFICATION"; - case WIRE_CLOSINGD_RECEIVED_SIGNATURE: return "WIRE_CLOSINGD_RECEIVED_SIGNATURE"; - case WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY: return "WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY"; - case WIRE_CLOSINGD_COMPLETE: return "WIRE_CLOSINGD_COMPLETE"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool closingd_wire_is_defined(u16 type) -{ - switch ((enum closingd_wire)type) { - case WIRE_CLOSINGD_INIT:; - case WIRE_CLOSINGD_NOTIFICATION:; - case WIRE_CLOSINGD_RECEIVED_SIGNATURE:; - case WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY:; - case WIRE_CLOSINGD_COMPLETE:; - return true; - } - return false; -} - - - - - -/* WIRE: CLOSINGD_INIT */ -/* Begin! (passes peer fd */ -u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct per_peer_state *pps, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, const struct pubkey *local_fundingkey, const struct pubkey *remote_fundingkey, enum side opener, struct amount_sat local_sat, struct amount_sat remote_sat, struct amount_sat our_dust_limit, u32 min_feerate_perksipa, u32 preferred_feerate_perksipa, u32 *max_feerate_perksipa, struct amount_sat fee_limit_satoshi, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, u64 fee_negotiation_step, u8 fee_negotiation_step_unit, bool use_quickclose, bool dev_fast_gossip, const struct bitcoin_outpoint *shutdown_wrong_funding) -{ - u16 local_scriptpubkey_len = tal_count(local_scriptpubkey); - u16 remote_scriptpubkey_len = tal_count(remote_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CLOSINGD_INIT); - towire_chainparams(&p, chainparams); - towire_per_peer_state(&p, pps); - towire_channel_id(&p, channel_id); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_amount_sat(&p, funding_satoshi); - towire_pubkey(&p, local_fundingkey); - towire_pubkey(&p, remote_fundingkey); - towire_side(&p, opener); - towire_amount_sat(&p, local_sat); - towire_amount_sat(&p, remote_sat); - towire_amount_sat(&p, our_dust_limit); - towire_u32(&p, min_feerate_perksipa); - towire_u32(&p, preferred_feerate_perksipa); - if (!max_feerate_perksipa) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_u32(&p, *max_feerate_perksipa); - } - towire_amount_sat(&p, fee_limit_satoshi); - towire_u16(&p, local_scriptpubkey_len); - towire_u8_array(&p, local_scriptpubkey, local_scriptpubkey_len); - towire_u16(&p, remote_scriptpubkey_len); - towire_u8_array(&p, remote_scriptpubkey, remote_scriptpubkey_len); - towire_u64(&p, fee_negotiation_step); - towire_u8(&p, fee_negotiation_step_unit); - towire_bool(&p, use_quickclose); - towire_bool(&p, dev_fast_gossip); - if (!shutdown_wrong_funding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_bitcoin_outpoint(&p, shutdown_wrong_funding); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct per_peer_state **pps, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, struct pubkey *local_fundingkey, struct pubkey *remote_fundingkey, enum side *opener, struct amount_sat *local_sat, struct amount_sat *remote_sat, struct amount_sat *our_dust_limit, u32 *min_feerate_perksipa, u32 *preferred_feerate_perksipa, u32 **max_feerate_perksipa, struct amount_sat *fee_limit_satoshi, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, u64 *fee_negotiation_step, u8 *fee_negotiation_step_unit, bool *use_quickclose, bool *dev_fast_gossip, struct bitcoin_outpoint **shutdown_wrong_funding) -{ - u16 local_scriptpubkey_len; - u16 remote_scriptpubkey_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CLOSINGD_INIT) - return false; - fromwire_chainparams(&cursor, &plen, chainparams); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *funding_satoshi = fromwire_amount_sat(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, local_fundingkey); - fromwire_pubkey(&cursor, &plen, remote_fundingkey); - *opener = fromwire_side(&cursor, &plen); - *local_sat = fromwire_amount_sat(&cursor, &plen); - *remote_sat = fromwire_amount_sat(&cursor, &plen); - *our_dust_limit = fromwire_amount_sat(&cursor, &plen); - *min_feerate_perksipa = fromwire_u32(&cursor, &plen); - *preferred_feerate_perksipa = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *max_feerate_perksipa = NULL; - else { - *max_feerate_perksipa = tal(ctx, u32); - **max_feerate_perksipa = fromwire_u32(&cursor, &plen); - } - *fee_limit_satoshi = fromwire_amount_sat(&cursor, &plen); - local_scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case local_scriptpubkey - *local_scriptpubkey = local_scriptpubkey_len ? tal_arr(ctx, u8, local_scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *local_scriptpubkey, local_scriptpubkey_len); - remote_scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case remote_scriptpubkey - *remote_scriptpubkey = remote_scriptpubkey_len ? tal_arr(ctx, u8, remote_scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *remote_scriptpubkey, remote_scriptpubkey_len); - *fee_negotiation_step = fromwire_u64(&cursor, &plen); - *fee_negotiation_step_unit = fromwire_u8(&cursor, &plen); - *use_quickclose = fromwire_bool(&cursor, &plen); - *dev_fast_gossip = fromwire_bool(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *shutdown_wrong_funding = NULL; - else { - *shutdown_wrong_funding = tal(ctx, struct bitcoin_outpoint); - fromwire_bitcoin_outpoint(&cursor, &plen, *shutdown_wrong_funding); - } - return cursor != NULL; -} - -/* WIRE: CLOSINGD_NOTIFICATION */ -/* Message for any commands waiting. */ -u8 *towire_closingd_notification(const tal_t *ctx, enum log_level level, const wirestring *message) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CLOSINGD_NOTIFICATION); - towire_log_level(&p, level); - towire_wirestring(&p, message); - - return memcheck(p, tal_count(p)); -} -bool fromwire_closingd_notification(const tal_t *ctx, const void *p, enum log_level *level, wirestring **message) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CLOSINGD_NOTIFICATION) - return false; - *level = fromwire_log_level(&cursor, &plen); - *message = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CLOSINGD_RECEIVED_SIGNATURE */ -/* We received an offer */ -u8 *towire_closingd_received_signature(const tal_t *ctx, const struct bitcoin_signature *signature, const struct bitcoin_tx *tx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CLOSINGD_RECEIVED_SIGNATURE); - towire_bitcoin_signature(&p, signature); - towire_bitcoin_tx(&p, tx); - - return memcheck(p, tal_count(p)); -} -bool fromwire_closingd_received_signature(const tal_t *ctx, const void *p, struct bitcoin_signature *signature, struct bitcoin_tx **tx) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CLOSINGD_RECEIVED_SIGNATURE) - return false; - fromwire_bitcoin_signature(&cursor, &plen, signature); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CLOSINGD_RECEIVED_SIGNATURE_REPLY */ -u8 *towire_closingd_received_signature_reply(const tal_t *ctx, const struct bitcoin_txid *closing_txid) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY); - towire_bitcoin_txid(&p, closing_txid); - - return memcheck(p, tal_count(p)); -} -bool fromwire_closingd_received_signature_reply(const void *p, struct bitcoin_txid *closing_txid) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY) - return false; - fromwire_bitcoin_txid(&cursor, &plen, closing_txid); - return cursor != NULL; -} - -/* WIRE: CLOSINGD_COMPLETE */ -/* Negotiations complete */ -u8 *towire_closingd_complete(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CLOSINGD_COMPLETE); - - return memcheck(p, tal_count(p)); -} -bool fromwire_closingd_complete(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CLOSINGD_COMPLETE) - return false; - return cursor != NULL; -} -// SHA256STAMP:8b3f45f8221281390e4e8883d07c55f9723f4bf08356dcd63f537dc30ca7b75f diff --git a/closingd/closingd_wiregen.h b/closingd/closingd_wiregen.h deleted file mode 100644 index 1e1a3c78c..000000000 --- a/closingd/closingd_wiregen.h +++ /dev/null @@ -1,67 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H -#define LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum closingd_wire { - /* Begin! (passes peer fd */ - WIRE_CLOSINGD_INIT = 2001, - /* Message for any commands waiting. */ - WIRE_CLOSINGD_NOTIFICATION = 2003, - /* We received an offer */ - WIRE_CLOSINGD_RECEIVED_SIGNATURE = 2002, - WIRE_CLOSINGD_RECEIVED_SIGNATURE_REPLY = 2102, - /* Negotiations complete */ - WIRE_CLOSINGD_COMPLETE = 2004, -}; - -const char *closingd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool closingd_wire_is_defined(u16 type); - - -/* WIRE: CLOSINGD_INIT */ -/* Begin! (passes peer fd */ -u8 *towire_closingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct per_peer_state *pps, const struct channel_id *channel_id, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshi, const struct pubkey *local_fundingkey, const struct pubkey *remote_fundingkey, enum side opener, struct amount_sat local_sat, struct amount_sat remote_sat, struct amount_sat our_dust_limit, u32 min_feerate_perksipa, u32 preferred_feerate_perksipa, u32 *max_feerate_perksipa, struct amount_sat fee_limit_satoshi, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, u64 fee_negotiation_step, u8 fee_negotiation_step_unit, bool use_quickclose, bool dev_fast_gossip, const struct bitcoin_outpoint *shutdown_wrong_funding); -bool fromwire_closingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct per_peer_state **pps, struct channel_id *channel_id, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshi, struct pubkey *local_fundingkey, struct pubkey *remote_fundingkey, enum side *opener, struct amount_sat *local_sat, struct amount_sat *remote_sat, struct amount_sat *our_dust_limit, u32 *min_feerate_perksipa, u32 *preferred_feerate_perksipa, u32 **max_feerate_perksipa, struct amount_sat *fee_limit_satoshi, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, u64 *fee_negotiation_step, u8 *fee_negotiation_step_unit, bool *use_quickclose, bool *dev_fast_gossip, struct bitcoin_outpoint **shutdown_wrong_funding); - -/* WIRE: CLOSINGD_NOTIFICATION */ -/* Message for any commands waiting. */ -u8 *towire_closingd_notification(const tal_t *ctx, enum log_level level, const wirestring *message); -bool fromwire_closingd_notification(const tal_t *ctx, const void *p, enum log_level *level, wirestring **message); - -/* WIRE: CLOSINGD_RECEIVED_SIGNATURE */ -/* We received an offer */ -u8 *towire_closingd_received_signature(const tal_t *ctx, const struct bitcoin_signature *signature, const struct bitcoin_tx *tx); -bool fromwire_closingd_received_signature(const tal_t *ctx, const void *p, struct bitcoin_signature *signature, struct bitcoin_tx **tx); - -/* WIRE: CLOSINGD_RECEIVED_SIGNATURE_REPLY */ -u8 *towire_closingd_received_signature_reply(const tal_t *ctx, const struct bitcoin_txid *closing_txid); -bool fromwire_closingd_received_signature_reply(const void *p, struct bitcoin_txid *closing_txid); - -/* WIRE: CLOSINGD_COMPLETE */ -/* Negotiations complete */ -u8 *towire_closingd_complete(const tal_t *ctx); -bool fromwire_closingd_complete(const void *p); - - -#endif /* LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H */ -// SHA256STAMP:8b3f45f8221281390e4e8883d07c55f9723f4bf08356dcd63f537dc30ca7b75f diff --git a/common/peer_status_wiregen.c b/common/peer_status_wiregen.c deleted file mode 100644 index 7351fc7bc..000000000 --- a/common/peer_status_wiregen.c +++ /dev/null @@ -1,83 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *peer_status_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum peer_status_wire)e) { - case WIRE_STATUS_PEER_ERROR: return "WIRE_STATUS_PEER_ERROR"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool peer_status_wire_is_defined(u16 type) -{ - switch ((enum peer_status_wire)type) { - case WIRE_STATUS_PEER_ERROR:; - return true; - } - return false; -} - - - - - -/* WIRE: STATUS_PEER_ERROR */ -/* An error occurred: if error_for_them */ -u8 *towire_status_peer_error(const tal_t *ctx, const struct channel_id *channel, const wirestring *desc, bool warning, const struct per_peer_state *pps, const u8 *error_for_them) -{ - u16 len = tal_count(error_for_them); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_PEER_ERROR); - /* This is implied if error_for_them */ - towire_channel_id(&p, channel); - towire_wirestring(&p, desc); - /* Take a deep breath */ - towire_bool(&p, warning); - towire_per_peer_state(&p, pps); - towire_u16(&p, len); - towire_u8_array(&p, error_for_them, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_id *channel, wirestring **desc, bool *warning, struct per_peer_state **pps, u8 **error_for_them) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_PEER_ERROR) - return false; - /* This is implied if error_for_them */ - fromwire_channel_id(&cursor, &plen, channel); - *desc = fromwire_wirestring(ctx, &cursor, &plen); - /* Take a deep breath */ - *warning = fromwire_bool(&cursor, &plen); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case error_for_them - *error_for_them = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *error_for_them, len); - return cursor != NULL; -} -// SHA256STAMP:3e1d1ae6327232326b2a08f788c59485e0c4abd37bdb55604f111e087f605520 diff --git a/common/peer_status_wiregen.h b/common/peer_status_wiregen.h deleted file mode 100644 index 170d7fadf..000000000 --- a/common/peer_status_wiregen.h +++ /dev/null @@ -1,37 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H -#define LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H -#include -#include -#include -#include -#include - -enum peer_status_wire { - /* An error occurred: if error_for_them */ - WIRE_STATUS_PEER_ERROR = 0xFFF4, -}; - -const char *peer_status_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool peer_status_wire_is_defined(u16 type); - - -/* WIRE: STATUS_PEER_ERROR */ -/* An error occurred: if error_for_them */ -u8 *towire_status_peer_error(const tal_t *ctx, const struct channel_id *channel, const wirestring *desc, bool warning, const struct per_peer_state *pps, const u8 *error_for_them); -bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_id *channel, wirestring **desc, bool *warning, struct per_peer_state **pps, u8 **error_for_them); - - -#endif /* LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H */ -// SHA256STAMP:3e1d1ae6327232326b2a08f788c59485e0c4abd37bdb55604f111e087f605520 diff --git a/common/status_wiregen.c b/common/status_wiregen.c deleted file mode 100644 index 807da0975..000000000 --- a/common/status_wiregen.c +++ /dev/null @@ -1,217 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *status_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum status_wire)e) { - case WIRE_STATUS_LOG: return "WIRE_STATUS_LOG"; - case WIRE_STATUS_IO: return "WIRE_STATUS_IO"; - case WIRE_STATUS_FAIL: return "WIRE_STATUS_FAIL"; - case WIRE_STATUS_PEER_CONNECTION_LOST: return "WIRE_STATUS_PEER_CONNECTION_LOST"; - case WIRE_STATUS_PEER_BILLBOARD: return "WIRE_STATUS_PEER_BILLBOARD"; - case WIRE_STATUS_VERSION: return "WIRE_STATUS_VERSION"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool status_wire_is_defined(u16 type) -{ - switch ((enum status_wire)type) { - case WIRE_STATUS_LOG:; - case WIRE_STATUS_IO:; - case WIRE_STATUS_FAIL:; - case WIRE_STATUS_PEER_CONNECTION_LOST:; - case WIRE_STATUS_PEER_BILLBOARD:; - case WIRE_STATUS_VERSION:; - return true; - } - return false; -} - - - - - -/* WIRE: STATUS_LOG */ -u8 *towire_status_log(const tal_t *ctx, enum log_level level, const struct node_id *peer, const wirestring *entry) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_LOG); - towire_log_level(&p, level); - if (!peer) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_node_id(&p, peer); - } - towire_wirestring(&p, entry); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_log(const tal_t *ctx, const void *p, enum log_level *level, struct node_id **peer, wirestring **entry) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_LOG) - return false; - *level = fromwire_log_level(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *peer = NULL; - else { - *peer = tal(ctx, struct node_id); - fromwire_node_id(&cursor, &plen, *peer); - } - *entry = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: STATUS_IO */ -u8 *towire_status_io(const tal_t *ctx, enum log_level iodir, const struct node_id *peer, const wirestring *who, const u8 *data) -{ - u16 len = tal_count(data); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_IO); - towire_log_level(&p, iodir); - if (!peer) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_node_id(&p, peer); - } - towire_wirestring(&p, who); - towire_u16(&p, len); - towire_u8_array(&p, data, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_io(const tal_t *ctx, const void *p, enum log_level *iodir, struct node_id **peer, wirestring **who, u8 **data) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_IO) - return false; - *iodir = fromwire_log_level(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *peer = NULL; - else { - *peer = tal(ctx, struct node_id); - fromwire_node_id(&cursor, &plen, *peer); - } - *who = fromwire_wirestring(ctx, &cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case data - *data = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *data, len); - return cursor != NULL; -} - -/* WIRE: STATUS_FAIL */ -u8 *towire_status_fail(const tal_t *ctx, enum status_failreason failreason, const wirestring *desc) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_FAIL); - towire_status_failreason(&p, failreason); - towire_wirestring(&p, desc); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_fail(const tal_t *ctx, const void *p, enum status_failreason *failreason, wirestring **desc) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_FAIL) - return false; - *failreason = fromwire_status_failreason(&cursor, &plen); - *desc = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: STATUS_PEER_CONNECTION_LOST */ -u8 *towire_status_peer_connection_lost(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_PEER_CONNECTION_LOST); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_peer_connection_lost(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_PEER_CONNECTION_LOST) - return false; - return cursor != NULL; -} - -/* WIRE: STATUS_PEER_BILLBOARD */ -u8 *towire_status_peer_billboard(const tal_t *ctx, bool perm, const wirestring *happenings) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_PEER_BILLBOARD); - towire_bool(&p, perm); - towire_wirestring(&p, happenings); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_peer_billboard(const tal_t *ctx, const void *p, bool *perm, wirestring **happenings) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_PEER_BILLBOARD) - return false; - *perm = fromwire_bool(&cursor, &plen); - *happenings = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: STATUS_VERSION */ -u8 *towire_status_version(const tal_t *ctx, const wirestring *version) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_STATUS_VERSION); - towire_wirestring(&p, version); - - return memcheck(p, tal_count(p)); -} -bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **version) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_STATUS_VERSION) - return false; - *version = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} -// SHA256STAMP:6910f83360952ba00ee6a56e96a7402d9b973eb125a6c98bec4d52fa97740457 diff --git a/common/status_wiregen.h b/common/status_wiregen.h deleted file mode 100644 index a76887562..000000000 --- a/common/status_wiregen.h +++ /dev/null @@ -1,62 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_COMMON_STATUS_WIREGEN_H -#define LIGHTNING_COMMON_STATUS_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include - -enum status_wire { - WIRE_STATUS_LOG = 0xFFF0, - WIRE_STATUS_IO = 0xFFF1, - WIRE_STATUS_FAIL = 0xFFF2, - WIRE_STATUS_PEER_CONNECTION_LOST = 0xFFF3, - WIRE_STATUS_PEER_BILLBOARD = 0xFFF5, - WIRE_STATUS_VERSION = 0xFFF6, -}; - -const char *status_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool status_wire_is_defined(u16 type); - - -/* WIRE: STATUS_LOG */ -u8 *towire_status_log(const tal_t *ctx, enum log_level level, const struct node_id *peer, const wirestring *entry); -bool fromwire_status_log(const tal_t *ctx, const void *p, enum log_level *level, struct node_id **peer, wirestring **entry); - -/* WIRE: STATUS_IO */ -u8 *towire_status_io(const tal_t *ctx, enum log_level iodir, const struct node_id *peer, const wirestring *who, const u8 *data); -bool fromwire_status_io(const tal_t *ctx, const void *p, enum log_level *iodir, struct node_id **peer, wirestring **who, u8 **data); - -/* WIRE: STATUS_FAIL */ -u8 *towire_status_fail(const tal_t *ctx, enum status_failreason failreason, const wirestring *desc); -bool fromwire_status_fail(const tal_t *ctx, const void *p, enum status_failreason *failreason, wirestring **desc); - -/* WIRE: STATUS_PEER_CONNECTION_LOST */ -u8 *towire_status_peer_connection_lost(const tal_t *ctx); -bool fromwire_status_peer_connection_lost(const void *p); - -/* WIRE: STATUS_PEER_BILLBOARD */ -u8 *towire_status_peer_billboard(const tal_t *ctx, bool perm, const wirestring *happenings); -bool fromwire_status_peer_billboard(const tal_t *ctx, const void *p, bool *perm, wirestring **happenings); - -/* WIRE: STATUS_VERSION */ -u8 *towire_status_version(const tal_t *ctx, const wirestring *version); -bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **version); - - -#endif /* LIGHTNING_COMMON_STATUS_WIREGEN_H */ -// SHA256STAMP:6910f83360952ba00ee6a56e96a7402d9b973eb125a6c98bec4d52fa97740457 diff --git a/connectd/connectd_gossipd_wiregen.c b/connectd/connectd_gossipd_wiregen.c deleted file mode 100644 index a4cd1f2df..000000000 --- a/connectd/connectd_gossipd_wiregen.c +++ /dev/null @@ -1,164 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *connectd_gossipd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum connectd_gossipd_wire)e) { - case WIRE_GOSSIPD_NEW_PEER: return "WIRE_GOSSIPD_NEW_PEER"; - case WIRE_GOSSIPD_NEW_PEER_REPLY: return "WIRE_GOSSIPD_NEW_PEER_REPLY"; - case WIRE_GOSSIPD_GET_ADDRS: return "WIRE_GOSSIPD_GET_ADDRS"; - case WIRE_GOSSIPD_GET_ADDRS_REPLY: return "WIRE_GOSSIPD_GET_ADDRS_REPLY"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool connectd_gossipd_wire_is_defined(u16 type) -{ - switch ((enum connectd_gossipd_wire)type) { - case WIRE_GOSSIPD_NEW_PEER:; - case WIRE_GOSSIPD_NEW_PEER_REPLY:; - case WIRE_GOSSIPD_GET_ADDRS:; - case WIRE_GOSSIPD_GET_ADDRS_REPLY:; - return true; - } - return false; -} - - - - - -/* WIRE: GOSSIPD_NEW_PEER */ -/* Communication between gossipd and connectd. */ -u8 *towire_gossipd_new_peer(const tal_t *ctx, const struct node_id *id, bool gossip_queries_feature, bool initial_routing_sync) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_NEW_PEER); - towire_node_id(&p, id); - /* Did we negotiate LOCAL_GOSSIP_QUERIES? */ - towire_bool(&p, gossip_queries_feature); - /* Did they offer LOCAL_INITIAL_ROUTING_SYNC? */ - towire_bool(&p, initial_routing_sync); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_new_peer(const void *p, struct node_id *id, bool *gossip_queries_feature, bool *initial_routing_sync) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_NEW_PEER) - return false; - fromwire_node_id(&cursor, &plen, id); - /* Did we negotiate LOCAL_GOSSIP_QUERIES? */ - *gossip_queries_feature = fromwire_bool(&cursor, &plen); - /* Did they offer LOCAL_INITIAL_ROUTING_SYNC? */ - *initial_routing_sync = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_NEW_PEER_REPLY */ -/* if success: + gossip fd and gossip_store fd */ -u8 *towire_gossipd_new_peer_reply(const tal_t *ctx, bool success, const struct gossip_state *gs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_NEW_PEER_REPLY); - towire_bool(&p, success); - if (!gs) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_gossip_state(&p, gs); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_new_peer_reply(const tal_t *ctx, const void *p, bool *success, struct gossip_state **gs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_NEW_PEER_REPLY) - return false; - *success = fromwire_bool(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *gs = NULL; - else { - *gs = tal(ctx, struct gossip_state); - fromwire_gossip_state(&cursor, &plen, *gs); - } - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_ADDRS */ -/* Connectd asks gossipd for any known addresses for that node. */ -u8 *towire_gossipd_get_addrs(const tal_t *ctx, const struct node_id *id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_ADDRS); - towire_node_id(&p, id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_addrs(const void *p, struct node_id *id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_ADDRS) - return false; - fromwire_node_id(&cursor, &plen, id); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_ADDRS_REPLY */ -u8 *towire_gossipd_get_addrs_reply(const tal_t *ctx, const struct wireaddr *addrs) -{ - u16 num = tal_count(addrs); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_ADDRS_REPLY); - towire_u16(&p, num); - for (size_t i = 0; i < num; i++) - towire_wireaddr(&p, addrs + i); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wireaddr **addrs) -{ - u16 num; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_ADDRS_REPLY) - return false; - num = fromwire_u16(&cursor, &plen); - // 2nd case addrs - *addrs = num ? tal_arr(ctx, struct wireaddr, num) : NULL; - for (size_t i = 0; i < num; i++) - fromwire_wireaddr(&cursor, &plen, *addrs + i); - return cursor != NULL; -} -// SHA256STAMP:a03f3546c6a3dc0ee7055ba912fffd6acf9dc86bb9dc4472ecfc240582709481 diff --git a/connectd/connectd_gossipd_wiregen.h b/connectd/connectd_gossipd_wiregen.h deleted file mode 100644 index 56a4dffef..000000000 --- a/connectd/connectd_gossipd_wiregen.h +++ /dev/null @@ -1,57 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_CONNECTD_CONNECTD_GOSSIPD_WIREGEN_H -#define LIGHTNING_CONNECTD_CONNECTD_GOSSIPD_WIREGEN_H -#include -#include -#include -#include -#include -#include - -enum connectd_gossipd_wire { - /* Communication between gossipd and connectd. */ - WIRE_GOSSIPD_NEW_PEER = 4000, - /* if success: + gossip fd and gossip_store fd */ - WIRE_GOSSIPD_NEW_PEER_REPLY = 4100, - /* Connectd asks gossipd for any known addresses for that node. */ - WIRE_GOSSIPD_GET_ADDRS = 4001, - WIRE_GOSSIPD_GET_ADDRS_REPLY = 4101, -}; - -const char *connectd_gossipd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool connectd_gossipd_wire_is_defined(u16 type); - - -/* WIRE: GOSSIPD_NEW_PEER */ -/* Communication between gossipd and connectd. */ -u8 *towire_gossipd_new_peer(const tal_t *ctx, const struct node_id *id, bool gossip_queries_feature, bool initial_routing_sync); -bool fromwire_gossipd_new_peer(const void *p, struct node_id *id, bool *gossip_queries_feature, bool *initial_routing_sync); - -/* WIRE: GOSSIPD_NEW_PEER_REPLY */ -/* if success: + gossip fd and gossip_store fd */ -u8 *towire_gossipd_new_peer_reply(const tal_t *ctx, bool success, const struct gossip_state *gs); -bool fromwire_gossipd_new_peer_reply(const tal_t *ctx, const void *p, bool *success, struct gossip_state **gs); - -/* WIRE: GOSSIPD_GET_ADDRS */ -/* Connectd asks gossipd for any known addresses for that node. */ -u8 *towire_gossipd_get_addrs(const tal_t *ctx, const struct node_id *id); -bool fromwire_gossipd_get_addrs(const void *p, struct node_id *id); - -/* WIRE: GOSSIPD_GET_ADDRS_REPLY */ -u8 *towire_gossipd_get_addrs_reply(const tal_t *ctx, const struct wireaddr *addrs); -bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wireaddr **addrs); - - -#endif /* LIGHTNING_CONNECTD_CONNECTD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:a03f3546c6a3dc0ee7055ba912fffd6acf9dc86bb9dc4472ecfc240582709481 diff --git a/connectd/connectd_wiregen.c b/connectd/connectd_wiregen.c deleted file mode 100644 index b92fb4d01..000000000 --- a/connectd/connectd_wiregen.c +++ /dev/null @@ -1,446 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *connectd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum connectd_wire)e) { - case WIRE_CONNECTD_INIT: return "WIRE_CONNECTD_INIT"; - case WIRE_CONNECTD_INIT_REPLY: return "WIRE_CONNECTD_INIT_REPLY"; - case WIRE_CONNECTD_ACTIVATE: return "WIRE_CONNECTD_ACTIVATE"; - case WIRE_CONNECTD_ACTIVATE_REPLY: return "WIRE_CONNECTD_ACTIVATE_REPLY"; - case WIRE_CONNECTD_RECONNECTED: return "WIRE_CONNECTD_RECONNECTED"; - case WIRE_CONNECTD_CONNECT_TO_PEER: return "WIRE_CONNECTD_CONNECT_TO_PEER"; - case WIRE_CONNECTD_CONNECT_FAILED: return "WIRE_CONNECTD_CONNECT_FAILED"; - case WIRE_CONNECTD_PEER_CONNECTED: return "WIRE_CONNECTD_PEER_CONNECTED"; - case WIRE_CONNECTD_PEER_DISCONNECTED: return "WIRE_CONNECTD_PEER_DISCONNECTED"; - case WIRE_CONNECTD_PEER_FINAL_MSG: return "WIRE_CONNECTD_PEER_FINAL_MSG"; - case WIRE_CONNECTD_DEV_MEMLEAK: return "WIRE_CONNECTD_DEV_MEMLEAK"; - case WIRE_CONNECTD_DEV_MEMLEAK_REPLY: return "WIRE_CONNECTD_DEV_MEMLEAK_REPLY"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool connectd_wire_is_defined(u16 type) -{ - switch ((enum connectd_wire)type) { - case WIRE_CONNECTD_INIT:; - case WIRE_CONNECTD_INIT_REPLY:; - case WIRE_CONNECTD_ACTIVATE:; - case WIRE_CONNECTD_ACTIVATE_REPLY:; - case WIRE_CONNECTD_RECONNECTED:; - case WIRE_CONNECTD_CONNECT_TO_PEER:; - case WIRE_CONNECTD_CONNECT_FAILED:; - case WIRE_CONNECTD_PEER_CONNECTED:; - case WIRE_CONNECTD_PEER_DISCONNECTED:; - case WIRE_CONNECTD_PEER_FINAL_MSG:; - case WIRE_CONNECTD_DEV_MEMLEAK:; - case WIRE_CONNECTD_DEV_MEMLEAK_REPLY:; - return true; - } - return false; -} - - - - - -/* WIRE: CONNECTD_INIT */ -u8 *towire_connectd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct node_id *id, const struct wireaddr_internal *wireaddrs, const enum addr_listen_announce *listen_announce, const struct wireaddr *tor_proxyaddr, bool use_tor_proxy_always, bool dev_allow_localhost, bool use_dns, const wirestring *tor_password, bool use_v3_autotor, u32 timeout_secs) -{ - u16 num_wireaddrs = tal_count(listen_announce); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_INIT); - towire_chainparams(&p, chainparams); - towire_feature_set(&p, our_features); - towire_node_id(&p, id); - towire_u16(&p, num_wireaddrs); - for (size_t i = 0; i < num_wireaddrs; i++) - towire_wireaddr_internal(&p, wireaddrs + i); - for (size_t i = 0; i < num_wireaddrs; i++) - towire_addr_listen_announce(&p, listen_announce[i]); - if (!tor_proxyaddr) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_wireaddr(&p, tor_proxyaddr); - } - towire_bool(&p, use_tor_proxy_always); - towire_bool(&p, dev_allow_localhost); - towire_bool(&p, use_dns); - towire_wirestring(&p, tor_password); - towire_bool(&p, use_v3_autotor); - towire_u32(&p, timeout_secs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct node_id *id, struct wireaddr_internal **wireaddrs, enum addr_listen_announce **listen_announce, struct wireaddr **tor_proxyaddr, bool *use_tor_proxy_always, bool *dev_allow_localhost, bool *use_dns, wirestring **tor_password, bool *use_v3_autotor, u32 *timeout_secs) -{ - u16 num_wireaddrs; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_INIT) - return false; - fromwire_chainparams(&cursor, &plen, chainparams); - *our_features = fromwire_feature_set(ctx, &cursor, &plen); - fromwire_node_id(&cursor, &plen, id); - num_wireaddrs = fromwire_u16(&cursor, &plen); - // 2nd case wireaddrs - *wireaddrs = num_wireaddrs ? tal_arr(ctx, struct wireaddr_internal, num_wireaddrs) : NULL; - for (size_t i = 0; i < num_wireaddrs; i++) - fromwire_wireaddr_internal(&cursor, &plen, *wireaddrs + i); - // 2nd case listen_announce - *listen_announce = num_wireaddrs ? tal_arr(ctx, enum addr_listen_announce, num_wireaddrs) : NULL; - for (size_t i = 0; i < num_wireaddrs; i++) - (*listen_announce)[i] = fromwire_addr_listen_announce(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *tor_proxyaddr = NULL; - else { - *tor_proxyaddr = tal(ctx, struct wireaddr); - fromwire_wireaddr(&cursor, &plen, *tor_proxyaddr); - } - *use_tor_proxy_always = fromwire_bool(&cursor, &plen); - *dev_allow_localhost = fromwire_bool(&cursor, &plen); - *use_dns = fromwire_bool(&cursor, &plen); - *tor_password = fromwire_wirestring(ctx, &cursor, &plen); - *use_v3_autotor = fromwire_bool(&cursor, &plen); - *timeout_secs = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CONNECTD_INIT_REPLY */ -/* Connectd->master */ -u8 *towire_connectd_init_reply(const tal_t *ctx, const struct wireaddr_internal *bindings, const struct wireaddr *announcable) -{ - u16 num_bindings = tal_count(bindings); - u16 num_announcable = tal_count(announcable); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_INIT_REPLY); - towire_u16(&p, num_bindings); - for (size_t i = 0; i < num_bindings; i++) - towire_wireaddr_internal(&p, bindings + i); - towire_u16(&p, num_announcable); - for (size_t i = 0; i < num_announcable; i++) - towire_wireaddr(&p, announcable + i); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_init_reply(const tal_t *ctx, const void *p, struct wireaddr_internal **bindings, struct wireaddr **announcable) -{ - u16 num_bindings; - u16 num_announcable; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_INIT_REPLY) - return false; - num_bindings = fromwire_u16(&cursor, &plen); - // 2nd case bindings - *bindings = num_bindings ? tal_arr(ctx, struct wireaddr_internal, num_bindings) : NULL; - for (size_t i = 0; i < num_bindings; i++) - fromwire_wireaddr_internal(&cursor, &plen, *bindings + i); - num_announcable = fromwire_u16(&cursor, &plen); - // 2nd case announcable - *announcable = num_announcable ? tal_arr(ctx, struct wireaddr, num_announcable) : NULL; - for (size_t i = 0; i < num_announcable; i++) - fromwire_wireaddr(&cursor, &plen, *announcable + i); - return cursor != NULL; -} - -/* WIRE: CONNECTD_ACTIVATE */ -/* Activate the connect daemon */ -u8 *towire_connectd_activate(const tal_t *ctx, bool listen) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_ACTIVATE); - /* Do we listen? */ - towire_bool(&p, listen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_activate(const void *p, bool *listen) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_ACTIVATE) - return false; - /* Do we listen? */ - *listen = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CONNECTD_ACTIVATE_REPLY */ -/* Connectd->master */ -u8 *towire_connectd_activate_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_ACTIVATE_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_activate_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_ACTIVATE_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: CONNECTD_RECONNECTED */ -/* connectd->master: disconnect this peer please (due to reconnect). */ -u8 *towire_connectd_reconnected(const tal_t *ctx, const struct node_id *id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_RECONNECTED); - towire_node_id(&p, id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_reconnected(const void *p, struct node_id *id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_RECONNECTED) - return false; - fromwire_node_id(&cursor, &plen, id); - return cursor != NULL; -} - -/* WIRE: CONNECTD_CONNECT_TO_PEER */ -/* Master -> connectd: connect to a peer. */ -u8 *towire_connectd_connect_to_peer(const tal_t *ctx, const struct node_id *id, u32 seconds_waited, const struct wireaddr_internal *addrhint) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_CONNECT_TO_PEER); - towire_node_id(&p, id); - towire_u32(&p, seconds_waited); - if (!addrhint) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_wireaddr_internal(&p, addrhint); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_connect_to_peer(const tal_t *ctx, const void *p, struct node_id *id, u32 *seconds_waited, struct wireaddr_internal **addrhint) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_CONNECT_TO_PEER) - return false; - fromwire_node_id(&cursor, &plen, id); - *seconds_waited = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *addrhint = NULL; - else { - *addrhint = tal(ctx, struct wireaddr_internal); - fromwire_wireaddr_internal(&cursor, &plen, *addrhint); - } - return cursor != NULL; -} - -/* WIRE: CONNECTD_CONNECT_FAILED */ -/* Connectd->master: connect failed. */ -u8 *towire_connectd_connect_failed(const tal_t *ctx, const struct node_id *id, errcode_t failcode, const wirestring *failreason, u32 seconds_to_delay, const struct wireaddr_internal *addrhint) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_CONNECT_FAILED); - towire_node_id(&p, id); - towire_errcode_t(&p, failcode); - towire_wirestring(&p, failreason); - towire_u32(&p, seconds_to_delay); - if (!addrhint) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_wireaddr_internal(&p, addrhint); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_connect_failed(const tal_t *ctx, const void *p, struct node_id *id, errcode_t *failcode, wirestring **failreason, u32 *seconds_to_delay, struct wireaddr_internal **addrhint) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_CONNECT_FAILED) - return false; - fromwire_node_id(&cursor, &plen, id); - *failcode = fromwire_errcode_t(&cursor, &plen); - *failreason = fromwire_wirestring(ctx, &cursor, &plen); - *seconds_to_delay = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *addrhint = NULL; - else { - *addrhint = tal(ctx, struct wireaddr_internal); - fromwire_wireaddr_internal(&cursor, &plen, *addrhint); - } - return cursor != NULL; -} - -/* WIRE: CONNECTD_PEER_CONNECTED */ -/* Connectd -> master: we got a peer. Three fds: peer */ -u8 *towire_connectd_peer_connected(const tal_t *ctx, const struct node_id *id, const struct wireaddr_internal *addr, bool incoming, const struct per_peer_state *pps, const u8 *features) -{ - u16 flen = tal_count(features); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_PEER_CONNECTED); - towire_node_id(&p, id); - towire_wireaddr_internal(&p, addr); - towire_bool(&p, incoming); - towire_per_peer_state(&p, pps); - towire_u16(&p, flen); - towire_u8_array(&p, features, flen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_peer_connected(const tal_t *ctx, const void *p, struct node_id *id, struct wireaddr_internal *addr, bool *incoming, struct per_peer_state **pps, u8 **features) -{ - u16 flen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_PEER_CONNECTED) - return false; - fromwire_node_id(&cursor, &plen, id); - fromwire_wireaddr_internal(&cursor, &plen, addr); - *incoming = fromwire_bool(&cursor, &plen); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - flen = fromwire_u16(&cursor, &plen); - // 2nd case features - *features = flen ? tal_arr(ctx, u8, flen) : NULL; - fromwire_u8_array(&cursor, &plen, *features, flen); - return cursor != NULL; -} - -/* WIRE: CONNECTD_PEER_DISCONNECTED */ -/* master -> connectd: peer has disconnected. */ -u8 *towire_connectd_peer_disconnected(const tal_t *ctx, const struct node_id *id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_PEER_DISCONNECTED); - towire_node_id(&p, id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_peer_disconnected(const void *p, struct node_id *id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_PEER_DISCONNECTED) - return false; - fromwire_node_id(&cursor, &plen, id); - return cursor != NULL; -} - -/* WIRE: CONNECTD_PEER_FINAL_MSG */ -/* master -> connectd: give message to peer and disconnect. Three fds: peer */ -u8 *towire_connectd_peer_final_msg(const tal_t *ctx, const struct node_id *id, const struct per_peer_state *pps, const u8 *msg) -{ - u16 len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_PEER_FINAL_MSG); - towire_node_id(&p, id); - towire_per_peer_state(&p, pps); - towire_u16(&p, len); - towire_u8_array(&p, msg, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_peer_final_msg(const tal_t *ctx, const void *p, struct node_id *id, struct per_peer_state **pps, u8 **msg) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_PEER_FINAL_MSG) - return false; - fromwire_node_id(&cursor, &plen, id); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); - return cursor != NULL; -} - -/* WIRE: CONNECTD_DEV_MEMLEAK */ -/* master -> connectd: do you have a memleak? */ -u8 *towire_connectd_dev_memleak(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_DEV_MEMLEAK); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_dev_memleak(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_DEV_MEMLEAK) - return false; - return cursor != NULL; -} - -/* WIRE: CONNECTD_DEV_MEMLEAK_REPLY */ -u8 *towire_connectd_dev_memleak_reply(const tal_t *ctx, bool leak) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CONNECTD_DEV_MEMLEAK_REPLY); - towire_bool(&p, leak); - - return memcheck(p, tal_count(p)); -} -bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CONNECTD_DEV_MEMLEAK_REPLY) - return false; - *leak = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} -// SHA256STAMP:f10d8c579846bdad3caee38596f5b3a89af7f0be89ab569175045e9375ada5d0 diff --git a/connectd/connectd_wiregen.h b/connectd/connectd_wiregen.h deleted file mode 100644 index aaf3f060c..000000000 --- a/connectd/connectd_wiregen.h +++ /dev/null @@ -1,113 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H -#define LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include - -enum connectd_wire { - WIRE_CONNECTD_INIT = 2000, - /* Connectd->master */ - WIRE_CONNECTD_INIT_REPLY = 2100, - /* Activate the connect daemon */ - WIRE_CONNECTD_ACTIVATE = 2025, - /* Connectd->master */ - WIRE_CONNECTD_ACTIVATE_REPLY = 2125, - /* connectd->master: disconnect this peer please (due to reconnect). */ - WIRE_CONNECTD_RECONNECTED = 2112, - /* Master -> connectd: connect to a peer. */ - WIRE_CONNECTD_CONNECT_TO_PEER = 2001, - /* Connectd->master: connect failed. */ - WIRE_CONNECTD_CONNECT_FAILED = 2020, - /* Connectd -> master: we got a peer. Three fds: peer */ - WIRE_CONNECTD_PEER_CONNECTED = 2002, - /* master -> connectd: peer has disconnected. */ - WIRE_CONNECTD_PEER_DISCONNECTED = 2015, - /* master -> connectd: give message to peer and disconnect. Three fds: peer */ - WIRE_CONNECTD_PEER_FINAL_MSG = 2003, - /* master -> connectd: do you have a memleak? */ - WIRE_CONNECTD_DEV_MEMLEAK = 2033, - WIRE_CONNECTD_DEV_MEMLEAK_REPLY = 2133, -}; - -const char *connectd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool connectd_wire_is_defined(u16 type); - - -/* WIRE: CONNECTD_INIT */ -u8 *towire_connectd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct node_id *id, const struct wireaddr_internal *wireaddrs, const enum addr_listen_announce *listen_announce, const struct wireaddr *tor_proxyaddr, bool use_tor_proxy_always, bool dev_allow_localhost, bool use_dns, const wirestring *tor_password, bool use_v3_autotor, u32 timeout_secs); -bool fromwire_connectd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct node_id *id, struct wireaddr_internal **wireaddrs, enum addr_listen_announce **listen_announce, struct wireaddr **tor_proxyaddr, bool *use_tor_proxy_always, bool *dev_allow_localhost, bool *use_dns, wirestring **tor_password, bool *use_v3_autotor, u32 *timeout_secs); - -/* WIRE: CONNECTD_INIT_REPLY */ -/* Connectd->master */ -u8 *towire_connectd_init_reply(const tal_t *ctx, const struct wireaddr_internal *bindings, const struct wireaddr *announcable); -bool fromwire_connectd_init_reply(const tal_t *ctx, const void *p, struct wireaddr_internal **bindings, struct wireaddr **announcable); - -/* WIRE: CONNECTD_ACTIVATE */ -/* Activate the connect daemon */ -u8 *towire_connectd_activate(const tal_t *ctx, bool listen); -bool fromwire_connectd_activate(const void *p, bool *listen); - -/* WIRE: CONNECTD_ACTIVATE_REPLY */ -/* Connectd->master */ -u8 *towire_connectd_activate_reply(const tal_t *ctx); -bool fromwire_connectd_activate_reply(const void *p); - -/* WIRE: CONNECTD_RECONNECTED */ -/* connectd->master: disconnect this peer please (due to reconnect). */ -u8 *towire_connectd_reconnected(const tal_t *ctx, const struct node_id *id); -bool fromwire_connectd_reconnected(const void *p, struct node_id *id); - -/* WIRE: CONNECTD_CONNECT_TO_PEER */ -/* Master -> connectd: connect to a peer. */ -u8 *towire_connectd_connect_to_peer(const tal_t *ctx, const struct node_id *id, u32 seconds_waited, const struct wireaddr_internal *addrhint); -bool fromwire_connectd_connect_to_peer(const tal_t *ctx, const void *p, struct node_id *id, u32 *seconds_waited, struct wireaddr_internal **addrhint); - -/* WIRE: CONNECTD_CONNECT_FAILED */ -/* Connectd->master: connect failed. */ -u8 *towire_connectd_connect_failed(const tal_t *ctx, const struct node_id *id, errcode_t failcode, const wirestring *failreason, u32 seconds_to_delay, const struct wireaddr_internal *addrhint); -bool fromwire_connectd_connect_failed(const tal_t *ctx, const void *p, struct node_id *id, errcode_t *failcode, wirestring **failreason, u32 *seconds_to_delay, struct wireaddr_internal **addrhint); - -/* WIRE: CONNECTD_PEER_CONNECTED */ -/* Connectd -> master: we got a peer. Three fds: peer */ -u8 *towire_connectd_peer_connected(const tal_t *ctx, const struct node_id *id, const struct wireaddr_internal *addr, bool incoming, const struct per_peer_state *pps, const u8 *features); -bool fromwire_connectd_peer_connected(const tal_t *ctx, const void *p, struct node_id *id, struct wireaddr_internal *addr, bool *incoming, struct per_peer_state **pps, u8 **features); - -/* WIRE: CONNECTD_PEER_DISCONNECTED */ -/* master -> connectd: peer has disconnected. */ -u8 *towire_connectd_peer_disconnected(const tal_t *ctx, const struct node_id *id); -bool fromwire_connectd_peer_disconnected(const void *p, struct node_id *id); - -/* WIRE: CONNECTD_PEER_FINAL_MSG */ -/* master -> connectd: give message to peer and disconnect. Three fds: peer */ -u8 *towire_connectd_peer_final_msg(const tal_t *ctx, const struct node_id *id, const struct per_peer_state *pps, const u8 *msg); -bool fromwire_connectd_peer_final_msg(const tal_t *ctx, const void *p, struct node_id *id, struct per_peer_state **pps, u8 **msg); - -/* WIRE: CONNECTD_DEV_MEMLEAK */ -/* master -> connectd: do you have a memleak? */ -u8 *towire_connectd_dev_memleak(const tal_t *ctx); -bool fromwire_connectd_dev_memleak(const void *p); - -/* WIRE: CONNECTD_DEV_MEMLEAK_REPLY */ -u8 *towire_connectd_dev_memleak_reply(const tal_t *ctx, bool leak); -bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak); - - -#endif /* LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H */ -// SHA256STAMP:f10d8c579846bdad3caee38596f5b3a89af7f0be89ab569175045e9375ada5d0 diff --git a/doc/lightning-addgossip.7 b/doc/lightning-addgossip.7 deleted file mode 100644 index b90734926..000000000 --- a/doc/lightning-addgossip.7 +++ /dev/null @@ -1,38 +0,0 @@ -.TH "LIGHTNING-ADDGOSSIP" "7" "" "" "lightning-addgossip" -.SH NAME -lightning-addgossip - Command for injecting a gossip message (low-level) -.SH SYNOPSIS - -\fBaddgossip\fR \fImessage\fR - -.SH DESCRIPTION - -The \fBaddgossip\fR RPC command injects a hex-encoded gossip message into -the gossip daemon\. It may return an error if it is malformed, or may -update its internal state using the gossip message\. - - -Note that currently some paths will still silently reject the gossip: it -is best effort\. - - -This is particularly used by plugins which may receive channel_update -messages within error replies\. - -.SH RETURN VALUE - -On success, an empty object is returned\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-pay\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:abe4b88f82d3e6894742133522bbc025409c8bca287f47dbe41e63f78fa76ef9 diff --git a/doc/lightning-autocleaninvoice.7 b/doc/lightning-autocleaninvoice.7 deleted file mode 100644 index 8fc22e40e..000000000 --- a/doc/lightning-autocleaninvoice.7 +++ /dev/null @@ -1,57 +0,0 @@ -.TH "LIGHTNING-AUTOCLEANINVOICE" "7" "" "" "lightning-autocleaninvoice" -.SH NAME -lightning-autocleaninvoice - Set up auto-delete of expired invoice -.SH SYNOPSIS - -\fBautocleaninvoice\fR [\fIcycle_seconds\fR] [\fIexpired_by\fR] - -.SH DESCRIPTION - -The \fBautocleaninvoice\fR RPC command sets up automatic cleaning of -expired invoices\. - - -Autoclean will be done every \fIcycle_seconds\fR seconds\. Setting -\fIcycle_seconds\fR to 0 disables autoclean\. If not specified, this -defaults to 3600 (one hour)\. - - -Every autoclean cycle, expired invoices, which have already been expired -for at least \fIexpired_by\fR seconds, will be deleted\. If \fIexpired_by\fR is -not specified, this defaults to 86400 (one day)\. - - -On startup of the daemon, no autoclean is set up\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBenabled\fR (boolean): whether invoice autocleaning is active - -.RE - -If \fBenabled\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBexpired_by\fR (u64): how long an invoice must be expired (seconds) before we delete it -.IP \[bu] -\fBcycle_seconds\fR (u64): how long an invoice must be expired (seconds) before we delete it - -.RE -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-delexpiredinvoice\fR(7), \fBlightning-delinvoice\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:ec375ac1566528596d5e382cc9d82718266c8ccb32469ff1fc6df52c92ea4dab diff --git a/doc/lightning-check.7 b/doc/lightning-check.7 deleted file mode 100644 index c950b4b15..000000000 --- a/doc/lightning-check.7 +++ /dev/null @@ -1,42 +0,0 @@ -.TH "LIGHTNING-CHECK" "7" "" "" "lightning-check" -.SH NAME -lightning-check - Command for verifying parameters -.SH SYNOPSIS - -\fBcheck\fR \fIcommand_to_check\fR [\fIparameters\fR] - -.SH DESCRIPTION - -The \fBcheck\fR RPC command verifies another command’s parameters without -running it\. - - -The \fIcommand_to_check\fR is the name of the relevant command\. - - -\fIparameters\fR is the command’s parameters\. - - -This does not guarantee successful execution of the command in all -cases\. For example, a call to \fBlightning-getroute\fR(7) may still fail to -find a route even if checking the parameters succeeds\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBcommand_to_check\fR (string): the \fIcommand_to_check\fR argument - -.RE -.SH AUTHOR - -Mark Beckwith \fI and Rusty Russell -\fI are mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:3a0e3635cb3ec89d67ec13485220e16e362ed8588213382c8ae5cf4f6f1e0523 diff --git a/doc/lightning-checkmessage.7 b/doc/lightning-checkmessage.7 deleted file mode 100644 index 941356319..000000000 --- a/doc/lightning-checkmessage.7 +++ /dev/null @@ -1,59 +0,0 @@ -.TH "LIGHTNING-CHECKMESSAGE" "7" "" "" "lightning-checkmessage" -.SH NAME -lightning-checkmessage - Command to check if a signature is from a node -.SH SYNOPSIS - -\fBcheckmessage\fR \fImessage\fR \fIzbase\fR [\fIpubkey\fR] - -.SH DESCRIPTION - -The \fBcheckmessage\fR RPC command is the counterpart to -\fBsignmessage\fR: given a node id (\fIpubkey\fR), signature (\fIzbase\fR) and a -\fImessage\fR, it verifies that the signature was generated by that node -for that message (more technically: by someone who knows that node's -secret)\. - - -As a special case, if \fIpubkey\fR is not specified, we will try every -known node key (as per \fIlistnodes\fR), and verification succeeds if it -matches for any one of them\. Note: this is implemented far more -efficiently than trying each one, so performance is not a concern\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBverified\fR (boolean): Whether the signature was valid - -.RE - -If \fBverified\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBpubkey\fR (pubkey): the \fIpubkey\fR parameter, or the pubkey found by looking for known nodes - -.RE - -If \fBverified\fR is \fIfalse\fR: - -.RS -.IP \[bu] -\fBpubkey\fR (pubkey): the \fIpubkey\fR (if any) which could have signed this; this is usually not useful! - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-signmessage\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:48a79a23d402a4f88eadf7db3515c1887534e01931f842380642460bb62f9691 diff --git a/doc/lightning-cli.1 b/doc/lightning-cli.1 deleted file mode 100644 index c522e17c7..000000000 --- a/doc/lightning-cli.1 +++ /dev/null @@ -1,141 +0,0 @@ -.TH "LIGHTNING-CLI" "1" "" "" "lightning-cli" -.SH NAME -lightning-cli - Control lightning daemon -.SH SYNOPSIS - -\fBlightning-cli\fR [\fIOPTIONS\fR] \fIcommand\fR… - -.SH DESCRIPTION - -\fBlightning-cli\fR sends commands to the lightning daemon\. - -.SH OPTIONS - - \fB--lightning-dir\fR=\fIDIR\fR -Set the directory for the lightning daemon we’re talking to; defaults to -\fI$HOME/\.lightning\fR\. - - - \fB--conf\fR=\fIPATH\fR -Sets configuration file (default: \fBlightning-dir\fR/\fIconfig\fR )\. - - - \fB--network\fR=\fInetwork\fR - \fB--mainnet\fR - \fB--testnet\fR - \fB--signet\fR -Sets network explicitly\. - - - \fB--rpc-file\fR=\fIFILE\fR -Named pipe to use to talk to lightning daemon: default is -\fIlightning-rpc\fR in the lightning directory\. - - - \fB--keywords\fR/\fB-k\fR -Use format \fIkey\fR=\fIvalue\fR for parameters in any order - - - \fB--order\fR/\fB-o\fR -Follow strictly the order of parameters for the command - - - \fB--json\fR/\fB-J\fR -Return result in JSON format (default unless \fIhelp\fR command, -or result contains a \fBformat-hint\fR field)\. - - - \fB--raw\fR/\fB-R\fR -Return raw JSON directly as lightningd replies; this can be faster for -large requests\. - - - \fB--human-readable\fR/\fB-H\fR -Return result in human-readable output\. - - - \fB--flat\fR/\fB-F\fR -Return JSON result in flattened one-per-line output, e\.g\. \fB{ "help": -[ { "command": "check" } ] }\fR would become \fBhelp[0].command=check\fR\. -This is useful for simple scripts which want to find a specific output -field without parsing JSON\. - - - \fB--notifications\fR/\fB-N\fR=\fILEVEL\fR -If \fILEVEL\fR is 'none', then never print out notifications\. Otherwise, -print out notifications of \fILEVEL\fR or above (one of \fBio\fR, \fBdebug\fR, -\fBinfo\fR (the default), \fBunusual\fR or \fBbroken\fR: they are prefixed with \fB#\fR\. - - - \fB--help\fR/\fB-h\fR -Pretty-print summary of options to standard output and exit\. The format can -be changed using -F, -R, -J, -H etc\. - - - \fB--version\fR/\fB-V\fR -Print version number to standard output and exit\. - - - \fBallow-deprecated-apis\fR=\fIBOOL\fR -Enable deprecated options\. It defaults to \fItrue\fR, but you should set -it to \fIfalse\fR when testing to ensure that an upgrade won’t break your -configuration\. - -.SH COMMANDS - -\fIlightning-cli\fR simply uses the JSON RPC interface to talk to -\fIlightningd\fR, and prints the results\. Thus the commands available depend -entirely on the lightning daemon itself\. - -.SH ARGUMENTS - -Arguments may be provided positionally or using \fIkey\fR=\fIvalue\fR after the -command name, based on either \fB-o\fR or \fB-k\fR option\. When using \fB-k\fR -consider prefixing all arguments of the command with their respective keyword, -this is to avoid having lightningd intrepret the position of an arguement\. - - -Arguments may be integer numbers (composed entirely of digits), floating-point -numbers (has a radix point but otherwise composed of digits), \fItrue\fR, \fIfalse\fR, -or \fInull\fR\. Other arguments are treated as strings\. - - -Some commands have optional arguments\. You may use \fInull\fR to skip -optional arguments to provide later arguments, although this is not encouraged\. - -.SH EXAMPLES -.RS -.IP 1\. -List commands - -.RE - -lightning-cli help - -.RS -.IP 1\. -Fund a 10k sat channel using uncomfirmed outputs - -.RE - -lightning-cli --keywords fundchannel id=028f\.\.\.ae7d amount=10000sat minconf=0 - -.SH BUGS - -This manpage documents how it should work, not how it does work\. The -pretty printing of results isn’t pretty\. - -.SH AUTHOR - -Rusty Russell \fI is mainly to blame\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -.SH COPYING - -Note: the modules in the ccan/ directory have their own licenses, but -the rest of the code is covered by the BSD-style MIT license\. - -\" SHA256STAMP:95f9c48c35817ea601ba35006c8400c52da372ffbe725ff1fa6feec9ced3229f diff --git a/doc/lightning-close.7 b/doc/lightning-close.7 deleted file mode 100644 index eba084438..000000000 --- a/doc/lightning-close.7 +++ /dev/null @@ -1,157 +0,0 @@ -.TH "LIGHTNING-CLOSE" "7" "" "" "lightning-close" -.SH NAME -lightning-close - Command for closing channels with direct peers -.SH SYNOPSIS - -\fBclose\fR \fIid\fR [\fIunilateraltimeout\fR] [\fIdestination\fR] [\fIfee_negotiation_step\fR] [\fIwrong_funding\fR] [\fIforce_lease_closed\fR] [*feerange*] - -.SH DESCRIPTION - -The \fBclose\fR RPC command attempts to close the channel cooperatively -with the peer, or unilaterally after \fIunilateraltimeout\fR, and the -to-local output will be sent to the address specified in \fIdestination\fR\. - - -If the given \fIid\fR is a peer ID (66 hex digits as a string), then it -applies to the active channel of the direct peer corresponding to the -given peer ID\. If the given \fIid\fR is a channel ID (64 hex digits as a -string, or the short channel ID \fIblockheight:txindex:outindex\fR form), -then it applies to that channel\. - - -If \fIunilateraltimeout\fR is not zero, the \fBclose\fR command will -unilaterally close the channel when that number of seconds is reached\. -If \fIunilateraltimeout\fR is zero, then the \fBclose\fR command will wait -indefinitely until the peer is online and can negotiate a mutual close\. -The default is 2 days (172800 seconds)\. - - -The \fIdestination\fR can be of any Bitcoin accepted type, including bech32\. -If it isn't specified, the default is a c-lightning wallet address\. If -the peer hasn't offered the \fBoption_shutdown_anysegwit\fR feature, then -taproot addresses (or other v1+ segwit) are not allowed\. Tell your -friends to upgrade! - - -The \fIfee_negotiation_step\fR parameter controls how closing fee -negotiation is performed assuming the peer proposes a fee that is -different than our estimate\. (Note that modern peers use the quick-close protocol which does not allow negotiation: see \fIfeerange\fR instead)\. - - -On every negotiation step we must give up -some amount from our proposal towards the peer's proposal\. This parameter -can be an integer in which case it is interpreted as number of satoshis -to step at a time\. Or it can be an integer followed by "%" to designate -a percentage of the interval to give up\. A few examples, assuming the peer -proposes a closing fee of 3000 satoshi and our estimate shows it must be 4000: - -.RS -.IP \[bu] -"10": our next proposal will be 4000-10=3990\. -.IP \[bu] -"10%": our next proposal will be 4000-(10% of (4000-3000))=3900\. -.IP \[bu] -"1": our next proposal will be 3999\. This is the most extreme case when we -insist on our fee as much as possible\. -.IP \[bu] -"100%": our next proposal will be 3000\. This is the most relaxed case when -we quickly accept the peer's proposal\. - -.RE - -The default is "50%"\. - - -\fIwrong_funding_txid\fR can only be specified if both sides have offered -the "shutdown_wrong_funding" feature (enabled by the -\fBexperimental-shutdown-wrong-funding\fR option): it must be a -transaction id followed by a colon then the output number\. Instead of -negotiating a shutdown to spend the expected funding transaction, the -shutdown transaction will spend this output instead\. This is only -allowed if this peer opened the channel and the channel is unused: it -can rescue openings which have been manually miscreated\. - - -\fIforce_lease_closed\fR if the channel has funds leased to the peer -(option_will_fund), we prevent initiation of a mutual close -unless this flag is passed in\. Defaults to false\. - - -\fIfeerange\fR is an optional array [ \fImin\fR, \fImax\fR ], indicating the -minimum and maximum feerates to offer: the peer will obey these if it -supports the quick-close protocol\. \fIslow\fR and \fIunilateral_close\fR are -the defaults\. - - -Rates are one of the strings \fIurgent\fR (aim for next block), \fInormal\fR -(next 4 blocks or so) or \fIslow\fR (next 100 blocks or so) to use -lightningd’s internal estimates, or one of the names from -\fBlightning-feerates\fR(7)\. Otherwise, they can be numbers with -an optional suffix: \fIperkw\fR means the number is interpreted as -satoshi-per-kilosipa (weight), and \fIperkb\fR means it is interpreted -bitcoind-style as satoshi-per-kilobyte\. Omitting the suffix is -equivalent to \fIperkb\fR\. - - -Note that the maximum fee will be capped at the final commitment -transaction fee (unless the experimental anchor-outputs option is -negotiated)\. - - -The peer needs to be live and connected in order to negotiate a mutual -close\. The default of unilaterally closing after 48 hours is usually a -reasonable indication that you can no longer contact the peer\. - -.SH NOTES - -Prior to 0\.7\.2, \fBclose\fR took two parameters: \fIforce\fR and \fItimeout\fR\. -\fItimeout\fR was the number of seconds before \fIforce\fR took effect (default, -30), and \fIforce\fR determined whether the result was a unilateral close or -an RPC error (default)\. Even after the timeout, the channel would be -closed if the peer reconnected\. - -.SH NOTIFICATIONS - -Notifications may be returned indicating what is going on, especially -if the peer is offline and we are waiting\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtype\fR (string): Whether we successfully negotiated a mutual close, closed without them, or discarded not-yet-opened channel (one of "mutual", "unilateral", "unopened") - -.RE - -If \fBtype\fR is "mutual" or "unilateral": - -.RS -.IP \[bu] -\fBtx\fR (hex): the raw bitcoin transaction used to close the channel (if it was open) -.IP \[bu] -\fBtxid\fR (txid): the transaction id of the \fItx\fR field - -.RE - -A unilateral close may still occur at any time if the peer did not -behave correctly during the close negotiation\. - - -Unilateral closes will return your funds after a delay\. The delay will -vary based on the peer \fIto_self_delay\fR setting, not your own setting\. - -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-disconnect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightningd-config\fR(5)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:1182e596ddf208f37d269e37b06e30199b8d6b6bc1373d92096557c20ad437ac diff --git a/doc/lightning-connect.7 b/doc/lightning-connect.7 deleted file mode 100644 index 1d45221d5..000000000 --- a/doc/lightning-connect.7 +++ /dev/null @@ -1,133 +0,0 @@ -.TH "LIGHTNING-CONNECT" "7" "" "" "lightning-connect" -.SH NAME -lightning-connect - Command for connecting to another lightning node -.SH SYNOPSIS - -\fBconnect\fR \fIid\fR [\fIhost\fR \fIport\fR] - -.SH DESCRIPTION - -The \fBconnect\fR RPC command establishes a new connection with another -node in the Lightning Network\. - - -\fIid\fR represents the target node’s public key\. As a convenience, \fIid\fR may -be of the form \fIid@host\fR or \fIid@host:port\fR\. In this case, the \fIhost\fR and -\fIport\fR parameters must be omitted\. - - -\fIhost\fR is the peer’s hostname or IP address\. - - -If not specified, the \fIport\fR defaults to 9735\. - - -If \fIhost\fR is not specified (or doesn't work), the connection will be attempted to an IP -belonging to \fIid\fR obtained through gossip with other already connected -peers\. -This can fail if your C-lightning node is a fresh install that has not -connected to any peers yet (your node has no gossip yet), -or if the target \fIid\fR is a fresh install that has no channels yet -(nobody will gossip about a node until it has one published channel)\. - - -If \fIhost\fR begins with a \fI/\fR it is interpreted as a local path, and the -connection will be made to that local socket (see \fBbind-addr\fR in -\fBlightningd-config\fR(5))\. - - -Connecting to a node is just the first step in opening a channel with -another node\. Once the peer is connected a channel can be opened with -\fBlightning-fundchannel\fR(7)\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBid\fR (pubkey): the peer we connected to -.IP \[bu] -\fBfeatures\fR (hex): BOLT 9 features bitmap offered by peer -.IP \[bu] -\fBdirection\fR (string): Whether they initiated connection or we did (one of "in", "out") -.IP \[bu] - -\fBaddress\fR (object): Address information (mainly useful if \fBdirection\fR is \fIout\fR): - -.RS -.IP \[bu] -\fBtype\fR (string): Type of connection (\fItorv2\fR/\fItorv3\fR only if \fBdirection\fR is \fIout\fR) (one of "local socket", "ipv4", "ipv6", "torv2", "torv3") - -.RE - -If \fBtype\fR is "local socket": - -.RS -.IP \[bu] -\fBsocket\fR (string): socket filename - -.RE - -If \fBtype\fR is "ipv4", "ipv6", "torv2" or "torv3": - -.RS -.IP \[bu] -\fBaddress\fR (string): address in expected format for \fBtype\fR -.IP \[bu] -\fBport\fR (u16): port number - -.RE - - -.RE -.SH ERRORS - -On failure, one of the following errors will be returned: - -.nf -.RS -{ "code" : 400, "message" : "Unable to connect, no address known for peer" } - - -.RE - -.fi - -If some addresses are known but connecting to all of them failed, the message -will contain details about the failures: - -.nf -.RS -{ "code" : 401, "message" : "..." } - - -.RE - -.fi - -If the given parameters are wrong: - -.nf -.RS -{ "code" : -32602, "message" : "..." } - - -.RE - -.fi -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. -Felix \fI is the original author of this manpage\. - -.SH SEE ALSO - -\fBlightning-fundchannel\fR(7), \fBlightning-listpeers\fR(7), -\fBlightning-listchannels\fR(7), \fBlightning-disconnect\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:87969bceedc028fb46f2bcbf437dab468ed34df73cb1010d6e7073ce2aa6cc33 diff --git a/doc/lightning-createinvoice.7 b/doc/lightning-createinvoice.7 deleted file mode 100644 index 7d65d4685..000000000 --- a/doc/lightning-createinvoice.7 +++ /dev/null @@ -1,96 +0,0 @@ -.TH "LIGHTNING-CREATEINVOICE" "7" "" "" "lightning-createinvoice" -.SH NAME -lightning-createinvoice - Low-level invoice creation -.SH SYNOPSIS - -\fBcreateinvoice\fR \fIinvstring\fR \fIlabel\fR \fIpreimage\fR - -.SH DESCRIPTION - -The \fBcreateinvoice\fR RPC command signs and saves an invoice into the -database\. - - -The \fIinvstring\fR parameter is of bolt11 form, but without the final -signature appended\. Minimal sanity checks are done\. (Note: if -\fBexperimental-offers\fR is enabled, \fIinvstring\fR can actually be an -unsigned bolt12 invoice)\. - - -The \fIlabel\fR must be a unique string or number (which is treated as a -string, so "01" is different from "1"); it is never revealed to other -nodes on the lightning network, but it can be used to query the status -of this invoice\. - - -The \fIpreimage\fR is the preimage to supply upon successful payment of -the invoice\. - -.SH RETURN VALUE - -(Note: the return format is the same as \fBlightning-listinvoices\fR(7))\. - - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBlabel\fR (string): the label for the invoice -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): Whether it has been paid, or can no longer be paid (one of "paid", "expired", "unpaid") -.IP \[bu] -\fBdescription\fR (string): Description extracted from \fBbolt11\fR or \fBbolt12\fR -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp of when invoice expires (or expired) -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (always present unless \fBbolt12\fR is) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string instead of \fBbolt11\fR (\fBexperimental-offers\fR only) -.IP \[bu] -\fBamount_msat\fR (msat, optional): The amount of the invoice (if it has one) -.IP \[bu] -\fBpay_index\fR (u64, optional): Incrementing id for when this was paid (\fBstatus\fR \fIpaid\fR only) -.IP \[bu] -\fBamount_received_msat\fR (msat, optional): Amount actually received (\fBstatus\fR \fIpaid\fR only) -.IP \[bu] -\fBpaid_at\fR (u64, optional): UNIX timestamp of when invoice was paid (\fBstatus\fR \fIpaid\fR only) -.IP \[bu] -\fBpayment_preimage\fR (hex, optional): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) -.IP \[bu] -\fBlocal_offer_id\fR (hex, optional): the \fIid\fR of our offer which created this invoice (\fBexperimental-offers\fR only)\. (always 64 characters) -.IP \[bu] -\fBpayer_note\fR (string, optional): the optional \fIpayer_note\fR from invoice_request which created this invoice (\fBexperimental-offers\fR only)\. - -.RE - -On failure, an error is returned and no invoice is created\. If the -lightning process fails before responding, the caller should use -\fBlightning-listinvoices\fR(7) to query whether this invoice was created or -not\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -900: An invoice with the given \fIlabel\fR already exists\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-invoice\fR(7), \fBlightning-listinvoices\fR(7), \fBlightning-delinvoice\fR(7), -\fBlightning-getroute\fR(7), \fBlightning-sendpay\fR(7), \fBlightning-offer\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:60b18d0cd15a2133f653b4623d5172df2ffa101b38e36add17fd9d2836b0845b diff --git a/doc/lightning-createonion.7 b/doc/lightning-createonion.7 deleted file mode 100644 index a3b448e78..000000000 --- a/doc/lightning-createonion.7 +++ /dev/null @@ -1,156 +0,0 @@ -.TH "LIGHTNING-CREATEONION" "7" "" "" "lightning-createonion" -.SH NAME -lightning-createonion - Low-level command to create a custom onion -.SH SYNOPSIS - -\fBcreateonion\fR \fIhops\fR \fIassocdata\fR [\fIsession_key\fR] [\fIonion_size\fR] - -.SH DESCRIPTION - -The \fBcreateonion\fR RPC command allows the caller to create a custom onion -with custom payloads at each hop in the route\. A custom onion can be used to -implement protocol extensions that are not supported by c-lightning directly\. - - -The \fIhops\fR parameter is a JSON list of dicts, each specifying a node and the -payload destined for that node\. The following is an example of a 3 hop onion: - -.nf -.RS -[ - { - "pubkey": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59", - "payload": "00000067000001000100000000000003e90000007b000000000000000000000000000000000000000000000000" - }, { - "pubkey": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d", - "payload": "00000067000003000100000000000003e800000075000000000000000000000000000000000000000000000000" - }, { - "style": "legacy", - "pubkey": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199", - "payload": "00000067000003000100000000000003e800000075000000000000000000000000000000000000000000000000" - } -] -.RE - -.fi - -The \fIhops\fR parameter is very similar to the result from \fBgetroute\fR however it -needs to be modified slightly\. The following is the \fBgetroute\fR response from -which the above \fIhops\fR parameter was generated: - -.nf -.RS -[ - { - "id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59", - "channel": "103x2x1", - "direction": 1, - "msatoshi": 1002, - "amount_msat": "1002msat", - "delay": 21, - "style": "legacy" - }, { - "id": "035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d", - "channel": "103x1x1", - "direction": 0, - "msatoshi": 1001, - "amount_msat": "1001msat", - "delay": 15, - "style": "legacy" - }, { - "id": "0382ce59ebf18be7d84677c2e35f23294b9992ceca95491fcf8a56c6cb2d9de199", - "channel": "103x3x1", - "direction": 0, - "msatoshi": 1000, - "amount_msat": "1000msat", - "delay": 9, - "style": "legacy" - } -] -.RE - -.fi -.RS -.IP \[bu] -Notice that the payload in the \fIhops\fR parameter is the hex-encoded version -of the parameters in the \fBgetroute\fR response\. -.IP \[bu] -Except for the pubkey, the values are shifted left by one, i\.e\., the 1st -payload in \fBcreateonion\fR corresponds to the 2nd set of values from \fBgetroute\fR\. -.IP \[bu] -The final payload is a copy of the last payload sans \fBchannel\fR - -.RE - -These rules are directly derived from the onion construction\. Please refer -\fBBOLT 04\fR (\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md\fR) for details and rationale\. - - -The \fIassocdata\fR parameter specifies the associated data that the onion should -commit to\. If the onion is to be used to send a payment later it MUST match -the \fBpayment_hash\fR of the payment in order to be valid\. - - -The optional \fIsession_key\fR parameter can be used to specify a secret that is -used to generate the shared secrets used to encrypt the onion for each hop\. It -should only be used for testing or if a specific shared secret is -important\. If not specified it will be securely generated internally, and the -shared secrets will be returned\. - - -The optional \fIonion_size\fR parameter specifies a size different from the default -payment onion (1300 bytes)\. May be used for custom protocols like trampoline -routing\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBonion\fR (hex): the onion packet (\fIonion_size\fR bytes) -.IP \[bu] -\fBshared_secrets\fR (array of hexs): one shared secret for each node in the \fIhops\fR parameter: -.RS -.IP \[bu] -the shared secret with this hop (always 64 characters) - -.RE - - -.RE -.SH EXAMPLE - -The following example is the result of calling \fIcreateonion\fR with the -above hops parameter: - -.nf -.RS -{ - "onion": "0003f3f80d2142b953319336d2fe4097[...✂...]6af33fcf4fb113bce01f56dd62248a9e5fcbbfba35c", - "shared_secrets": [ - "88ce98c73e4d9293ab1797b0a913fe9bca0213a566252047d01b8af6da871f3e", - "4474d296810e57bd460ef8b83d2e7d288321f8a99ff7686f87384699747bcfc4", - "2a862e4123e01799a732be487fbce297f7dc7cc1467e410f18369cfee476adc2" - ] -} -.RE - -.fi - -The \fBonion\fR corresponds to 1366 hex-encoded bytes\. Each shared secret consists -of 32 hex-encoded bytes\. Both arguments can be passed on to \fBsendonion\fR\. - -.SH AUTHOR - -Christian Decker \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-sendonion\fR(7), \fBlightning-getroute\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:969d90ddb478aaff5ca1416aac1a588af9f2324b775b430169e1a317981811cb diff --git a/doc/lightning-datastore.7 b/doc/lightning-datastore.7 deleted file mode 100644 index 0122dbad8..000000000 --- a/doc/lightning-datastore.7 +++ /dev/null @@ -1,84 +0,0 @@ -.TH "LIGHTNING-DATASTORE" "7" "" "" "lightning-datastore" -.SH NAME -lightning-datastore - Command for storing (plugin) data -.SH SYNOPSIS - -\fBdatastore\fR \fIkey\fR [\fIstring\fR] [\fIhex\fR] [\fImode\fR] [\fIgeneration\fR] - -.SH DESCRIPTION - -The \fBdatastore\fR RPC command allows plugins to store data in the -c-lightning database, for later retrieval\. - - -\fIkey\fR is an array of values (though a single value is treated as a -one-element array), to form a heirarchy\. Using the first element of -the key as the plugin name (e\.g\. \fB[ "summary" ]\fR) is recommended\. -A key can either have children or a value, never both: parents are -created and removed automatically\. - - -\fImode\fR is one of "must-create" (default, fails it it already exists), -"must-replace" (fails it it doesn't already exist), -"create-or-replace" (never fails), "must-append" (must already exist, -append this to what's already there) or "create-or-append" (append if -anything is there, otherwise create)\. - - -\fIgeneration\fR, if specified, means that the update will fail if the -previously-existing data is not exactly that generation\. This allows -for simple atomicity\. This is only legal with \fImode\fR "must-replace" -or "must-append"\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBkey\fR (array of strings): -.RS -.IP \[bu] -Part of the key added to the datastore - -.RE - -.IP \[bu] -\fBgeneration\fR (u64, optional): The number of times this has been updated -.IP \[bu] -\fBhex\fR (hex, optional): The hex data which has been added to the datastore -.IP \[bu] -\fBstring\fR (string, optional): The data as a string, if it's valid utf-8 - -.RE - -The following error codes may occur: - -.RS -.IP \[bu] -1202: The key already exists (and mode said it must not) -.IP \[bu] -1203: The key does not exist (and mode said it must) -.IP \[bu] -1204: The generation was wrong (and generation was specified) -.IP \[bu] -1205: The key has children already\. -.IP \[bu] -1206: One of the parents already exists with a value\. -.IP \[bu] --32602: invalid parameters - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listdatastore\fR(7), \fBlightning-deldatastore\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f7c58a75435979f3bc6a3f0019298bebf33c1c199a6c98655778705fc7e86e0e diff --git a/doc/lightning-decode.7 b/doc/lightning-decode.7 deleted file mode 100644 index 2c281864a..000000000 --- a/doc/lightning-decode.7 +++ /dev/null @@ -1,414 +0,0 @@ -.TH "LIGHTNING-DECODE" "7" "" "" "lightning-decode" -.SH NAME -lightning-decode - Command for decoding an invoice string (low-level) -.SH SYNOPSIS - -\fBdecode\fR \fIstring\fR - -.SH DESCRIPTION - -The \fBdecode\fR RPC command checks and parses a \fIbolt11\fR or \fIbolt12\fR -string (optionally prefixed by \fBlightning:\fR or \fBLIGHTNING:\fR) as -specified by the BOLT 11 and BOLT 12 specifications\. It may decode -other formats in future\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtype\fR (string): what kind of object it decoded to (one of "bolt12 offer", "bolt12 invoice", "bolt12 invoice_request", "bolt11 invoice") -.IP \[bu] -\fBvalid\fR (boolean): if this is false, you \fIMUST\fR not use the result except for diagnostics! - -.RE - -If \fBtype\fR is "bolt12 offer", and \fBvalid\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBoffer_id\fR (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) -.IP \[bu] -\fBnode_id\fR (pubkey32): x-only public key of the offering node -.IP \[bu] -\fBdescription\fR (string): the description of the purpose of the offer -.IP \[bu] -\fBsignature\fR (bip340sig, optional): BIP-340 signature of the \fInode_id\fR on this offer -.IP \[bu] -\fBchains\fR (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only): -.RS -.IP \[bu] -the genesis blockhash (always 64 characters) - -.RE - -.IP \[bu] -\fBcurrency\fR (string, optional): ISO 4217 code of the currency (missing implies Bitcoin) (always 3 characters) -.IP \[bu] -\fBminor_unit\fR (u32, optional): the number of decimal places to apply to amount (if currency known) -.IP \[bu] -\fBamount\fR (u64, optional): the amount in the \fIcurrency\fR adjusted by \fIminor_unit\fR, if any -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount in bitcoin (if specified, and no \fIcurrency\fR) -.IP \[bu] -\fBsend_invoice\fR (boolean, optional): present if this is a send_invoice offer (always \fItrue\fR) -.IP \[bu] -\fBrefund_for\fR (hex, optional): the \fIpayment_preimage\fR of invoice this is a refund for (always 64 characters) -.IP \[bu] -\fBvendor\fR (string, optional): the name of the vendor for this offer -.IP \[bu] -\fBfeatures\fR (hex, optional): the array of feature bits for this offer -.IP \[bu] -\fBabsolute_expiry\fR (u64, optional): UNIX timestamp of when this offer expires -.IP \[bu] -\fBpaths\fR (array of objects, optional): Paths to the destination: -.RS -.IP \[bu] -\fBblinding\fR (pubkey): blinding factor for this path -.IP \[bu] -\fBpath\fR (array of objects): an individual path: -.RS -.IP \[bu] -\fBnode_id\fR (pubkey): node_id of the hop -.IP \[bu] -\fBenctlv\fR (hex): encrypted TLV entry for this hop - -.RE - - -.RE - -.IP \[bu] -\fBquantity_min\fR (u64, optional): the minimum quantity -.IP \[bu] -\fBquantity_max\fR (u64, optional): the maximum quantity -.IP \[bu] -\fBrecurrence\fR (object, optional): how often to this offer should be used: -.RS -.IP \[bu] -\fBtime_unit\fR (u32): the BOLT12 time unit -.IP \[bu] -\fBperiod\fR (u32): how many \fItime_unit\fR per payment period -.IP \[bu] -\fBtime_unit_name\fR (string, optional): the name of \fItime_unit\fR (if valid) -.IP \[bu] -\fBbasetime\fR (u64, optional): period starts at this UNIX timestamp -.IP \[bu] -\fBstart_any_period\fR (u64, optional): you can start at any period (only if \fBbasetime\fR present) -.IP \[bu] -\fBlimit\fR (u32, optional): maximum period number for recurrence -.IP \[bu] -\fBpaywindow\fR (object, optional): when within a period will payment be accepted (default is prior and during the period): -.RS -.IP \[bu] -\fBseconds_before\fR (u32): seconds prior to period start -.IP \[bu] -\fBseconds_after\fR (u32): seconds after to period start -.IP \[bu] -\fBproportional_amount\fR (boolean, optional): amount should be scaled if payed after period start (always \fItrue\fR) - -.RE - - -.RE - -.IP \[bu] -the following warnings are possible: -.RS -.IP \[bu] -\fBwarning_offer_unknown_currency\fR: The currency code is unknown (so no \fBminor_unit\fR) - -.RE - - -.RE - -If \fBtype\fR is "bolt12 offer", and \fBvalid\fR is \fIfalse\fR: - -.RS -.IP \[bu] -the following warnings are possible: -.RS -.IP \[bu] -\fBwarning_offer_missing_description\fR: No \fBdescription\fR - -.RE - - -.RE - -If \fBtype\fR is "bolt12 invoice", and \fBvalid\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBnode_id\fR (pubkey32): x-only public key of the offering node -.IP \[bu] -\fBsignature\fR (bip340sig): BIP-340 signature of the \fInode_id\fR on this offer -.IP \[bu] -\fBamount_msat\fR (msat): the amount in bitcoin -.IP \[bu] -\fBdescription\fR (string): the description of the purpose of the offer -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp of invoice creation -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR (always 64 characters) -.IP \[bu] -\fBrelative_expiry\fR (u32): the number of seconds after \fIcreated_at\fR when this expires -.IP \[bu] -\fBmin_final_cltv_expiry\fR (u32): the number of blocks required by destination -.IP \[bu] -\fBoffer_id\fR (hex, optional): the id of this offer (merkle hash of non-signature fields) (always 64 characters) -.IP \[bu] -\fBchains\fR (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only): -.RS -.IP \[bu] -the genesis blockhash (always 64 characters) - -.RE - -.IP \[bu] -\fBsend_invoice\fR (boolean, optional): present if this offer was a send_invoice offer (always \fItrue\fR) -.IP \[bu] -\fBrefund_for\fR (hex, optional): the \fIpayment_preimage\fR of invoice this is a refund for (always 64 characters) -.IP \[bu] -\fBvendor\fR (string, optional): the name of the vendor for this offer -.IP \[bu] -\fBfeatures\fR (hex, optional): the array of feature bits for this offer -.IP \[bu] -\fBpaths\fR (array of objects, optional): Paths to the destination: -.RS -.IP \[bu] -\fBblinding\fR (pubkey): blinding factor for this path -.IP \[bu] -\fBpath\fR (array of objects): an individual path: -.RS -.IP \[bu] -\fBnode_id\fR (pubkey): node_id of the hop -.IP \[bu] -\fBenctlv\fR (hex): encrypted TLV entry for this hop - -.RE - - -.RE - -.IP \[bu] -\fBquantity\fR (u64, optional): the quantity ordered -.IP \[bu] -\fBrecurrence_counter\fR (u32, optional): the 0-based counter for a recurring payment -.IP \[bu] -\fBrecurrence_start\fR (u32, optional): the optional start period for a recurring payment -.IP \[bu] -\fBrecurrence_basetime\fR (u32, optional): the UNIX timestamp of the first recurrence period start -.IP \[bu] -\fBpayer_key\fR (pubkey32, optional): the transient key which identifies the payer -.IP \[bu] -\fBpayer_info\fR (hex, optional): the payer-provided blob to derive payer_key -.IP \[bu] -\fBfallbacks\fR (array of objects, optional): onchain addresses: -.RS -.IP \[bu] -\fBversion\fR (u8): Segwit address version -.IP \[bu] -\fBhex\fR (hex): Raw encoded segwit address -.IP \[bu] -\fBaddress\fR (string, optional): bech32 segwit address - -.RE - -.IP \[bu] -\fBrefund_signature\fR (bip340sig, optional): the payer key signature to get a refund - -.RE - -If \fBtype\fR is "bolt12 invoice", and \fBvalid\fR is \fIfalse\fR: - -.RS -.IP \[bu] -\fBfallbacks\fR (array of objects, optional): -.RS -.IP \[bu] -the following warnings are possible: -.RS -.IP \[bu] -\fBwarning_invoice_fallbacks_version_invalid\fR: \fBversion\fR is > 16 - -.RE - - -.RE - -.IP \[bu] -the following warnings are possible: -.RS -.IP \[bu] -\fBwarning_invoice_missing_amount\fR: *\fIamount_msat\fR missing -.IP \[bu] -\fBwarning_invoice_missing_description\fR: No \fBdescription\fR -.IP \[bu] -\fBwarning_invoice_missing_blinded_payinfo\fR: Has \fBpaths\fR without payinfo -.IP \[bu] -\fBwarning_invoice_invalid_blinded_payinfo\fR: Does not have exactly one payinfo for each of \fBpaths\fR -.IP \[bu] -\fBwarning_invoice_missing_recurrence_basetime\fR: Has \fBrecurrence_counter\fR without \fBrecurrence_basetime\fR -.IP \[bu] -\fBwarning_invoice_missing_created_at\fR: Missing \fBcreated_at\fR -.IP \[bu] -\fBwarning_invoice_missing_payment_hash\fR: Missing \fBpayment_hash\fR -.IP \[bu] -\fBwarning_invoice_refund_signature_missing_payer_key\fR: Missing \fBpayer_key\fR for refund_signature -.IP \[bu] -\fBwarning_invoice_refund_signature_invalid\fR: \fBrefund_signature\fR incorrect -.IP \[bu] -\fBwarning_invoice_refund_missing_signature\fR: No \fBrefund_signature\fR - -.RE - - -.RE - -If \fBtype\fR is "bolt12 invoice_request", and \fBvalid\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBoffer_id\fR (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) -.IP \[bu] -\fBpayer_key\fR (pubkey32): the transient key which identifies the payer -.IP \[bu] -\fBchains\fR (array of hexs, optional): which blockchains this offer is for (missing implies bitcoin mainnet only): -.RS -.IP \[bu] -the genesis blockhash (always 64 characters) - -.RE - -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount in bitcoin -.IP \[bu] -\fBfeatures\fR (hex, optional): the array of feature bits for this offer -.IP \[bu] -\fBquantity\fR (u64, optional): the quantity ordered -.IP \[bu] -\fBrecurrence_counter\fR (u32, optional): the 0-based counter for a recurring payment -.IP \[bu] -\fBrecurrence_start\fR (u32, optional): the optional start period for a recurring payment -.IP \[bu] -\fBpayer_info\fR (hex, optional): the payer-provided blob to derive payer_key -.IP \[bu] -\fBrecurrence_signature\fR (bip340sig, optional): the payer key signature - -.RE - -If \fBtype\fR is "bolt12 invoice_request", and \fBvalid\fR is \fIfalse\fR: - -.RS -.IP \[bu] -the following warnings are possible: -.RS -.IP \[bu] -\fBwarning_invoice_request_missing_offer_id\fR: No \fBoffer_id\fR -.IP \[bu] -\fBwarning_invoice_request_missing_payer_key\fR: No \fBpayer_key\fR -.IP \[bu] -\fBwarning_invoice_request_missing_recurrence_signature\fR: No \fBrecurrence_signature\fR -.IP \[bu] -\fBwarning_invoice_request_invalid_recurrence_signature\fR: \fBrecurrence_signature\fR incorrect - -.RE - - -.RE - -If \fBtype\fR is "bolt11 invoice", and \fBvalid\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBcurrency\fR (string): the BIP173 name for the currency -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX-style timestamp of the invoice -.IP \[bu] -\fBexpiry\fR (u64): the number of seconds this is valid after \fItimestamp\fR -.IP \[bu] -\fBpayee\fR (pubkey): the public key of the recipient -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR (always 64 characters) -.IP \[bu] -\fBsignature\fR (signature): signature of the \fIpayee\fR on this invoice -.IP \[bu] -\fBmin_final_cltv_expiry\fR (u32): the minimum CLTV delay for the final node -.IP \[bu] -\fBamount_msat\fR (msat, optional): Amount the invoice asked for -.IP \[bu] -\fBdescription\fR (string, optional): the description of the purpose of the purchase -.IP \[bu] -\fBdescription_hash\fR (hex, optional): the hash of the description, in place of \fIdescription\fR (always 64 characters) -.IP \[bu] -\fBpayment_secret\fR (hex, optional): the secret to hand to the payee node (always 64 characters) -.IP \[bu] -\fBfeatures\fR (hex, optional): the features bitmap for this invoice -.IP \[bu] -\fBfallbacks\fR (array of objects, optional): onchain addresses: -.RS -.IP \[bu] -\fBtype\fR (string): the address type (if known) (one of "P2PKH", "P2SH", "P2WPKH", "P2WSH") -.IP \[bu] -\fBhex\fR (hex): Raw encoded address -.IP \[bu] -\fBaddr\fR (string, optional): the address in appropriate format for \fItype\fR - -.RE - -.IP \[bu] -\fBroutes\fR (array of arrays, optional): Route hints to the \fIpayee\fR: -.RS -.IP \[bu] -hops in the route: -.RS -.IP \[bu] -\fBpubkey\fR (pubkey): the public key of the node -.IP \[bu] -\fBshort_channel_id\fR (short_channel_id): a channel to the next peer -.IP \[bu] -\fBfee_base_msat\fR (u32): the base fee for payments -.IP \[bu] -\fBfee_proportional_millionths\fR (u32): the parts-per-million fee for payments -.IP \[bu] -\fBcltv_expiry_delta\fR (u32): the CLTV delta across this hop - -.RE - - -.RE - -.IP \[bu] -\fBextra\fR (array of objects, optional): Any extra fields we didn't know how to parse: -.RS -.IP \[bu] -\fBtag\fR (string): The bech32 letter which identifies this field (always 1 characters) -.IP \[bu] -\fBdata\fR (string): The bech32 data for this field - -.RE - - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-pay\fR(7), \fBlightning-offer\fR(7), \fBlightning-offerout\fR(7), \fBlightning-fetchinvoice\fR(7), \fBlightning-sendinvoice\fR(7) - - -\fBBOLT #11\fR (\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md\fR)\. - - -\fBBOLT #12\fR (\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/12-offer-encoding.md\fR)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f07ab7fbb0d031aa5b56560954cf071c481acf0880bf60ec15ff733f8d9e3c01 diff --git a/doc/lightning-decodepay.7 b/doc/lightning-decodepay.7 deleted file mode 100644 index d433ee9c2..000000000 --- a/doc/lightning-decodepay.7 +++ /dev/null @@ -1,110 +0,0 @@ -.TH "LIGHTNING-DECODEPAY" "7" "" "" "lightning-decodepay" -.SH NAME -lightning-decodepay - Command for decoding a bolt11 string (low-level) -.SH SYNOPSIS - -\fBdecodepay\fR \fIbolt11\fR [\fIdescription\fR] - -.SH DESCRIPTION - -The \fBdecodepay\fR RPC command checks and parses a \fIbolt11\fR string as -specified by the BOLT 11 specification\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBcurrency\fR (string): the BIP173 name for the currency -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX-style timestamp of the invoice -.IP \[bu] -\fBexpiry\fR (u64): the number of seconds this is valid after \fItimestamp\fR -.IP \[bu] -\fBpayee\fR (pubkey): the public key of the recipient -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR (always 64 characters) -.IP \[bu] -\fBsignature\fR (signature): signature of the \fIpayee\fR on this invoice -.IP \[bu] -\fBmin_final_cltv_expiry\fR (u32): the minimum CLTV delay for the final node -.IP \[bu] -\fBamount_msat\fR (msat, optional): Amount the invoice asked for -.IP \[bu] -\fBdescription\fR (string, optional): the description of the purpose of the purchase -.IP \[bu] -\fBdescription_hash\fR (hex, optional): the hash of the description, in place of \fIdescription\fR (always 64 characters) -.IP \[bu] -\fBpayment_secret\fR (hex, optional): the secret to hand to the payee node (always 64 characters) -.IP \[bu] -\fBfeatures\fR (hex, optional): the features bitmap for this invoice -.IP \[bu] -\fBfallbacks\fR (array of objects, optional): onchain addresses: -.RS -.IP \[bu] -\fBtype\fR (string): the address type (if known) (one of "P2PKH", "P2SH", "P2WPKH", "P2WSH") -.IP \[bu] -\fBhex\fR (hex): Raw encoded address -.IP \[bu] -\fBaddr\fR (string, optional): the address in appropriate format for \fItype\fR - -.RE - -.IP \[bu] -\fBroutes\fR (array of arrays, optional): Route hints to the \fIpayee\fR: -.RS -.IP \[bu] -hops in the route: -.RS -.IP \[bu] -\fBpubkey\fR (pubkey): the public key of the node -.IP \[bu] -\fBshort_channel_id\fR (short_channel_id): a channel to the next peer -.IP \[bu] -\fBfee_base_msat\fR (u32): the base fee for payments -.IP \[bu] -\fBfee_proportional_millionths\fR (u32): the parts-per-million fee for payments -.IP \[bu] -\fBcltv_expiry_delta\fR (u32): the CLTV delta across this hop - -.RE - - -.RE - -.IP \[bu] -\fBextra\fR (array of objects, optional): Any extra fields we didn't know how to parse: -.RS -.IP \[bu] -\fBtag\fR (string): The bech32 letter which identifies this field (always 1 characters) -.IP \[bu] -\fBdata\fR (string): The bech32 data for this field - -.RE - - -.RE - -Technically, the \fIdescription\fR field is optional if a -\fIdescription_hash\fR field is given, but in this case \fBdecodepay\fR will -only succeed if the optional \fIdescription\fR field is passed and matches -the \fIdescription_hash\fR\. In practice, these are currently unused\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-pay\fR(7), \fBlightning-getroute\fR(7), \fBlightning-sendpay\fR(7)\. - - -\fBBOLT -#11\fR (\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/11-payment-encoding.md\fR)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:2bd0b4c9b0e358ae5dbfde5d6a460fc6d24c397614c120a29c43a5cce4ebf721 diff --git a/doc/lightning-deldatastore.7 b/doc/lightning-deldatastore.7 deleted file mode 100644 index aa60e3c9a..000000000 --- a/doc/lightning-deldatastore.7 +++ /dev/null @@ -1,62 +0,0 @@ -.TH "LIGHTNING-DELDATASTORE" "7" "" "" "lightning-deldatastore" -.SH NAME -lightning-deldatastore - Command for removing (plugin) data -.SH SYNOPSIS - -\fBdeldatastore\fR \fIkey\fR [\fIgeneration\fR] - -.SH DESCRIPTION - -The \fBdeldatastore\fR RPC command allows plugins to delete data it has -stored in the c-lightning database\. - - -The command fails if the \fIkey\fR isn't present, or if \fIgeneration\fR -is specified and the generation of the data does not exactly match\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBkey\fR (array of strings): -.RS -.IP \[bu] -Part of the key added to the datastore - -.RE - -.IP \[bu] -\fBgeneration\fR (u64, optional): The number of times this has been updated -.IP \[bu] -\fBhex\fR (hex, optional): The hex data which has removed from the datastore -.IP \[bu] -\fBstring\fR (string, optional): The data as a string, if it's valid utf-8 - -.RE - -The following error codes may occur: - -.RS -.IP \[bu] -1200: the key does not exist -.IP \[bu] -1201: the key does exist, but the generation is wrong -.IP \[bu] --32602: invalid parameters - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listdatastore\fR(7), \fBlightning-datastore\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:4329b32593f9d6d70bcd3de3fffa047b09d32fb82e59b923834eb2a11b5e8670 diff --git a/doc/lightning-delexpiredinvoice.7 b/doc/lightning-delexpiredinvoice.7 deleted file mode 100644 index 433d22f4f..000000000 --- a/doc/lightning-delexpiredinvoice.7 +++ /dev/null @@ -1,33 +0,0 @@ -.TH "LIGHTNING-DELEXPIREDINVOICE" "7" "" "" "lightning-delexpiredinvoice" -.SH NAME -lightning-delexpiredinvoice - Command for removing expired invoices -.SH SYNOPSIS - -\fBdelexpiredinvoice\fR [\fImaxexpirytime\fR] - -.SH DESCRIPTION - -The \fBdelexpiredinvoice\fR RPC command removes all invoices that have -expired on or before the given \fImaxexpirytime\fR\. - - -If \fImaxexpirytime\fR is not specified then all expired invoices are -deleted\. - -.SH RETURN VALUE - -On success, an empty object is returned\. - -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-delinvoice\fR(7), \fBlightning-autocleaninvoice\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:1692e45b90818d4d55ad816c13c47abf4aeaee53d8b5de17fe43b8be27fa8e61 diff --git a/doc/lightning-delinvoice.7 b/doc/lightning-delinvoice.7 deleted file mode 100644 index e16cfe1d9..000000000 --- a/doc/lightning-delinvoice.7 +++ /dev/null @@ -1,98 +0,0 @@ -.TH "LIGHTNING-DELINVOICE" "7" "" "" "lightning-delinvoice" -.SH NAME -lightning-delinvoice - Command for removing an invoice -.SH SYNOPSIS - -\fBdelinvoice\fR \fIlabel\fR \fIstatus\fR - -.SH DESCRIPTION - -The \fBdelinvoice\fR RPC command removes an invoice with \fIstatus\fR as given -in \fBlistinvoices\fR\. - - -The caller should be particularly aware of the error case caused by the -\fIstatus\fR changing just before this command is invoked! - -.SH RETURN VALUE - -Note: The return is the same as an object from \fBlightning-listinvoice\fR(7)\. - - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBlabel\fR (string): Unique label given at creation time -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): State of invoice (one of "paid", "expired", "unpaid") -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp when invoice expires (or expired) -.IP \[bu] -\fBbolt11\fR (string, optional): BOLT11 string -.IP \[bu] -\fBbolt12\fR (string, optional): BOLT12 string -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount required to pay this invoice -.IP \[bu] -\fBdescription\fR (string, optional): description used in the invoice - -.RE - -If \fBbolt12\fR is present: - -.RS -.IP \[bu] -\fBlocal_offer_id\fR (hex, optional): offer for which this invoice was created -.IP \[bu] -\fBpayer_note\fR (string, optional): the optional \fIpayer_note\fR from invoice_request which created this invoice - -.RE - -If \fBstatus\fR is "paid": - -.RS -.IP \[bu] -\fBpay_index\fR (u64): unique index for this invoice payment -.IP \[bu] -\fBamount_received_msat\fR (msat): how much was actually received -.IP \[bu] -\fBpaid_at\fR (u64): UNIX timestamp of when payment was received -.IP \[bu] -\fBpayment_preimage\fR (hex): SHA256 of this is the \fIpayment_hash\fR offered in the invoice (always 64 characters) - -.RE -.SH ERRORS - -The following errors may be reported: - -.RS -.IP \[bu] --1: Database error\. -.IP \[bu] -905: An invoice with that label does not exist\. -.IP \[bu] -906: The invoice \fIstatus\fR does not match the parameter\. -An error object will be returned as error \fIdata\fR, containing -\fIcurrent_status\fR and \fIexpected_status\fR fields\. -This is most likely due to the \fIstatus\fR of the invoice -changing just before this command is invoked\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listinvoice\fR(7), \fBlightning-waitinvoice\fR(7), -\fBlightning-invoice\fR(7), \fBlightning-delexpiredinvoice\fR(7), -\fBlightning-autocleaninvoice\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:5b2e2104fde0b6ff907a46f1993e484089825568edd06b5b87d7bdddc331132e diff --git a/doc/lightning-delpay.7 b/doc/lightning-delpay.7 deleted file mode 100644 index 4b3feea34..000000000 --- a/doc/lightning-delpay.7 +++ /dev/null @@ -1,123 +0,0 @@ -.TH "LIGHTNING-DELPAY" "7" "" "" "lightning-delpay" -.SH NAME -lightning-delpay - Command for removing a completed or failed payment -.SH SYNOPSIS - -\fBdelpay\fR \fIpayment_hash\fR \fIstatus\fR - -.SH DESCRIPTION - -The \fBdelpay\fR RPC command deletes a payment with the given \fBpayment_hash\fR if its status is either \fBcomplete\fR or \fBfailed\fR\. Deleting a \fBpending\fR payment is an error\. - -.RS -.IP \[bu] -\fIpayment_hash\fR: The unique identifier of a payment\. -.IP \[bu] -\fIstatus\fR: Expected status of the payment\. -Only deletes if the payment status matches\. - -.RE -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "delpay", - "params": { - "payment_hash": "4fa2f1b001067ec06d7f95b8695b8acd9ef04c1b4d1110e3b94e1fa0687bb1e0", - "status": "complete" - } -} -.RE - -.fi -.SH RETURN VALUE - -The returned format is the same as \fBlightning-listsendpays\fR(7)\. If the -payment is a multi-part payment (MPP) the command return a list of -payments will be returned -- one payment object for each partid\. - - -On success, an object containing \fBpayments\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBid\fR (u64): unique ID for this payment attempt -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): status of the payment (one of "pending", "failed", "complete") -.IP \[bu] -\fBamount_sent_msat\fR (msat): the amount we actually sent, including fees -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBpartid\fR (u64, optional): unique ID within this (multi-part) payment -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment if known -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount the destination received, if known -.IP \[bu] -\fBpayment_preimage\fR (hex, optional): proof of payment (always 64 characters) -.IP \[bu] -\fBlabel\fR (string, optional): the label, if given to sendpay -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (if pay supplied one) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string (if supplied for pay: \fBexperimental-offers\fR only)\. -.IP \[bu] -\fBerroronion\fR (hex, optional): the error onion returned on failure, if any\. - -.RE - -On failure, an error is returned\. If the lightning process fails before responding, the -caller should use \fBlightning-listsentpays\fR(7) or \fBlightning-listpays\fR(7) to query whether this payment was deleted or not\. - - -The following error codes may occur: - -.RS -.IP \[bu] --32602: Parameter missed or malformed; -.IP \[bu] -211: Payment status mismatch\. Check the correct status via \fBpaystatus\fR; -.IP \[bu] -208: Payment with payment_hash not found\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "payments": [ - { - "id": 2, - "payment_hash": "8dfd6538eeb33811c9114a75f792a143728d7f05643f38c3d574d3097e8910c0", - "destination": "0219f8900ee78a89f050c24d8b69492954f9fdbabed753710845eb75d3a75a5880", - "msatoshi": 1000, - "amount_msat": "1000msat", - "msatoshi_sent": 1000, - "amount_sent_msat": "1000msat", - "created_at": 1596224858, - "status": "complete", - "payment_preimage": "35bd4e2b481a1a84a22215b5372672cf81460a671816960ddb206464359e1822", - "bolt11": "lntb10n1p0jga20pp53h7k2w8wkvuprjg3ff6l0y4pgdeg6lc9vsln3s74wnfsjl5fzrqqdqdw3jhxazldahx2xqyjw5qcqp2sp5wut5jnhr6n7jd5747ky2g5flmw7hgx9yjnqzu60ps2jf6f7tc0us9qy9qsqu2a0k37nckl62005p69xavlkydkvhnypk4dphffy4x09zltwh9437ad7xkl83tefdarzhu5t30ju5s56wlrg97qkx404pq3srfc425cq3ke9af" - } - ] -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listpays\fR(7), \fBlightning-listsendpays\fR(7), \fBlightning-paystatus\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:0e7079fcdb644918b1dbea73392b5d367a8cb2ee404a9fb4083b5d86053ba469 diff --git a/doc/lightning-disableoffer.7 b/doc/lightning-disableoffer.7 deleted file mode 100644 index d224f59c9..000000000 --- a/doc/lightning-disableoffer.7 +++ /dev/null @@ -1,83 +0,0 @@ -.TH "LIGHTNING-DISABLEOFFER" "7" "" "" "lightning-disableoffer" -.SH NAME -lightning-disableoffer - Command for removing an offer -.SH SYNOPSIS - -\fB(WARNING: experimental-offers only)\fR - - -\fBdisableoffer\fR \fIoffer_id\fR - -.SH DESCRIPTION - -The \fBdisableoffer\fR RPC command disables an offer, so that no further -invoices will be given out (if made with \fBlightning-offer\fR(7)) or -invoices accepted (if made with \fBlightning-offerout\fR(7))\. - - -We currently don't support deletion of offers, so offers are not -forgotten entirely (there may be invoices which refer to this offer)\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "disableoffer", - "params": { - "offer_id": "713a16ccd4eb10438bdcfbc2c8276be301020dd9d489c530773ba64f3b33307d ", - } -} -.RE - -.fi -.SH RETURN VALUE - -Note: the returned object is the same format as \fBlistoffers\fR\. - - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBoffer_id\fR (hex): the merkle hash of the offer (always 64 characters) -.IP \[bu] -\fBactive\fR (boolean): Whether the offer can produce invoices/payments (always \fIfalse\fR) -.IP \[bu] -\fBsingle_use\fR (boolean): Whether the offer is disabled after first successful use -.IP \[bu] -\fBbolt12\fR (string): The bolt12 string representing this offer -.IP \[bu] -\fBbolt12_unsigned\fR (string): The bolt12 string representing this offer, without signature -.IP \[bu] -\fBused\fR (boolean): Whether the offer has had an invoice paid / payment made -.IP \[bu] -\fBlabel\fR (string, optional): The label provided when offer was created - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "offer_id": "053a5c566fbea2681a5ff9c05a913da23e45b95d09ef5bd25d7d408f23da7084", - "active": false, - "single_use": false, - "bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqvqcdgq2z9pk7enxv4jjqen0wgs8yatnw3ujz83qkc6rvp4j28rt3dtrn32zkvdy7efhnlrpr5rp5geqxs783wtlj550qs8czzku4nk3pqp6m593qxgunzuqcwkmgqkmp6ty0wyvjcqdguv3pnpukedwn6cr87m89t74h3auyaeg89xkvgzpac70z3m9rn5xzu28c", - "used": false -} -.RE - -.fi -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-offer\fR(7), \fBlightning-offerout\fR(7), \fBlightning-listoffers\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:4566fb3a77342f32ca7ce150c47fa169749dd0cd8eb8e1a512c3004f15084f2a diff --git a/doc/lightning-disconnect.7 b/doc/lightning-disconnect.7 deleted file mode 100644 index 3783a75eb..000000000 --- a/doc/lightning-disconnect.7 +++ /dev/null @@ -1,66 +0,0 @@ -.TH "LIGHTNING-DISCONNECT" "7" "" "" "lightning-disconnect" -.SH NAME -lightning-disconnect - Command for disconnecting from another lightning node -.SH SYNOPSIS - -\fBdisconnect\fR \fIid\fR [\fIforce\fR] - -.SH DESCRIPTION - -The disconnect RPC command closes an existing connection to a peer, -identified by \fIid\fR, in the Lightning Network, as long as it doesn’t have -an active channel\. If \fIforce\fR is set then it will disconnect even with -an active channel\. - - -The \fIid\fR can be discovered in the output of the listpeers command, which -returns a set of peers: - -.nf -.RS -{ - "peers": [ - { - "id": "0563aea81...", - "connected": true, - ... - } - ] -} - - -.RE - -.fi - -Passing the \fIid\fR attribute of a peer to \fIdisconnect\fR will terminate the -connection\. - -.SH RETURN VALUE - -On success, an empty object is returned\. - - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. - -.RE -.SH AUTHOR - -Michael Hawkins \fI\. - -.SH SEE ALSO - -\fBlightning-connect\fR(1), \fBlightning-listpeers\fR(1) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f967b94a7ef6c5f3cd9b135338bcfd8711d7efe05791fa12f5dde43fa547878c diff --git a/doc/lightning-feerates.7 b/doc/lightning-feerates.7 deleted file mode 100644 index e2709cc82..000000000 --- a/doc/lightning-feerates.7 +++ /dev/null @@ -1,172 +0,0 @@ -.TH "LIGHTNING-FEERATES" "7" "" "" "lightning-feerates" -.SH NAME -lightning-feerates - Command for querying recommended onchain feerates -.SH SYNOPSIS - -\fBfeerates\fR \fIstyle\fR - -.SH DESCRIPTION - -The \fBfeerates\fR command returns the feerates that C-lightning will use\. -The feerates will be based on the recommended feerates from the backend\. -The backend may fail to provide estimates, but if it was able to provide -estimates in the past, C-lightning will continue to use those for a while\. -C-lightning will also smoothen feerate estimations from the backend\. - - -\fIstyle\fR is either of the two strings: - -.RS -.IP \[bu] -\fIperkw\fR - provide feerate in units of satoshis per 1000 weight\. -.IP \[bu] -\fIperkb\fR - provide feerate in units of satoshis per 1000 virtual bytes\. - -.RE - -Bitcoin transactions have non-witness and witness bytes: - -.RS -.IP \[bu] -Non-witness bytes count as 4 weight, 1 virtual byte\. -All bytes other than SegWit witness count as non-witness bytes\. -.IP \[bu] -Witness bytes count as 1 weight, 0\.25 virtual bytes\. - -.RE - -Thus, all \fIperkb\fR feerates will be exactly 4 times \fIperkw\fR feerates\. - - -To compute the fee for a transaction, multiply its weight or virtual bytes -by the appropriate \fIperkw\fR or \fIperkw\fR feerate -returned by this command, -then divide by 1000\. - - -There is currently no way to change these feerates from the RPC\. -If you need custom control over onchain feerates, -you will need to provide your own plugin -that replaces the \fBbcli\fR plugin backend\. -For commands like \fBlightning-withdraw\fR(7) or \fBlightning-fundchannel\fR(7) you -can provide a preferred feerate directly as a parameter, -which will override the recommended feerates returned by \fBfeerates\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBperkb\fR (object, optional): If \fIstyle\fR parameter was perkb: -.RS -.IP \[bu] -\fBmin_acceptable\fR (u32): The smallest feerate that you can use, usually the minimum relayed feerate of the backend -.IP \[bu] -\fBmax_acceptable\fR (u32): The largest feerate we will accept from remote negotiations\. If a peer attempts to set the feerate higher than this we will unilaterally close the channel (or simply forget it if it's not open yet)\. -.IP \[bu] -\fBopening\fR (u32, optional): Default feerate for \fBlightning-fundchannel\fR(7) and \fBlightning-withdraw\fR(7) -.IP \[bu] -\fBmutual_close\fR (u32, optional): Feerate to aim for in cooperative shutdown\. Note that since mutual close is a \fBnegotiation\fR, the actual feerate used in mutual close will be somewhere between this and the corresponding mutual close feerate of the peer\. -.IP \[bu] -\fBunilateral_close\fR (u32, optional): Feerate for commitment_transaction in a live channel which we originally funded -.IP \[bu] -\fBdelayed_to_us\fR (u32, optional): Feerate for returning unilateral close funds to our wallet -.IP \[bu] -\fBhtlc_resolution\fR (u32, optional): Feerate for returning unilateral close HTLC outputs to our wallet -.IP \[bu] -\fBpenalty\fR (u32, optional): Feerate to start at when penalizing a cheat attempt - -.RE - -.IP \[bu] -\fBperkw\fR (object, optional): If \fIstyle\fR parameter was perkw: -.RS -.IP \[bu] -\fBmin_acceptable\fR (u32): The smallest feerate that you can use, usually the minimum relayed feerate of the backend -.IP \[bu] -\fBmax_acceptable\fR (u32): The largest feerate we will accept from remote negotiations\. If a peer attempts to set the feerate higher than this we will unilaterally close the channel (or simply forget it if it's not open yet)\. -.IP \[bu] -\fBopening\fR (u32, optional): Default feerate for \fBlightning-fundchannel\fR(7) and \fBlightning-withdraw\fR(7) -.IP \[bu] -\fBmutual_close\fR (u32, optional): Feerate to aim for in cooperative shutdown\. Note that since mutual close is a \fBnegotiation\fR, the actual feerate used in mutual close will be somewhere between this and the corresponding mutual close feerate of the peer\. -.IP \[bu] -\fBunilateral_close\fR (u32, optional): Feerate for commitment_transaction in a live channel which we originally funded -.IP \[bu] -\fBdelayed_to_us\fR (u32, optional): Feerate for returning unilateral close funds to our wallet -.IP \[bu] -\fBhtlc_resolution\fR (u32, optional): Feerate for returning unilateral close HTLC outputs to our wallet -.IP \[bu] -\fBpenalty\fR (u32, optional): Feerate to start at when penalizing a cheat attempt - -.RE - -.IP \[bu] -\fBonchain_fee_estimates\fR (object, optional): -.RS -.IP \[bu] -\fBopening_channel_satoshis\fR (u64): Estimated cost of typical channel open -.IP \[bu] -\fBmutual_close_satoshis\fR (u64): Estimated cost of typical channel close -.IP \[bu] -\fBunilateral_close_satoshis\fR (u64): Estimated cost of typical unilateral close (without HTLCs) -.IP \[bu] -\fBhtlc_timeout_satoshis\fR (u64): Estimated cost of typical HTLC timeout transaction -.IP \[bu] -\fBhtlc_success_satoshis\fR (u64): Estimated cost of typical HTLC fulfillment transaction - -.RE - - -.RE - -The following warnings may also be returned: - -.RS -.IP \[bu] -\fBwarning_missing_feerates\fR: Some fee estimates are missing - -.RE -.SH ERRORS - -The \fBfeerates\fR command will never error, -however some fields may be missing in the result -if feerate estimates for that kind of transaction are unavailable\. - -.SH NOTES - -Many other commands have a \fIfeerate\fR parameter, which can be the strings -\fIurgent\fR, \fInormal\fR, or \fIslow\fR\. -These are mapped to the \fBfeerates\fR outputs as: - -.RS -.IP \[bu] -\fIurgent\fR - equal to \fIunilateral_close\fR -.IP \[bu] -\fInormal\fR - equal to \fIopening\fR -.IP \[bu] -\fIslow\fR - equal to \fImin_acceptable\fR\. - -.RE -.SH TRIVIA - -In C-lightning we like to call the weight unit "sipa" -in honor of Pieter Wuille, -who uses the name "sipa" on IRC and elsewhere\. -Internally we call the \fIperkw\fR style as "feerate per kilosipa"\. - -.SH AUTHOR - -ZmnSCPxj \fI wrote the initial version of this -manpage\. - -.SH SEE ALSO - -\fBlightning-parsefeerate\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-withdraw\fR(7), -\fBlightning-txprepare\fR(7), \fBlightning-fundchannel_start\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:b60c81ed07764db66f4b8d4486dec8a4a6a83337aec8ab5871adbefce10356b2 diff --git a/doc/lightning-fetchinvoice.7 b/doc/lightning-fetchinvoice.7 deleted file mode 100644 index 108a7733b..000000000 --- a/doc/lightning-fetchinvoice.7 +++ /dev/null @@ -1,125 +0,0 @@ -.TH "LIGHTNING-FETCHINVOICE" "7" "" "" "lightning-fetchinvoice" -.SH NAME -lightning-fetchinvoice - Command for fetch an invoice for an offer -.SH SYNOPSIS - -\fB(WARNING: experimental-offers only)\fR - - -\fBfetchinvoice\fR \fIoffer\fR [\fImsatoshi\fR] [\fIquantity\fR] [\fIrecurrence_counter\fR] [\fIrecurrence_start\fR] [\fIrecurrence_label\fR] [\fItimeout\fR] [\fIpayer_note\fR] - -.SH DESCRIPTION - -The \fBfetchinvoice\fR RPC command contacts the issuer of an \fIoffer\fR to get -an actual invoice that can be paid\. It highlights any changes between the -offer and the returned invoice\. - - -If \fBfetchinvoice-noconnect\fR is not specified in the configuation, it -will connect to the destination in the (currently common!) case where it -cannot find a route which supports \fBoption_onion_messages\fR\. - - -The offer must not contain \fIsend_invoice\fR; see \fBlightning-sendinvoice\fR(7)\. - - -\fImsatoshi\fR is required if the \fIoffer\fR does not specify -an amount at all, otherwise it is not allowed\. - - -\fIquantity\fR is is required if the \fIoffer\fR specifies -\fIquantity_min\fR or \fIquantity_max\fR, otherwise it is not allowed\. - - -\fIrecurrence_counter\fR is required if the \fIoffer\fR -specifies \fIrecurrence\fR, otherwise it is not allowed\. -\fIrecurrence_counter\fR should first be set to 0, and incremented for -each successive invoice in a given series\. - - -\fIrecurrence_start\fR is required if the \fIoffer\fR -specifies \fIrecurrence_base\fR with \fIstart_any_period\fR set, otherwise it -is not allowed\. It indicates what period number to start at\. - - -\fIrecurrence_label\fR is required if \fIrecurrence_counter\fR is set, and -otherwise is not allowed\. It must be the same as prior fetchinvoice -calls for the same recurrence, as it is used to link them together\. - - -\fItimeout\fR is an optional timeout; if we don't get a reply before this -we fail (default, 60 seconds)\. - - -\fIpayer_note\fR is an optional payer note to include in the fetched invoice\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBinvoice\fR (string): The BOLT12 invoice we fetched -.IP \[bu] -\fBchanges\fR (object): Summary of changes from offer: -.RS -.IP \[bu] -\fBdescription_appended\fR (string, optional): extra characters appended to the \fIdescription\fR field\. -.IP \[bu] -\fBdescription\fR (string, optional): a completely replaced \fIdescription\fR field -.IP \[bu] -\fBvendor_removed\fR (string, optional): The \fIvendor\fR from the offer, which is missing in the invoice -.IP \[bu] -\fBvendor\fR (string, optional): a completely replaced \fIvendor\fR field -.IP \[bu] -\fBmsat\fR (msat, optional): the amount, if different from the offer amount multiplied by any \fIquantity\fR (or the offer had no amount, or was not in BTC)\. - -.RE - -.IP \[bu] -\fBnext_period\fR (object, optional): Only for recurring invoices if the next period is under the \fIrecurrence_limit\fR: -.RS -.IP \[bu] -\fBcounter\fR (u64): the index of the next period to fetchinvoice -.IP \[bu] -\fBstarttime\fR (u64): UNIX timestamp that the next period starts -.IP \[bu] -\fBendtime\fR (u64): UNIX timestamp that the next period ends -.IP \[bu] -\fBpaywindow_start\fR (u64): UNIX timestamp of the earliest time that the next invoice can be fetched -.IP \[bu] -\fBpaywindow_end\fR (u64): UNIX timestamp of the latest time that the next invoice can be fetched - -.RE - - -.RE - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -1002: Offer has expired\. -.IP \[bu] -1003: Cannot find a route to the node making the offer\. -.IP \[bu] -1004: The node making the offer returned an error message\. -.IP \[bu] -1005: We timed out trying to fetch an invoice\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-sendinvoice\fR(7), \fBlightning-pay\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:73bfed34c90b4689100c54e8521a5b23eca520acb0cbc0509a853d7f996920cc diff --git a/doc/lightning-fundchannel.7 b/doc/lightning-fundchannel.7 deleted file mode 100644 index 6640329b5..000000000 --- a/doc/lightning-fundchannel.7 +++ /dev/null @@ -1,142 +0,0 @@ -.TH "LIGHTNING-FUNDCHANNEL" "7" "" "" "lightning-fundchannel" -.SH NAME -lightning-fundchannel - Command for establishing a lightning channel -.SH SYNOPSIS - -\fBfundchannel\fR \fIid\fR \fIamount\fR [\fIfeerate\fR] [\fIannounce\fR] [\fIminconf\fR] -[\fIutxos\fR] [\fIpush_msat\fR] [\fIclose_to\fR] [\fIrequest_amt\fR] [\fIcompact_lease\fR] - -.SH DESCRIPTION - -The \fBfundchannel\fR RPC command opens a payment channel with a peer by -committing a funding transaction to the blockchain as defined in BOLT -#2\. -If not already connected, \fBfundchannel\fR will automatically attempt -to connect if C-lightning knows a way to contact the node (either from -normal gossip, or from a previous \fBconnect\fR call)\. -This auto-connection can fail if C-lightning does not know how to contact -the target node; see \fBlightning-connect\fR(7)\. -Once the -transaction is confirmed, normal channel operations may begin\. Readiness -is indicated by \fBlistpeers\fR reporting a \fIstate\fR of \fBCHANNELD_NORMAL\fR -for the channel\. - - -\fIid\fR is the peer id obtained from \fBconnect\fR\. - - -\fIamount\fR is the amount in satoshis taken from the internal wallet to -fund the channel\. The string \fIall\fR can be used to specify all available -funds (or 16777215 satoshi if more is available and large channels were not negotiated with the peer)\. Otherwise, it is in -satoshi precision; it can be a whole number, a whole number ending in -\fIsat\fR, a whole number ending in \fI000msat\fR, or a number with 1 to 8 -decimal places ending in \fIbtc\fR\. The value cannot be less than the dust -limit, currently set to 546, nor more than 16777215 satoshi (unless large -channels were negotiated with the peer)\. - - -\fIfeerate\fR is an optional feerate used for the opening transaction and as -initial feerate for commitment and HTLC transactions\. It can be one of -the strings \fIurgent\fR (aim for next block), \fInormal\fR (next 4 blocks or -so) or \fIslow\fR (next 100 blocks or so) to use lightningd’s internal -estimates: \fInormal\fR is the default\. - - -Otherwise, \fIfeerate\fR is a number, with an optional suffix: \fIperkw\fR means -the number is interpreted as satoshi-per-kilosipa (weight), and \fIperkb\fR -means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting -the suffix is equivalent to \fIperkb\fR\. - - -\fIannounce\fR is an optional flag that triggers whether to announce this -channel or not\. Defaults to \fBtrue\fR\. An unannounced channel is considered -private\. - - -\fIminconf\fR specifies the minimum number of confirmations that used -outputs should have\. Default is 1\. - - -\fIutxos\fR specifies the utxos to be used to fund the channel, as an array -of "txid:vout"\. - - -\fIpush_msat\fR is the amount of millisatoshis to push to the channel peer at -open\. Note that this is a gift to the peer -- these satoshis are -added to the initial balance of the peer at channel start and are largely -unrecoverable once pushed\. - - -\fIclose_to\fR is a Bitcoin address to which the channel funds should be sent to -on close\. Only valid if both peers have negotiated \fBoption_upfront_shutdown_script\fR\. -Returns \fBclose_to\fR set to closing script iff is negotiated\. - - -\fIrequest_amt\fR is an amount of liquidity you'd like to lease from the peer\. -If peer supports \fBoption_will_fund\fR, indicates to them to include this -much liquidity into the channel\. Must also pass in \fIcompact_lease\fR\. - - -\fIcompact_lease\fR is a compact represenation of the peer's expected -channel lease terms\. If the peer's terms don't match this set, we will -fail to open the channel\. - - -This example shows how to use lightning-cli to open new channel with peer 03f\.\.\.fc1 from one whole utxo bcc1\.\.\.39c:0 -(you can use \fBlistfunds\fR command to get txid and vout): - -.nf -.RS -lightning-cli -k fundchannel id=03f...fc1 amount=all feerate=normal utxos='["bcc1...39c:0"]' - - -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtx\fR (hex): The raw transaction which funded the channel -.IP \[bu] -\fBtxid\fR (txid): The txid of the transaction which funded the channel -.IP \[bu] -\fBoutnum\fR (u32): The 0-based output index showing which output funded the channel -.IP \[bu] -\fBchannel_id\fR (hex): The channel_id of the resulting channel (always 64 characters) -.IP \[bu] -\fBclose_to\fR (hex, optional): The raw scriptPubkey which mutual close will go to; only present if \fIclose_to\fR parameter was specified and peer supports \fBoption_upfront_shutdown_script\fR - -.RE - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -300: The maximum allowed funding amount is exceeded\. -.IP \[bu] -301: There are not enough funds in the internal wallet (including fees) to create the transaction\. -.IP \[bu] -302: The output amount is too small, and would be considered dust\. -.IP \[bu] -303: Broadcasting of the funding transaction failed, the internal call to bitcoin-cli returned with an error\. - -.RE - -Failure may also occur if \fBlightningd\fR and the peer cannot agree on -channel parameters (funding limits, channel reserves, fees, etc\.)\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), lightning-listfunds(), \fBlightning-listpeers\fR(7), -\fBlightning-feerates\fR(7), \fBlightning-multifundchannel\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:b45c037781f1b61f191734434c380fb0c3d52ade3c439992a6bc6e8143a4305e diff --git a/doc/lightning-fundchannel_cancel.7 b/doc/lightning-fundchannel_cancel.7 deleted file mode 100644 index 675884453..000000000 --- a/doc/lightning-fundchannel_cancel.7 +++ /dev/null @@ -1,67 +0,0 @@ -.TH "LIGHTNING-FUNDCHANNEL_CANCEL" "7" "" "" "lightning-fundchannel_cancel" -.SH NAME -lightning-fundchannel_cancel - Command for completing channel establishment -.SH SYNOPSIS - -\fBfundchannel_cancel\fR \fIid\fR - -.SH DESCRIPTION - -\fBfundchannel_cancel\fR is a lower level RPC command\. It allows channel opener -to cancel a channel before funding broadcast with a connected peer\. - - -\fIid\fR is the node id of the remote peer with which to cancel\. - - -Note that the funding transaction MUST NOT be broadcast before -\fBfundchannel_cancel\fR\. Broadcasting transaction before \fBfundchannel_cancel\fR -WILL lead to unrecoverable loss of funds\. - - -If \fBfundchannel_cancel\fR is called after \fBfundchannel_complete\fR, the remote -peer may disconnect when command succeeds\. In this case, user need to connect -to remote peer again before opening channel\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBcancelled\fR (string): A message indicating it was cancelled by RPC - -.RE - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] -306: Unknown peer id\. -.IP \[bu] -307: No channel currently being funded that can be cancelled\. -.IP \[bu] -308: It is unsafe to cancel the channel: the funding transaction -has been broadcast, or there are HTLCs already in the channel, or -the peer was the initiator and not us\. - -.RE -.SH AUTHOR - -Lisa Neigut \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-multifundchannel\fR(7), -lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7) -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7), -lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBabort\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f53625b0a2131e1227431a22fda7081f2acfa87f31acb5a5ebceefa6093ecf45 diff --git a/doc/lightning-fundchannel_complete.7 b/doc/lightning-fundchannel_complete.7 deleted file mode 100644 index eb97fe92a..000000000 --- a/doc/lightning-fundchannel_complete.7 +++ /dev/null @@ -1,71 +0,0 @@ -.TH "LIGHTNING-FUNDCHANNEL_COMPLETE" "7" "" "" "lightning-fundchannel_complete" -.SH NAME -lightning-fundchannel_complete - Command for completing channel establishment -.SH SYNOPSIS - -\fBfundchannel_complete\fR \fIid\fR \fIpsbt\fR - -.SH DESCRIPTION - -\fBfundchannel_complete\fR is a lower level RPC command\. It allows a user to -complete an initiated channel establishment with a connected peer\. - - -\fIid\fR is the node id of the remote peer\. - - -\fIpsbt\fR is the transaction to use for funding (does not need to be -signed but must be otherwise complete)\. - - -Note that the funding transaction MUST NOT be broadcast until after -channel establishment has been successfully completed, as the commitment -transactions for this channel are not secured until this command -successfully completes\. Broadcasting transaction before can lead to -unrecoverable loss of funds\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBchannel_id\fR (hex): The channel_id of the resulting channel (always 64 characters) -.IP \[bu] -\fBcommitments_secured\fR (boolean): Indication that channel is safe to use (always \fItrue\fR) - -.RE - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -306: Unknown peer id\. -.IP \[bu] -309: PSBT does not have a unique, correct output to fund the channel\. - -.RE -.SH AUTHOR - -Lisa Neigut \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-multifundchannel\fR(7), -lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcancel\fR(7), -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7), -lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7), -lightning-openchannel_\fBabort\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:dcef11ad5a6327df2cf5794620c8e6f13baa025846caa2e4c7f36eea2d6da143 diff --git a/doc/lightning-fundchannel_start.7 b/doc/lightning-fundchannel_start.7 deleted file mode 100644 index c9f1d6818..000000000 --- a/doc/lightning-fundchannel_start.7 +++ /dev/null @@ -1,96 +0,0 @@ -.TH "LIGHTNING-FUNDCHANNEL_START" "7" "" "" "lightning-fundchannel_start" -.SH NAME -lightning-fundchannel_start - Command for initiating channel establishment for a lightning channel -.SH SYNOPSIS - -\fBfundchannel_start\fR \fIid\fR \fIamount\fR [\fIfeerate\fR \fIannounce\fR \fIclose_to\fR \fIpush_msat\fR] - -.SH DESCRIPTION - -\fBfundchannel_start\fR is a lower level RPC command\. It allows a user to -initiate channel establishment with a connected peer\. - - -\fIid\fR is the node id of the remote peer\. - - -\fIamount\fR is the satoshi value that the channel will be funded at\. This -value MUST be accurate, otherwise the negotiated commitment transactions -will not encompass the correct channel value\. - - -\fIfeerate\fR is an optional field\. Sets the feerate for subsequent -commitment transactions: see \fBfundchannel\fR\. - - -\fIannounce\fR whether or not to announce this channel\. - - -\fIclose_to\fR is a Bitcoin address to which the channel funds should be sent to -on close\. Only valid if both peers have negotiated \fBoption_upfront_shutdown_script\fR\. -Returns \fBclose_to\fR set to closing script iff is negotiated\. - - -\fIpush_msat\fR is the amount of millisatoshis to push to the channel peer at -open\. Note that this is a gift to the peer -- these satoshis are -added to the initial balance of the peer at channel start and are largely -unrecoverable once pushed\. - - -Note that the funding transaction MUST NOT be broadcast until after -channel establishment has been successfully completed by running -\fBfundchannel_complete\fR, as the commitment transactions for this channel -are not secured until the complete command succeeds\. Broadcasting -transaction before that can lead to unrecoverable loss of funds\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBfunding_address\fR (string): The address to send funding to for the channel -.IP \[bu] -\fBscriptpubkey\fR (hex): The raw scriptPubkey for the address -.IP \[bu] -\fBclose_to\fR (hex, optional): The raw scriptPubkey which mutual close will go to; only present if \fIclose_to\fR parameter was specified and peer supports \fBoption_upfront_shutdown_script\fR - -.RE - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -300: The amount exceeded the maximum configured funding amount\. -.IP \[bu] -301: The provided \fBpush_msat\fR is greater than the provided \fBamount\fR\. -.IP \[bu] -304: Still syncing with bitcoin network -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -306: Unknown peer id\. - -.RE -.SH AUTHOR - -Lisa Neigut \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-multifundchannel\fR(7), -lightning-fundchannel_\fBcomplete\fR(7), lightning-fundchannel_\fBcancel\fR(7) -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7), -lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7), -lightning-openchannel_\fBabort\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:131bcdb525df95f5c2da4fc74cfa0948e1d3bb618c341509cd5ad354aad5edcb diff --git a/doc/lightning-funderupdate.7 b/doc/lightning-funderupdate.7 deleted file mode 100644 index 77d0e5a93..000000000 --- a/doc/lightning-funderupdate.7 +++ /dev/null @@ -1,185 +0,0 @@ -.TH "LIGHTNING-FUNDERUPDATE" "7" "" "" "lightning-funderupdate" -.SH NAME -lightning-funderupdate - Command for adjusting node funding v2 channels -.SH SYNOPSIS - -\fBfunderupdate\fR [\fIpolicy\fR] [\fIpolicy_mod\fR] [\fIleases_only\fR] [\fImin_their_funding_msat\fR] [\fImax_their_funding_msat\fR] [\fIper_channel_min_msat\fR] [\fIper_channel_max_msat\fR] [\fIreserve_tank_msat\fR] [\fIfuzz_percent\fR] [\fIfund_probability\fR] [\fIlease_fee_base_msat\fR] [\fIlease_fee_basis\fR] [\fIfunding_weight\fR] [\fIchannel_fee_max_base_msat\fR] [\fIchannel_fee_max_proportional_thousandths\fR] [\fIcompact_lease\fR] - - -NOTE: Must have --experimental-dual-fund enabled for these settings to take effect\. - -.SH DESCRIPTION - -For channel open requests using - - -\fIpolicy\fR, \fIpolicy_mod\fR is the policy the funder plugin will use to decide -how much capital to commit to a v2 open channel request\. There are three -policy options, detailed below: \fBmatch\fR, \fBavailable\fR, and \fBfixed\fR\. -The \fIpolicy_mod\fR is the number or 'modification' to apply to the policy\. -Default is (fixed, 0sats)\. - -.RS -.IP \[bu] -\fBmatch\fR -- Contribute \fIpolicy_mod\fR percent of their requested funds\. - Valid \fIpolicy_mod\fR values are 0 to 200\. If this is a channel lease - request, we match based on their requested funds\. If it is not a - channel lease request (and \fIlease_only\fR is false), then we match - their funding amount\. Note: any lease match less than 100 will - likely fail, as clients will not accept a lease less than their request\. -.IP \[bu] -\fBavailable\fR -- Contribute \fIpolicy_mod\fR percent of our available - node wallet funds\. Valid \fIpolicy_mod\fR values are 0 to 100\. -.IP \[bu] -\fBfixed\fR -- Contributes a fixed \fIpolicy_mod\fR sats to v2 channel open requests\. - -.RE - -Note: to maximize channel leases, best policy setting is (match, 100)\. - - -\fIleases_only\fR will only contribute funds to \fBoption_will_fund\fR requests -which pay to lease funds\. Defaults to false, will fund any v2 open request -using \fIpolicy\fR even if it's they're not seeking to lease funds\. Note that -\fBoption_will_fund\fR commits funds for 4032 blocks (~1mo)\. Must also set -\fIlease_fee_base_msat\fR, \fIlease_fee_basis\fR, \fIfunding_weight\fR, -\fIchannel_fee_max_base_msat\fR, and \fIchannel_fee_max_proportional_thousandths\fR -to advertise available channel leases\. - - -\fImin_their_funding_msat\fR is the minimum funding sats that we require in order -to activate our contribution policy to the v2 open\. Defaults to 10k sats\. - - -\fImax_their_funding_msat\fR is the maximum funding sats that we will consider -to activate our contribution policy to the v2 open\. Any channel open above this -will not be funded\. Defaults to no max (\fBUINT_MAX\fR)\. - - -\fIper_channel_min_msat\fR is the minimum amount that we will contribute to a -channel open\. Defaults to 10k sats\. - - -\fIper_channel_max_msat\fR is the maximum amount that we will contribute to a -channel open\. Defaults to no max (\fBUINT_MAX\fR)\. - - -\fIreserve_tank_msat\fR is the amount of sats to leave available in the node wallet\. -Defaults to zero sats\. - - -\fIfuzz_percent\fR is a percentage to fuzz the resulting contribution amount by\. -Valid values are 0 to 100\. Note that turning this on with (match, 100) policy -will randomly fail \fBoption_will_fund\fR leases, as most clients -expect an exact or greater match of their \fBrequested_funds\fR\. -Defaults to 0% (no fuzz)\. - - -\fIfund_probability\fR is the percent of v2 channel open requests to apply our -policy to\. Valid values are integers from 0 (fund 0% of all open requests) -to 100 (fund every request)\. Useful for randomizing opens that receive funds\. -Defaults to 100\. - - -Setting any of the next 5 options will activate channel leases for this node, -and advertise these values via the lightning gossip network\. If any one is set, -the other values will be the default\. - - -\fIlease_fee_base_msat\fR is the flat fee for a channel lease\. Node will -receive this much extra added to their channel balance, paid by the opening -node\. Defaults to 2k sats\. Note that the minimum is 1sat\. - - -\fIlease_fee_basis\fR is a basis fee that's calculated as 1/10k of the total -requested funds the peer is asking for\. Node will receive the total of -\fIlease_fee_basis\fR times requested funds / 10k satoshis added to their channel -balance, paid by the opening node\. Default is 0\.65% (65 basis points) - - -\fIfunding_weight\fR is used to calculate the fee the peer will compensate your -node for its contributing inputs to the funding transaction\. The total fee -is calculated as the \fBopen_channel2\fR\.\fBfunding_feerate_perkw\fR times this -\fIfunding_weight\fR divided by 1000\. Node will have this funding fee added -to their channel balance, paid by the opening node\. Default is -2 inputs + 1 P2WPKH output\. - - -\fIchannel_fee_max_base_msat\fR is a commitment to a maximum -\fBchannel_fee_base_msat\fR that your node will charge for routing payments -over this leased channel during the lease duration\. Default is 5k sats\. - - -\fIchannel_fee_max_proportional_thousandths\fR is a commitment to a maximum -\fBchannel_fee_proportional_millionths\fR that your node will charge for -routing payments over this leased channel during the lease duration\. -Note that it's denominated in 'thousandths'\. A setting of \fB1\fR is equal -to 1k ppm; \fB5\fR is 5k ppm, etc\. Default is 100 (100k ppm)\. - - -\fIcompact_lease\fR is a compact description of the channel lease params\. When -opening a channel, passed in to \fBfundchannel\fR to indicate the terms we -expect from the peer\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBsummary\fR (string): Summary of the current funding policy e\.g\. (match 100) -.IP \[bu] -\fBpolicy\fR (string): Policy funder plugin will use to decide how much captial to commit to a v2 open channel request (one of "match", "available", "fixed") -.IP \[bu] -\fBpolicy_mod\fR (u32): The \fIpolicy_mod\fR is the number or 'modification' to apply to the policy\. -.IP \[bu] -\fBleases_only\fR (boolean): Only contribute funds to \fBoption_will_fund\fR lease requests\. -.IP \[bu] -\fBmin_their_funding_msat\fR (msat): The minimum funding sats that we require from peer to activate our funding policy\. -.IP \[bu] -\fBmax_their_funding_msat\fR (msat): The maximum funding sats that we'll allow from peer to activate our funding policy\. -.IP \[bu] -\fBper_channel_min_msat\fR (msat): The minimum amount that we will fund a channel open with\. -.IP \[bu] -\fBper_channel_max_msat\fR (msat): The maximum amount that we will fund a channel open with\. -.IP \[bu] -\fBreserve_tank_msat\fR (msat): Amount of sats to leave available in the node wallet\. -.IP \[bu] -\fBfuzz_percent\fR (u32): Percentage to fuzz our funding amount by\. -.IP \[bu] -\fBfund_probability\fR (u32): Percent of opens to consider funding\. 100 means we'll consider funding every requested open channel request\. -.IP \[bu] -\fBlease_fee_base_msat\fR (msat, optional): Flat fee to charge for a channel lease\. -.IP \[bu] -\fBlease_fee_basis\fR (u32, optional): Proportional fee to charge for a channel lease, calculated as 1/10,000th of requested funds\. -.IP \[bu] -\fBfunding_weight\fR (u32, optional): Transaction weight the channel opener will pay us for a leased funding transaction\. -.IP \[bu] -\fBchannel_fee_max_base_msat\fR (msat, optional): Maximum channel_fee_base_msat we'll charge for routing funds leased on this channel\. -.IP \[bu] -\fBchannel_fee_max_proportional_thousandths\fR (u32, optional): Maximum channel_fee_proportional_millitionths we'll charge for routing funds leased on this channel, in thousandths\. -.IP \[bu] -\fBcompact_lease\fR (hex, optional): Compact description of the channel lease parameters\. - -.RE - -The following error code may occur: - -.RS -.IP \[bu] --32602: If the given parameters are invalid\. - -.RE -.SH AUTHOR - -@niftynei \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-fundchannel\fR(7), \fBlightning-listfunds\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:4c09e1f691bae4f465e9010823079231dc549808b2c65d96c777a39d07bd9bff diff --git a/doc/lightning-fundpsbt.7 b/doc/lightning-fundpsbt.7 deleted file mode 100644 index dcf38ef57..000000000 --- a/doc/lightning-fundpsbt.7 +++ /dev/null @@ -1,144 +0,0 @@ -.TH "LIGHTNING-FUNDPSBT" "7" "" "" "lightning-fundpsbt" -.SH NAME -lightning-fundpsbt - Command to populate PSBT inputs from the wallet -.SH SYNOPSIS - -\fBfundpsbt\fR \fIsatoshi\fR \fIfeerate\fR \fIstartweight\fR [\fIminconf\fR] [\fIreserve\fR] [\fIlocktime\fR] [\fImin_witness_weight\fR] [\fIexcess_as_change\fR] - -.SH DESCRIPTION - -\fBfundpsbt\fR is a low-level RPC command which creates a PSBT using unreserved -inputs in the wallet, optionally reserving them as well\. - - -\fIsatoshi\fR is the minimum satoshi value of the output(s) needed (or the -string "all" meaning use all unreserved inputs)\. If a value, it can -be a whole number, a whole number ending in \fIsat\fR, a whole number -ending in \fI000msat\fR, or a number with 1 to 8 decimal places ending in -\fIbtc\fR\. - - -\fIfeerate\fR can be one of the feerates listed in \fBlightning-feerates\fR(7), -or one of the strings \fIurgent\fR (aim for next block), \fInormal\fR (next 4 -blocks or so) or \fIslow\fR (next 100 blocks or so) to use lightningd’s -internal estimates\. It can also be a \fIfeerate\fR is a number, with an -optional suffix: \fIperkw\fR means the number is interpreted as -satoshi-per-kilosipa (weight), and \fIperkb\fR means it is interpreted -bitcoind-style as satoshi-per-kilobyte\. Omitting the suffix is -equivalent to \fIperkb\fR\. - - -\fIstartweight\fR is the weight of the transaction before \fIfundpsbt\fR has -added any inputs\. - - -\fIminconf\fR specifies the minimum number of confirmations that used -outputs should have\. Default is 1\. - - -\fIreserve\fR is either boolean or a number: if \fItrue\fR or a non-zero -number then \fIreserveinputs\fR is called (successfully, with -\fIexclusive\fR true) on the returned PSBT for this number of blocks (or -72 blocks if \fIreserve\fR is simply \fItrue\fR)\. - - -\fIlocktime\fR is an optional locktime: if not set, it is set to a recent -block height\. - - -\fImin_witness_weight\fR is an optional minimum weight to use for a UTXO's -witness\. If the actual witness weight is greater than the provided minimum, -the actual witness weight will be used\. - - -\fIexcess_as_change\fR is an optional boolean to flag to add a change output -for the excess sats\. - -.SH EXAMPLE USAGE - -Let's assume the caller is trying to produce a 100,000 satoshi output\. - - -First, the caller estimates the weight of the core (typically 42) and -known outputs of the transaction (typically (9 + scriptlen) * 4)\. For -a simple P2WPKH it's a 22 byte scriptpubkey, so that's 124 weight\. - - -It calls "\fIfundpsbt\fR 100000sat slow 166", which succeeds, and returns -the \fIpsbt\fR and \fIfeerate_per_kw\fR it used, the \fIestimated_final_weight\fR -and any \fIexcess_msat\fR\. - - -If \fIexcess_msat\fR is greater than the cost of adding a change output, -the caller adds a change output randomly to position 0 or 1 in the -PSBT\. Say \fIfeerate_per_kw\fR is 253, and the change output is a P2WPKH -(weight 124), the cost is around 31 sats\. With the dust limit disallowing -payments below 546 satoshis, we would only create a change output -if \fIexcess_msat\fR was greater or equal to 31 + 546\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBpsbt\fR (string): Unsigned PSBT which fulfills the parameters given -.IP \[bu] -\fBfeerate_per_kw\fR (u32): The feerate used to create the PSBT, in satoshis-per-kiloweight -.IP \[bu] -\fBestimated_final_weight\fR (u32): The estimated weight of the transaction once fully signed -.IP \[bu] -\fBexcess_msat\fR (msat): The amount above \fIsatoshi\fR which is available\. This could be zero, or dust; it will be zero if \fIchange_outnum\fR is also returned -.IP \[bu] -\fBchange_outnum\fR (u32, optional): The 0-based output number where change was placed (only if parameter \fIexcess_as_change\fR was true and there was sufficient funds) -.IP \[bu] -\fBreservations\fR (array of objects, optional): If \fIreserve\fR was true or a non-zero number, just as per \fBlightning-reserveinputs\fR(7): -.RS -.IP \[bu] -\fBtxid\fR (txid): The txid of the transaction -.IP \[bu] -\fBvout\fR (u32): The 0-based output number -.IP \[bu] -\fBwas_reserved\fR (boolean): Whether this output was previously reserved (always \fIfalse\fR) -.IP \[bu] -\fBreserved\fR (boolean): Whether this output is now reserved (always \fItrue\fR) -.IP \[bu] -\fBreserved_to_block\fR (u32): The blockheight the reservation will expire - -.RE - - -.RE - -If \fIexcess_as_change\fR is true and the excess is enough to cover -an additional output above the \fBdust_limit\fR, then an output is -added to the PSBT for the excess amount\. The \fIexcess_msat\fR will -be zero\. A \fIchange_outnum\fR will be returned with the index of -the change output\. - - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -301: Insufficient UTXOs to meet \fIsatoshi\fR value\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-utxopsbt\fR(7), \fBlightning-reserveinputs\fR(7), \fBlightning-unreserveinputs\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:874514015517f7761a848942160729b820443de359046c378ad904c24b5027f2 diff --git a/doc/lightning-getinfo.7 b/doc/lightning-getinfo.7 deleted file mode 100644 index d3156b302..000000000 --- a/doc/lightning-getinfo.7 +++ /dev/null @@ -1,150 +0,0 @@ -.TH "LIGHTNING-GETINFO" "7" "" "" "lightning-getinfo" -.SH NAME -lightning-getinfo - Command to receive all information about the c-lightning node\. -.SH SYNOPSIS - -\fBgetinfo\fR - -.SH DESCRIPTION - -The \fBgetinfo\fR gives a summary of the current running node\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "getinfo", - "params": {} -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBid\fR (pubkey): The public key unique to this node -.IP \[bu] -\fBalias\fR (string): The fun alias this node will advertize (up to 32 characters) -.IP \[bu] -\fBcolor\fR (hex): The favorite RGB color this node will advertize (always 6 characters) -.IP \[bu] -\fBnum_peers\fR (u32): The total count of peers, connected or with channels -.IP \[bu] -\fBnum_pending_channels\fR (u32): The total count of channels being opened -.IP \[bu] -\fBnum_active_channels\fR (u32): The total count of channels in normal state -.IP \[bu] -\fBnum_inactive_channels\fR (u32): The total count of channels waiting for opening or closing transactions to be mined -.IP \[bu] -\fBversion\fR (string): Identifies what bugs you are running into -.IP \[bu] -\fBlightning-dir\fR (string): Identifies where you can find the configuration and other related files -.IP \[bu] -\fBblockheight\fR (u32): The highest block height we've learned -.IP \[bu] -\fBnetwork\fR (string): represents the type of network on the node are working (e\.g: \fBbitcoin\fR, \fBtestnet\fR, or \fBregtest\fR) -.IP \[bu] -\fBfees_collected_msat\fR (msat): Total routing fees collected by this node -.IP \[bu] -\fBaddress\fR (array of objects, optional): The addresses we announce to the world: -.RS -.IP \[bu] -\fBtype\fR (string): Type of connection (one of "ipv4", "ipv6", "torv2", "torv3") -.IP \[bu] -\fBaddress\fR (string): address in expected format for \fBtype\fR -.IP \[bu] -\fBport\fR (u16): port number - -.RE - -.IP \[bu] -\fBbinding\fR (array of objects, optional): The addresses we are listening on: -.RS -.IP \[bu] -\fBtype\fR (string): Type of connection (one of "local socket", "ipv4", "ipv6", "torv2", "torv3") -.IP \[bu] -\fBaddress\fR (string, optional): address in expected format for \fBtype\fR -.IP \[bu] -\fBport\fR (u16, optional): port number -.IP \[bu] -\fBsocket\fR (string, optional): socket filename (only if \fBtype\fR is "local socket") - -.RE - - -.RE - -The following warnings may also be returned: - -.RS -.IP \[bu] -\fBwarning_bitcoind_sync\fR: Bitcoind is not up-to-date with network\. -.IP \[bu] -\fBwarning_lightningd_sync\fR: Lightningd is still loading latest blocks from bitcoind\. - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters or some error happened during the command process\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "id": "02bf811f7571754f0b51e6d41a8885f5561041a7b14fac093e4cffb95749de1a8d", - "alias": "SLICKERGOPHER", - "color": "02bf81", - "num_peers": 0, - "num_pending_channels": 0, - "num_active_channels": 0, - "num_inactive_channels": 0, - "address": [ - { - "type": "torv3", - "address": "fp463inc4w3lamhhduytrwdwq6q6uzugtaeapylqfc43agrdnnqsheyd.onion", - "port": 9736 - }, - { - "type": "torv3", - "address": "ifnntp5ak4homxrti2fp6ckyllaqcike447ilqfrgdw64ayrmkyashid.onion", - "port": 9736 - } - ], - "binding": [ - { - "type": "ipv4", - "address": "127.0.0.1", - "port": 9736 - } - ], - "version": "0.9.0", - "blockheight": 644297, - "network": "bitcoin", - "msatoshi_fees_collected": 0, - "fees_collected_msat": "0msat", - "lightning-dir": "/media/vincent/Maxtor/C-lightning/node/bitcoin" -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-listconfigs\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:a086a07b8f98712ce397aae77532b5110bdc8746c65f603966c9f0619990c94d diff --git a/doc/lightning-getlog.7 b/doc/lightning-getlog.7 deleted file mode 100644 index 6411870b9..000000000 --- a/doc/lightning-getlog.7 +++ /dev/null @@ -1,130 +0,0 @@ -.TH "LIGHTNING-GETLOG" "7" "" "" "lightning-getlog" -.SH NAME -lightning-getlog - Command to show logs\. -.SH SYNOPSIS - -\fBgetlog\fR [\fIlevel\fR] - -.SH DESCRIPTION - -The \fBgetlog\fR the RPC command to show logs, with optional log \fIlevel\fR\. - -.RS -.IP \[bu] -\fIlevel\fR: A string that represents the log level (\fIbroken\fR, \fIunusual\fR, \fIinfo\fR, \fIdebug\fR, or \fIio\fR)\. The default is \fIinfo\fR\. - -.RE -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "getlog", - "params": { - "level": "debug" - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBcreated_at\fR (string): UNIX timestamp with 9 decimal places, when logging was initialized -.IP \[bu] -\fBbytes_used\fR (u32): The number of bytes used by logging records -.IP \[bu] -\fBbytes_max\fR (u32): The bytes_used values at which records will be trimmed -.IP \[bu] - -\fBlog\fR (array of objects): - -.RS -.IP \[bu] -\fBtype\fR (string) (one of "SKIPPED", "BROKEN", "UNUSUAL", "INFO", "DEBUG", "IO_IN", "IO_OUT") - -.RE - -If \fBtype\fR is "SKIPPED": - -.RS -.IP \[bu] -\fBnum_skipped\fR (u32): number of unprinted log entries (deleted or below \fIlevel\fR parameter) - -.RE - -If \fBtype\fR is "BROKEN", "UNUSUAL", "INFO" or "DEBUG": - -.RS -.IP \[bu] -\fBtime\fR (string): UNIX timestamp with 9 decimal places after \fBcreated_at\fR -.IP \[bu] -\fBsource\fR (string): The particular logbook this was found in -.IP \[bu] -\fBlog\fR (string): The actual log message -.IP \[bu] -\fBnode_id\fR (pubkey, optional): The peer this is associated with - -.RE - -If \fBtype\fR is "IO_IN" or "IO_OUT": - -.RS -.IP \[bu] -\fBtime\fR (string): Seconds after \fBcreated_at\fR, with 9 decimal places -.IP \[bu] -\fBsource\fR (string): The particular logbook this was found in -.IP \[bu] -\fBlog\fR (string): The associated log message -.IP \[bu] -\fBdata\fR (hex): The IO which occurred -.IP \[bu] -\fBnode_id\fR (pubkey, optional): The peer this is associated with - -.RE - - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "created_at": "1598192543.820753463", - "bytes_used": 89285843, - "bytes_max": 104857600, - "log": [ - { - "type": "SKIPPED", - "num_skipped": 45 - }, - { - "type": "INFO", - "time": "0.453627568", - "source": "plugin-autopilot.py", - "log": "RPC method 'autopilot-run-once' does not have a docstring." - } - ] -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:d32e85e5edbf39507b876a3e44c81e2e097d6926df6c45e0ec9c75d998e80818 diff --git a/doc/lightning-getroute.7 b/doc/lightning-getroute.7 deleted file mode 100644 index 4b06ec9dc..000000000 --- a/doc/lightning-getroute.7 +++ /dev/null @@ -1,150 +0,0 @@ -.TH "LIGHTNING-GETROUTE" "7" "" "" "lightning-getroute" -.SH NAME -lightning-getroute - Command for routing a payment (low-level) -.SH SYNOPSIS - -\fBgetroute\fR \fIid\fR \fImsatoshi\fR \fIriskfactor\fR [\fIcltv\fR] [\fIfromid\fR] -[\fIfuzzpercent\fR] [\fIexclude\fR] [\fImaxhops\fR] - -.SH DESCRIPTION - -The \fBgetroute\fR RPC command attempts to find the best route for the -payment of \fImsatoshi\fR to lightning node \fIid\fR, such that the payment will -arrive at \fIid\fR with \fIcltv\fR-blocks to spare (default 9)\. - - -\fImsatoshi\fR is in millisatoshi precision; it can be a whole number, or a -whole number ending in \fImsat\fR or \fIsat\fR, or a number with three decimal -places ending in \fIsat\fR, or a number with 1 to 11 decimal places ending -in \fIbtc\fR\. - - -There are two considerations for how good a route is: how low the fees -are, and how long your payment will get stuck in a delayed output if a -node goes down during the process\. The \fIriskfactor\fR non-negative -floating-point field controls this tradeoff; it is the annual cost of -your funds being stuck (as a percentage)\. - - -For example, if you thought the convenience of keeping your funds liquid -(not stuck) was worth 20% per annum interest, \fIriskfactor\fR would be 20\. - - -If you didn’t care about risk, \fIriskfactor\fR would be zero\. - - -\fIfromid\fR is the node to start the route from: default is this node\. - - -The \fIfuzzpercent\fR is a non-negative floating-point number, representing a -percentage of the actual fee\. The \fIfuzzpercent\fR is used to distort -computed fees along each channel, to provide some randomization to the -route generated\. 0\.0 means the exact fee of that channel is used, while -100\.0 means the fee used might be from 0 to twice the actual fee\. The -default is 5\.0, or up to 5% fee distortion\. - - -\fIexclude\fR is a JSON array of short-channel-id/direction (e\.g\. [ -"564334x877x1/0", "564195x1292x0/1" ]) or node-id which should be excluded -from consideration for routing\. The default is not to exclude any channels -or nodes\. Note if the source or destination is excluded, the command result -is undefined\. - - -\fImaxhops\fR is the maximum number of channels to return; default is 20\. - -.SH RISKFACTOR EFFECT ON ROUTING - -The risk factor is treated as if it were an additional fee on the route, -for the purposes of comparing routes\. - - -The formula used is the following approximation: - -.nf -.RS -risk-fee = amount x blocks-timeout x per-block-cost - - -.RE - -.fi - -We are given a \fIriskfactor\fR expressed as a percentage\. There are 52596 -blocks per year, thus \fIper-block-cost\fR is \fIriskfactor\fR divided by -5,259,600\. - - -The final result is: - -.nf -.RS -risk-fee = amount x blocks-timeout x riskfactor / 5259600 - - -.RE - -.fi - -Here are the risk fees in millisatoshis, using various parameters\. I -assume a channel charges the default of 1000 millisatoshis plus 1 -part-per-million\. Common to_self_delay values on the network at 14 and -144 blocks\. - - -.SH RECOMMENDED RISKFACTOR VALUES - -The default \fIfuzz\fR factor is 5%, so as you can see from the table above, -that tends to overwhelm the effect of \fIriskfactor\fR less than about 5\. - - -1 is a conservative value for a stable lightning network with very few -failures\. - - -1000 is an aggressive value for trying to minimize timeouts at all -costs\. - - -The default for \fBlightning-pay\fR(7) is 10, which starts to become a major -factor for larger amounts, and is basically ignored for tiny ones\. - -.SH RETURN VALUE - -On success, an object containing \fBroute\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBid\fR (pubkey): The node at the end of this hop -.IP \[bu] -\fBchannel\fR (short_channel_id): The channel joining these nodes -.IP \[bu] -\fBdirection\fR (u32): 0 if this channel is traversed from lesser to greater \fBid\fR, otherwise 1 -.IP \[bu] -\fBamount_msat\fR (msat): The amount expected by the node at the end of this hop -.IP \[bu] -\fBdelay\fR (u32): The total CLTV expected by the node at the end of this hop -.IP \[bu] -\fBstyle\fR (string): The features understood by the destination node (one of "legacy", "tlv") - -.RE - -The final \fIid\fR will be the destination \fIid\fR given in the input\. The -difference between the first \fImsatoshi\fR minus the \fImsatoshi\fR given in -the input is the fee (assuming the first hop is free)\. The first -\fIdelay\fR is the very worst case timeout for the payment failure, in -blocks\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-pay\fR(7), \fBlightning-sendpay\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:fc6982d81943e6d235a9cfd1584573e3dd4e4da369ffc9da8e3c5fc2e3726370 diff --git a/doc/lightning-getsharedsecret.7 b/doc/lightning-getsharedsecret.7 deleted file mode 100644 index f9d2a9a90..000000000 --- a/doc/lightning-getsharedsecret.7 +++ /dev/null @@ -1,97 +0,0 @@ -.TH "LIGHTNING-GETSHAREDSECRET" "7" "" "" "lightning-getsharedsecret" -.SH NAME -lightning-getsharedsecret - Command for computing an ECDH -.SH SYNOPSIS - -\fBgetsharedsecret\fR \fIpoint\fR - -.SH DESCRIPTION - -The \fBgetsharedsecret\fR RPC command computes a shared secret from a -given public \fIpoint\fR, and the secret key of this node\. -The \fIpoint\fR is a hexadecimal string of the compressed public -key DER-encoding of the SECP256K1 point\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBshared_secret\fR (hex): the SHA-2 of the compressed encoding of the shared secp256k1 point (always 64 characters) - -.RE - -This command may fail if communications with the HSM has a -problem; -by default lightningd uses a software "HSM" which should -never fail in this way\. -(As of the time of this writing there is no true hardware -HSM that lightningd can use, but we are leaving this -possibilty open in the future\.) -In that case, it will return with an error code of 800\. - -.SH CRYPTOGRAPHIC STANDARDS - -This serves as a key agreement scheme in elliptic-curve based -cryptographic standards\. - - -However, note that most key agreement schemes based on -Elliptic-Curve Diffie-Hellman do not hash the DER-compressed -point\. -Standards like SECG SEC-1 ECIES specify using the X coordinate -of the point instead\. -The Lightning BOLT standard (which \fBlightningd\fR uses), unlike -most other cryptographic standards, specifies the SHA-256 hash -of the DER-compressed encoding of the point\. - - -It is not possible to extract the X coordinate of the ECDH point -via this API, since there is no known way to reverse the 256-bit -SHA-2 hash function\. -Thus there is no way to implement ECIES and similar standards using -this API\. - - -If you know the secret key behind \fIpoint\fR, you do not need to -even call \fBgetsharedsecret\fR, you can just multiply the secret key -with the node public key\. - - -Typically, a sender will generate an ephemeral secret key -and multiply it with the node public key, -then use the result to derive an encryption key -for a symmetric encryption scheme -to encrypt a message that can be read only by that node\. -Then the ephemeral secret key is multiplied -by the standard generator point, -and the ephemeral public key and the encrypted message is -sent to the node, -which then uses \fBgetsharedsecret\fR to derive the same key\. - - -The above sketch elides important details like -key derivation function, stream encryption scheme, -message authentication code, and so on\. -You should follow an established standard and avoid -rolling your own crypto\. - -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO -.SH RESOURCES -.RS -.IP \[bu] -BOLT 4: \fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md#shared-secret\fR -.IP \[bu] -BOLT 8: \fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/08-transport.md#handshake-state\fR -.IP \[bu] -SECG SEC-1 ECIES: \fIhttps://secg.org/sec1-v2.pdf\fR -.IP \[bu] -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -.RE -\" SHA256STAMP:cff207f06144d00f76e494f84357e8d25609437376403656d6f61e64d49d9da1 diff --git a/doc/lightning-help.7 b/doc/lightning-help.7 deleted file mode 100644 index 27f7df9e1..000000000 --- a/doc/lightning-help.7 +++ /dev/null @@ -1,81 +0,0 @@ -.TH "LIGHTNING-HELP" "7" "" "" "lightning-help" -.SH NAME -lightning-help - Command to return all information about RPC commands\. -.SH SYNOPSIS - -\fBhelp\fR [\fIcommand\\\fR] - -.SH DESCRIPTION - -The \fBhelp\fR is a RPC command which is possible consult all information about the RPC commands, or a specific command if \fIcommand\fR is given\. - - -Note that the \fBlightning-cli\fR(1) tool will prefer to list a man page when a -specific \fIcommand\fR is specified, and will only return the JSON if the man -page is not found\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "help", - "params": {} -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBhelp\fR (array of objects): -.RS -.IP \[bu] -\fBcommand\fR (string): the command -.IP \[bu] -\fBcategory\fR (string): the category for this command (useful for grouping) -.IP \[bu] -\fBdescription\fR (string): a one-line description of the purpose of this command -.IP \[bu] -\fBverbose\fR (string): a full description of this command (including whether it's deprecated) - -.RE - - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "help": [ - { - "command": "autocleaninvoice [cycle_seconds] [expired_by]", - "category": "plugin", - "description": "Set up autoclean of expired invoices. ", - "verbose": "Perform cleanup every {cycle_seconds} (default 3600), or disable autoclean if 0. Clean up expired invoices that have expired for {expired_by} seconds (default 86400). " - } - ] -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:66482cf0107b1ccf2a8b673653c01421fde72933c05c2c095a26d8491d251c9a diff --git a/doc/lightning-hsmtool.8 b/doc/lightning-hsmtool.8 deleted file mode 100644 index 4b107e542..000000000 --- a/doc/lightning-hsmtool.8 +++ /dev/null @@ -1,94 +0,0 @@ -.TH "LIGHTNING-HSMTOOL" "8" "" "" "lightning-hsmtool" -.SH NAME -lightning-hsmtool - Tool for working with software HSM secrets of lightningd -.SH SYNOPSIS -.nf -.RS -lightning-hsmtool method [ARGUMENTS]... -.RE - -.fi -.SH DESCRIPTION - -\fBlightning-hsmtool\fR performs various operations on the \fBhsm_secret\fR -file used by the software HSM component of \fBlightningd\fR\. - - -This can be used to encrypt and decrypt the \fBhsm_secret\fR file, -as well as derive secrets used in channel commitments\. - -.SH METHODS - - \fBencrypt\fR \fIhsm_secret\fR \fIpassword\fR -Encrypt the \fBhsm_secret\fR file so that it can only be decrypted at -\fBlightningd\fR startup\. -You must give the option \fB--encrypted-hsm\fR to \fBlightningd\fR\. -The password of the \fBhsm_secret\fR file will be asked whenever you -start \fBlightningd\fR\. - - - \fBdecrypt\fR \fIhsm_secret\fR \fIpassword\fR -Decrypt the \fBhsm_secret\fR file that was encrypted with the \fBencrypt\fR -method\. - - - \fBdumpcommitments\fR \fInode_id\fR \fIchannel_dbid\fR \fIdepth\fR \fIhsm_secret\fR [\fIpassword\fR] -Show the per-commitment secret and point of up to \fIdepth\fR commitments, -of the specified channel with the specified peer, -identified by the channel database index\. -Specify \fIpassword\fR if the \fBhsm_secret\fR is encrypted\. - - - \fBguesstoremote\fR \fIp2wpkh\fR \fInode_id\fR \fImax_channel_dbid\fR \fIhsm_secret\fR [\fIpassword\fR] -Brute-force the private key to our funds from a remote unilateral close -of a channel, in a case where we have lost all database data except for -our \fBhsm_secret\fR\. -The peer must be the one to close the channel (and the funds will remain -unrecoverable until the channel is closed)\. -\fImax_channel_dbid\fR is your own guess on what the \fIchannel_dbid\fR was, -or at least the maximum possible value, -and is usually no greater than the number of channels that the node has -ever had\. -Specify \fIpassword\fR if the \fBhsm_secret\fR is encrypted\. - - -\fBgeneratehsm\fR \fIhsm_secret_path\fR -Generates a new hsm_secret using BIP39\. - - - \fBdumponchaindescriptors\fR \fIhsm_secret\fR [\fIpassword\fR] [\fInetwork\fR] -Dump output descriptors for our onchain wallet\. -The descriptors can be used by external services to be able to generate -addresses for our onchain wallet\. (for example on \fBbitcoind\fR using the -\fBimportmulti\fR or \fBimportdescriptors\fR RPC calls) -We need the path to the hsm_secret containing the wallet seed, and an optional -(skip using \fB""\fR) password if it was encrypted\. -To generate descriptors using testnet master keys, you may specify \fItestnet\fR as -the last parameter\. By default, mainnet-encoded keys are generated\. - -.SH BUGS - -You should report bugs on our github issues page, and maybe submit a fix -to gain our eternal gratitude! - -.SH AUTHOR - -ZmnSCPxj \fI wrote the initial version of -this man page, but many others did the hard work of actually implementing -\fBlightning-hsmtool\fR\. - -.SH SEE ALSO - -\fBlightningd\fR(8), \fBlightningd-config\fR(5) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -.SH COPYING - -Note: the modules in the ccan/ directory have their own licenses, but -the rest of the code is covered by the BSD-style MIT license\. -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:9ad3f88c51e3f16d60f936ee5e3be847769767ad0da5244094bd089b9f9bfdd7 diff --git a/doc/lightning-invoice.7 b/doc/lightning-invoice.7 deleted file mode 100644 index 9eaa9f8c1..000000000 --- a/doc/lightning-invoice.7 +++ /dev/null @@ -1,141 +0,0 @@ -.TH "LIGHTNING-INVOICE" "7" "" "" "lightning-invoice" -.SH NAME -lightning-invoice - Command for accepting payments -.SH SYNOPSIS - -\fBinvoice\fR \fImsatoshi\fR \fIlabel\fR \fIdescription\fR [\fIexpiry\fR] -[\fIfallbacks\fR] [\fIpreimage\fR] [\fIexposeprivatechannels\fR] [\fIcltv\fR] - -.SH DESCRIPTION - -The \fBinvoice\fR RPC command creates the expectation of a payment of a -given amount of milli-satoshi: it returns a unique token which another -lightning daemon can use to pay this invoice\. This token includes a -\fIroute hint\fR description of an incoming channel with capacity to pay the -invoice, if any exists\. - - -The \fImsatoshi\fR parameter can be the string "any", which creates an -invoice that can be paid with any amount\. Otherwise it is a positive value in -millisatoshi precision; it can be a whole number, or a whole number -ending in \fImsat\fR or \fIsat\fR, or a number with three decimal places ending -in \fIsat\fR, or a number with 1 to 11 decimal places ending in \fIbtc\fR\. - - -The \fIlabel\fR must be a unique string or number (which is treated as a -string, so "01" is different from "1"); it is never revealed to other -nodes on the lightning network, but it can be used to query the status -of this invoice\. - - -The \fIdescription\fR is a short description of purpose of payment, e\.g\. \fI1 -cup of coffee\fR\. This value is encoded into the BOLT11 invoice and is -viewable by any node you send this invoice to\. It must be UTF-8, and -cannot use \fI\u\fR JSON escape codes\. - - -The \fIexpiry\fR is optionally the time the invoice is valid for; without a -suffix it is interpreted as seconds, otherwise suffixes \fIs\fR, \fIm\fR, \fIh\fR, -\fId\fR, \fIw\fR indicate seconds, minutes, hours, days and weeks respectively\. -If no value is provided the default of 604800 (1w) is used\. - - -The \fIfallbacks\fR array is one or more fallback addresses to include in -the invoice (in order from most-preferred to least): note that these -arrays are not currently tracked to fulfill the invoice\. - - -The \fIpreimage\fR is a 64-digit hex string to be used as payment preimage -for the created invoice\. By default, if unspecified, lightningd will -generate a secure pseudorandom preimage seeded from an appropriate -entropy source on your system\. \fBIMPORTANT\fR: if you specify the -\fIpreimage\fR, you are responsible, to ensure appropriate care for -generating using a secure pseudorandom generator seeded with sufficient -entropy, and keeping the preimage secret\. This parameter is an advanced -feature intended for use with cutting-edge cryptographic protocols and -should not be used unless explicitly needed\. - - -If specified, \fIexposeprivatechannels\fR overrides the default route hint -logic, which will use unpublished channels only if there are no -published channels\. If \fItrue\fR unpublished channels are always considered -as a route hint candidate; if \fIfalse\fR, never\. If it is a short channel id -(e\.g\. \fI1x1x3\fR) or array of short channel ids, only those specific channels -will be considered candidates, even if they are public or dead-ends\. - - -The route hint is selected from the set of incoming channels of which: -peer’s balance minus their reserves is at least \fImsatoshi\fR, state is -normal, the peer is connected and not a dead end (i\.e\. has at least one -other public channel)\. The selection uses some randomness to prevent -probing, but favors channels that become more balanced after the -payment\. - - -If specified, \fIcltv\fR sets the \fImin_final_cltv_expiry\fR for the invoice\. -Otherwise, it's set to the parameter \fBcltv-final\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBbolt11\fR (string): the bolt11 string -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBpayment_secret\fR (hex): the \fIpayment_secret\fR to place in the onion (always 64 characters) -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp of when invoice expires - -.RE - -The following warnings may also be returned: - -.RS -.IP \[bu] -\fBwarning_capacity\fR: even using all possible channels, there's not enough incoming capacity to pay this invoice\. -.IP \[bu] -\fBwarning_offline\fR: there would be enough incoming capacity, but some channels are offline, so there isn't\. -.IP \[bu] -\fBwarning_deadends\fR: there would be enough incoming capacity, but some channels are dead-ends (no other public channels from those peers), so there isn't\. -.IP \[bu] -\fBwarning_private_unused\fR: there would be enough incoming capacity, but some channels are unannounced and \fIexposeprivatechannels\fR is \fIfalse\fR, so there isn't\. -.IP \[bu] -\fBwarning_mpp\fR: there is sufficient capacity, but not in a single channel, so the payer will have to use multi-part payments\. - -.RE - -On failure, an error is returned and no invoice is created\. If the -lightning process fails before responding, the caller should use -\fBlightning-listinvoices\fR(7) to query whether this invoice was created or -not\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -900: An invoice with the given \fIlabel\fR already exists\. -.IP \[bu] -901: An invoice with the given \fIpreimage\fR already exists\. -.IP \[bu] -902: None of the specified \fIexposeprivatechannels\fR were usable\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listinvoices\fR(7), \fBlightning-delinvoice\fR(7), \fBlightning-pay\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:d88271f45513d2811f76d476cc94b3354f3d307448913762eee3069120444793 diff --git a/doc/lightning-keysend.7 b/doc/lightning-keysend.7 deleted file mode 100644 index 50b8ce74e..000000000 --- a/doc/lightning-keysend.7 +++ /dev/null @@ -1,152 +0,0 @@ -.TH "LIGHTNING-KEYSEND" "7" "" "" "lightning-keysend" -.SH NAME -lightning-keysend - Send funds to a node without an invoice -.SH SYNOPSIS - -\fBkeysend\fR \fIdestination\fR \fImsatoshi\fR [\fIlabel\fR] [\fImaxfeepercent\fR] [\fIretry_for\fR] [\fImaxdelay\fR] [\fIexemptfee\fR] - -.SH DESCRIPTION - -The \fBkeysend\fR RPC command attempts to find a route to the given destination, -and send the specified amount to it\. Unlike the \fBpay\fR RPC command the -\fBkeysend\fR command does not require an invoice, instead it uses the -\fBdestination\fR node ID, and \fBamount\fR to find a route to the specified node\. - - -In order for the destination to be able to claim the payment, the -\fBpayment_key\fR is randomly generated by the sender and included in the -encrypted payload for the destination\. As a consequence there is not -proof-of-payment, like there is with an invoice where the \fBpayment_key\fR is -generated on the destination, and the only way sender could have it is by -sending a payment\. Please ensure that this matches your use-case when using -\fBkeysend\fR\. - - -\fBdestination\fR is the 33 byte, hex-encoded, node ID of the node that the payment should go to\. -\fBmsatoshi\fR is in millisatoshi precision; it can be a whole number, or a whole number with suffix \fBmsat\fR or \fBsat\fR, or a three decimal point number with suffix \fBsat\fR, or an 1 to 11 decimal point number suffixed by \fBbtc\fR\. - - -The \fBlabel\fR field is used to attach a label to payments, and is returned in \fBlightning-listpays\fR(7) and \fBlightning-listsendpays\fR(7)\. -The \fBmaxfeepercent\fR limits the money paid in fees as percentage of the total amount that is to be transferred, and defaults to \fI0\.5\fR\. -The \fBexemptfee\fR option can be used for tiny payments which would be dominated by the fee leveraged by forwarding nodes\. -Setting \fBexemptfee\fR allows the \fBmaxfeepercent\fR check to be skipped on fees that are smaller than \fIexemptfee\fR (default: 5000 millisatoshi)\. - - -The response will occur when the payment fails or succeeds\. -Unlike \fBlightning-pay\fR(7), issuing the same \fBkeysend\fR commands multiple times will result in multiple payments being sent\. - - -Until \fIretry_for\fR seconds passes (default: 60), the command will keep finding routes and retrying the payment\. -However, a payment may be delayed for up to \fBmaxdelay\fR blocks by another node; clients should be prepared for this worst case\. - - -When using \fIlightning-cli\fR, you may skip optional parameters by using -\fInull\fR\. Alternatively, use \fB-k\fR option to provide parameters by name\. - -.SH RANDOMIZATION - -To protect user privacy, the payment algorithm performs some randomization\. - - -1: Route Randomization - - -Route randomization means the payment algorithm does not always use the -lowest-fee or shortest route\. This prevents some highly-connected node -from learning all of the user payments by reducing their fees below the -network average\. - - -2: Shadow Route - - -Shadow route means the payment algorithm will virtually extend the route -by adding delays and fees along it, making it appear to intermediate nodes -that the route is longer than it actually is\. This prevents intermediate -nodes from reliably guessing their distance from the payee\. - - -Route randomization will never exceed \fImaxfeepercent\fR of the payment\. -Route randomization and shadow routing will not take routes that would -exceed \fImaxdelay\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBpayment_preimage\fR (hex): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBcreated_at\fR (number): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBparts\fR (u32): how many attempts this took -.IP \[bu] -\fBamount_msat\fR (msat): Amount the recipient received -.IP \[bu] -\fBamount_sent_msat\fR (msat): Total amount we sent (including fees) -.IP \[bu] -\fBstatus\fR (string): status of payment (always "complete") -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment - -.RE - -The following warnings may also be returned: - -.RS -.IP \[bu] -\fBwarning_partial_completion\fR: Not all parts of a multi-part payment have completed - -.RE - -You can monitor the progress and retries of a payment using the \fBlightning-paystatus\fR(7) command\. - - -The following error codes may occur: - -.RS -.IP \[bu] -\fB-1\fR: Catchall nonspecific error\. -.IP \[bu] -\fB203\fR: Permanent failure at destination\. The \fIdata\fR field of the error will be routing failure object\. -.IP \[bu] -\fB205\fR: Unable to find a route\. -.IP \[bu] -\fB206\fR: Route too expensive\. Either the fee or the needed total locktime for the route exceeds your \fImaxfeepercent\fR or \fImaxdelay\fR settings, respectively\. The \fIdata\fR field of the error will indicate the actual \fIfee\fR as well as the \fIfeepercent\fR percentage that the fee has of the destination payment amount\. It will also indicate the actual \fIdelay\fR along the route\. -.IP \[bu] -\fB210\fR: Payment timed out without a payment in progress\. - -.RE - -A routing failure object has the fields below: - -.RS -.IP \[bu] -\fBerring_index\fR: The index of the node along the route that reported the error\. 0 for the local node, 1 for the first hop, and so on\. -.IP \[bu] -\fBerring_node\fR: The hex string of the pubkey id of the node that reported the error\. -.IP \[bu] -\fBerring_channel\fR: The short channel ID of the channel that has the error, or \fI0:0:0\fR if the destination node raised the error\. -.IP \[bu] -\fBfailcode\fR: The failure code, as per BOLT #4\. -.IP \[bu] -\fBchannel_update\fR\. The hex string of the \fIchannel_update\fR message received from the remote node\. Only present if error is from the remote node and the \fIfailcode\fR has the \fBUPDATE\fR bit set, as per BOLT #4\. - -.RE -.SH AUTHOR - -Christian Decker \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listpays\fR(7), \fBlightning-decodepay\fR(7), \fBlightning-listinvoice\fR(7), -\fBlightning-delinvoice\fR(7), \fBlightning-getroute\fR(7), \fBlightning-invoice\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:04c660a720d5ee16a0385a351eb1a8f8d6c7a5540e00e2e204c07573b7fff7bc diff --git a/doc/lightning-listchannels.7 b/doc/lightning-listchannels.7 deleted file mode 100644 index a497abc6c..000000000 --- a/doc/lightning-listchannels.7 +++ /dev/null @@ -1,101 +0,0 @@ -.TH "LIGHTNING-LISTCHANNELS" "7" "" "" "lightning-listchannels" -.SH NAME -lightning-listchannels - Command to query active lightning channels in the entire network -.SH SYNOPSIS - -\fBlistchannels\fR [\fIshort_channel_id\fR] [\fIsource\fR] [\fIdestination\fR] - -.SH DESCRIPTION - -The \fBlistchannels\fR RPC command returns data on channels that are known -to the node\. Because channels may be bidirectional, up to 2 objects will -be returned for each channel (one for each direction)\. - - -If \fIshort_channel_id\fR is a short channel id, then only known channels with a -matching \fIshort_channel_id\fR are returned\. Otherwise, it must be null\. - - -If \fIsource\fR is a node id, then only channels leading from that node id -are returned\. - - -If \fIdestination\fR is a node id, then only channels leading to that node id -are returned\. - - -Only one of \fIshort_channgel_id\fR, \fIsource\fR or \fIdestination\fR can be supplied\. -If nothing is supplied, data on all lightning channels known to this -node, are returned\. These can be local channels or public channels -broadcast on the gossip network\. - -.SH RETURN VALUE - -On success, an object containing \fBchannels\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBsource\fR (pubkey): the source node -.IP \[bu] -\fBdestination\fR (pubkey): the destination node -.IP \[bu] -\fBpublic\fR (boolean): true if this is announced (otherwise it must be our channel) -.IP \[bu] -\fBamount_msat\fR (msat): the total capacity of this channel (always a whole number of satoshis) -.IP \[bu] -\fBmessage_flags\fR (u8): as defined by BOLT #7 -.IP \[bu] -\fBchannel_flags\fR (u8): as defined by BOLT #7 -.IP \[bu] -\fBactive\fR (boolean): true unless source has disabled it, or it's a local channel and the peer is disconnected or it's still opening or closing -.IP \[bu] -\fBlast_update\fR (u32): UNIX timestamp on the last channel_update from \fIsource\fR -.IP \[bu] -\fBbase_fee_millisatoshi\fR (u32): Base fee changed by \fIsource\fR to use this channel -.IP \[bu] -\fBfee_per_millionth\fR (u32): Proportional fee changed by \fIsource\fR to use this channel, in parts-per-million -.IP \[bu] -\fBdelay\fR (u32): The number of blocks delay required by \fIsource\fR to use this channel -.IP \[bu] -\fBhtlc_minimum_msat\fR (msat): The smallest payment \fIsource\fR will allow via this channel -.IP \[bu] -\fBfeatures\fR (hex): BOLT #9 features bitmap for this channel -.IP \[bu] -\fBhtlc_maximum_msat\fR (msat, optional): The largest payment \fIsource\fR will allow via this channel - -.RE - -If one of \fIshort_channel_id\fR, \fIsource\fR or \fIdestination\fR is supplied and no -matching channels are found, a "channels" object with an empty list is returned\. - - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. - -.RE -.SH AUTHOR - -Michael Hawkins \fI\. - -.SH SEE ALSO - -\fBlightning-fundchannel\fR(7), \fBlightning-listnodes\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - - -Lightning RFC site - -.RS -.IP \[bu] -BOLT #7: -\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/07-routing-gossip.md\fR - -.RE -\" SHA256STAMP:bf737cfe3773d3482b4d8fb9b3a5fef2b7f43e9218fb8881aed87b6deeb14888 diff --git a/doc/lightning-listconfigs.7 b/doc/lightning-listconfigs.7 deleted file mode 100644 index 1ef66bf32..000000000 --- a/doc/lightning-listconfigs.7 +++ /dev/null @@ -1,273 +0,0 @@ -.TH "LIGHTNING-LISTCONFIGS" "7" "" "" "lightning-listconfigs" -.SH NAME -lightning-listconfigs - Command to list all configuration options\. -.SH SYNOPSIS - -\fBlistconfigs\fR [config] - -.SH DESCRIPTION - -The \fBlistconfigs\fR RPC command to list all configuration options, or with \fIconfig\fR, just that one\. - - -The returned values reflect the current configuration, including -showing default values (\fBdev-\fR options are not shown)\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "listconfigs", - "params": { - "config": "network" - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fB# version\fR (string, optional): Special field indicating the current version -.IP \[bu] -\fBplugins\fR (array of objects, optional): -.RS -.IP \[bu] -\fBpath\fR (string): Full path of the plugin -.IP \[bu] -\fBname\fR (string): short name of the plugin -.IP \[bu] -\fBoptions\fR (object, optional): Specific options set for this plugin: - -.RE - -.IP \[bu] -\fBimportant-plugins\fR (array of objects, optional): -.RS -.IP \[bu] -\fBpath\fR (string): Full path of the plugin -.IP \[bu] -\fBname\fR (string): short name of the plugin -.IP \[bu] -\fBoptions\fR (object, optional): Specific options set for this plugin: - -.RE - -.IP \[bu] -\fBconf\fR (string, optional): \fBconf\fR field from cmdline, or default -.IP \[bu] -\fBlightning-dir\fR (string, optional): \fBlightning-dir\fR field from config or cmdline, or default -.IP \[bu] -\fBnetwork\fR (string, optional): \fBnetwork\fR field from config or cmdline, or default -.IP \[bu] -\fBallow-deprecated-apis\fR (boolean, optional): \fBallow-deprecated-apis\fR field from config or cmdline, or default -.IP \[bu] -\fBrpc-file\fR (string, optional): \fBrpc-file\fR field from config or cmdline, or default -.IP \[bu] -\fBdisable-plugin\fR (array of strings, optional): -.RS -.IP \[bu] -\fBdisable-plugin\fR field from config or cmdline - -.RE - -.IP \[bu] -\fBalways-use-proxy\fR (boolean, optional): \fBalways-use-proxy\fR field from config or cmdline, or default -.IP \[bu] -\fBdaemon\fR (boolean, optional): \fBdaemon\fR field from config or cmdline, or default -.IP \[bu] -\fBwallet\fR (string, optional): \fBwallet\fR field from config or cmdline, or default -.IP \[bu] -\fBlarge-channels\fR (boolean, optional): \fBlarge-channels\fR field from config or cmdline, or default -.IP \[bu] -\fBexperimental-dual-fund\fR (boolean, optional): \fBexperimental-dual-fund\fR field from config or cmdline, or default -.IP \[bu] -\fBexperimental-onion-messages\fR (boolean, optional): \fBexperimental-onion-messages\fR field from config or cmdline, or default -.IP \[bu] -\fBexperimental-offers\fR (boolean, optional): \fBexperimental-offers\fR field from config or cmdline, or default -.IP \[bu] -\fBexperimental-shutdown-wrong-funding\fR (boolean, optional): \fBexperimental-shutdown-wrong-funding\fR field from config or cmdline, or default -.IP \[bu] -\fBrgb\fR (hex, optional): \fBrgb\fR field from config or cmdline, or default (always 6 characters) -.IP \[bu] -\fBalias\fR (string, optional): \fBalias\fR field from config or cmdline, or default -.IP \[bu] -\fBpid-file\fR (string, optional): \fBpid-file\fR field from config or cmdline, or default -.IP \[bu] -\fBignore-fee-limits\fR (boolean, optional): \fBignore-fee-limits\fR field from config or cmdline, or default -.IP \[bu] -\fBwatchtime-blocks\fR (u32, optional): \fBwatchtime-blocks\fR field from config or cmdline, or default -.IP \[bu] -\fBmax-locktime-blocks\fR (u32, optional): \fBmax-locktime-blocks\fR field from config or cmdline, or default -.IP \[bu] -\fBfunding-confirms\fR (u32, optional): \fBfunding-confirms\fR field from config or cmdline, or default -.IP \[bu] -\fBcltv-delta\fR (u32, optional): \fBcltv-delta\fR field from config or cmdline, or default -.IP \[bu] -\fBcltv-final\fR (u32, optional): \fBcltv-final\fR field from config or cmdline, or default -.IP \[bu] -\fBcommit-time\fR (u32, optional): \fBcommit-time\fR field from config or cmdline, or default -.IP \[bu] -\fBfee-base\fR (u32, optional): \fBfee-base\fR field from config or cmdline, or default -.IP \[bu] -\fBrescan\fR (integer, optional): \fBrescan\fR field from config or cmdline, or default -.IP \[bu] -\fBfee-per-satoshi\fR (u32, optional): \fBfee-per-satoshi\fR field from config or cmdline, or default -.IP \[bu] -\fBmax-concurrent-htlcs\fR (u32, optional): \fBmax-concurrent-htlcs\fR field from config or cmdline, or default -.IP \[bu] -\fBmin-capacity-sat\fR (u64, optional): \fBmin-capacity-sat\fR field from config or cmdline, or default -.IP \[bu] -\fBaddr\fR (string, optional): \fBaddr\fR field from config or cmdline (can be more than one) -.IP \[bu] -\fBannounce-addr\fR (string, optional): \fBannounce-addr\fR field from config or cmdline (can be more than one) -.IP \[bu] -\fBbind-addr\fR (string, optional): \fBbind-addr\fR field from config or cmdline (can be more than one) -.IP \[bu] -\fBoffline\fR (boolean, optional): \fBtrue\fR if \fBoffline\fR was set in config or cmdline -.IP \[bu] -\fBautolisten\fR (boolean, optional): \fBautolisten\fR field from config or cmdline, or default -.IP \[bu] -\fBproxy\fR (string, optional): \fBproxy\fR field from config or cmdline, or default -.IP \[bu] -\fBdisable-dns\fR (boolean, optional): \fBtrue\fR if \fBdisable-dns\fR was set in config or cmdline -.IP \[bu] -\fBencrypted-hsm\fR (boolean, optional): \fBtrue\fR if \fBencrypted-hsm\fR was set in config or cmdline -.IP \[bu] -\fBrpc-file-mode\fR (string, optional): \fBrpc-file-mode\fR field from config or cmdline, or default -.IP \[bu] -\fBlog-level\fR (string, optional): \fBlog-level\fR field from config or cmdline, or default -.IP \[bu] -\fBlog-prefix\fR (string, optional): \fBlog-prefix\fR field from config or cmdline, or default -.IP \[bu] -\fBlog-file\fR (string, optional): \fBlog-file\fR field from config or cmdline, or default -.IP \[bu] -\fBlog-timestamps\fR (boolean, optional): \fBlog-timestamps\fR field from config or cmdline, or default -.IP \[bu] -\fBforce-feerates\fR (string, optional): force-feerate configuration setting, if any -.IP \[bu] -\fBsubdaemon\fR (string, optional): \fBsubdaemon\fR fields from config or cmdline if any (can be more than one) -.IP \[bu] -\fBtor-service-password\fR (string, optional): \fBtor-service-password\fR field from config or cmdline, if any - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters or field with \fIconfig\fR name doesn't exist\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "# version": "v0.9.0-1", - "lightning-dir": "/media/vincent/Maxtor/sanboxTestWrapperRPC/lightning_dir_dev", - "network": "testnet", - "allow-deprecated-apis": true, - "rpc-file": "lightning-rpc", - "plugins": [ - { - "path": "/home/vincent/Github/plugins/sauron/sauron.py", - "name": "sauron.py", - "options": { - "sauron-api-endpoint": "http://blockstream.info/testnet/api/", - "sauron-tor-proxy": "" - } - }, - { - "path": "/home/vincent/Github/reckless/reckless.py", - "name": "reckless.py" - } - ], - "important-plugins": [ - { - "path": "/home/vincent/Github/lightning/lightningd/../plugins/autoclean", - "name": "autoclean", - "options": { - "autocleaninvoice-cycle": null, - "autocleaninvoice-expired-by": null - } - }, - { - "path": "/home/vincent/Github/lightning/lightningd/../plugins/fundchannel", - "name": "fundchannel" - }, - { - "path": "/home/vincent/Github/lightning/lightningd/../plugins/keysend", - "name": "keysend" - }, - { - "path": "/home/vincent/Github/lightning/lightningd/../plugins/pay", - "name": "pay", - "options": { - "disable-mpp": false - } - } - ], - "important-plugin": "/home/vincent/Github/lightning/lightningd/../plugins/autoclean", - "important-plugin": "/home/vincent/Github/lightning/lightningd/../plugins/fundchannel", - "important-plugin": "/home/vincent/Github/lightning/lightningd/../plugins/keysend", - "important-plugin": "/home/vincent/Github/lightning/lightningd/../plugins/pay", - "plugin": "/home/vincent/Github/plugins/sauron/sauron.py", - "plugin": "/home/vincent/Github/reckless/reckless.py", - "disable-plugin": [ - "bcli" - ], - "always-use-proxy": false, - "daemon": "false", - "wallet": "sqlite3:///media/vincent/Maxtor/sanboxTestWrapperRPC/lightning_dir_dev/testnet/lightningd.sqlite3", - "wumbo": false, - "wumbo": false, - "rgb": "03ad98", - "alias": "BRUCEWAYN-TES-DEV", - "pid-file": "/media/vincent/Maxtor/sanboxTestWrapperRPC/lightning_dir_dev/lightningd-testne...", - "ignore-fee-limits": true, - "watchtime-blocks": 6, - "max-locktime-blocks": 2016, - "funding-confirms": 1, - "commit-fee-min": 0, - "commit-fee-max": 0, - "cltv-delta": 6, - "cltv-final": 10, - "commit-time": 10, - "fee-base": 1, - "rescan": 30, - "fee-per-satoshi": 10, - "max-concurrent-htlcs": 483, - "min-capacity-sat": 10000, - "addr": "autotor:127.0.0.1:9051", - "bind-addr": "127.0.0.1:9735", - "announce-addr": "fp463inc4w3lamhhduytrwdwq6q6uzugtaeapylqfc43agrdnnqsheyd.onion:9735", - "offline": "false", - "autolisten": true, - "proxy": "127.0.0.1:9050", - "disable-dns": "false", - "enable-autotor-v2-mode": "false", - "encrypted-hsm": false, - "rpc-file-mode": "0600", - "log-level": "DEBUG", - "log-prefix": "lightningd", -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -\fBlightning-getinfo\fR(7), \fBlightningd-config\fR(5) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:b6e48314de5642ec61a3e2c989ac0197630c2a3c0e8e6d86020b597679049400 diff --git a/doc/lightning-listdatastore.7 b/doc/lightning-listdatastore.7 deleted file mode 100644 index 7e79e41d6..000000000 --- a/doc/lightning-listdatastore.7 +++ /dev/null @@ -1,58 +0,0 @@ -.TH "LIGHTNING-LISTDATASTORE" "7" "" "" "lightning-listdatastore" -.SH NAME -lightning-listdatastore - Command for listing (plugin) data -.SH SYNOPSIS - -\fBlistdatastore\fR [\fIkey\fR] - -.SH DESCRIPTION - -The \fBlistdatastore\fR RPC command allows plugins to fetch data which was -stored in the c-lightning database\. - - -All immediate children of the \fIkey\fR (or root children) are returned: -a \fIkey\fR with children won't have a \fIhex\fR or \fIgeneration\fR entry\. - -.SH RETURN VALUE - -On success, an object containing \fBdatastore\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBkey\fR (array of strings): -.RS -.IP \[bu] -Part of the key added to the datastore - -.RE - -.IP \[bu] -\fBgeneration\fR (u64, optional): The number of times this has been updated -.IP \[bu] -\fBhex\fR (hex, optional): The hex data from the datastore -.IP \[bu] -\fBstring\fR (string, optional): The data as a string, if it's valid utf-8 - -.RE - -The following error codes may occur: - -.RS -.IP \[bu] --32602: invalid parameters\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-datastore\fR(7), \fBlightning-deldatastore\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:7e165fb1ff5774c381d2a05d85b51b58dc195ddfa7142928a86cb1e2b6d8f040 diff --git a/doc/lightning-listforwards.7 b/doc/lightning-listforwards.7 deleted file mode 100644 index dc683ac01..000000000 --- a/doc/lightning-listforwards.7 +++ /dev/null @@ -1,80 +0,0 @@ -.TH "LIGHTNING-LISTFORWARDS" "7" "" "" "lightning-listforwards" -.SH NAME -lightning-listforwards - Command showing all htlcs and their information -.SH SYNOPSIS - -\fBlistforwards\fR [\fIstatus\fR] [\fIin_channel\fR] [\fIout_channel\fR] - -.SH DESCRIPTION - -The \fBlistforwards\fR RPC command displays all htlcs that have been -attempted to be forwarded by the c-lightning node\. - - -If \fIstatus\fR is specified, then only the forwards with the given status are returned\. -\fIstatus\fR can be either \fIoffered\fR or \fIsettled\fR or \fIfailed\fR or \fIlocal_failed\fR - - -If \fIin_channel\fR or \fIout_channel\fR is specified, then only the matching forwards -on the given in/out channel are returned\. - -.SH RETURN VALUE - -On success, an object containing \fBforwards\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBin_channel\fR (short_channel_id): the channel that received the HTLC -.IP \[bu] -\fBin_msat\fR (msat): the value of the incoming HTLC -.IP \[bu] -\fBstatus\fR (string): still ongoing, completed, failed locally, or failed after forwarding (one of "offered", "settled", "local_failed", "failed") -.IP \[bu] -\fBreceived_time\fR (number): the UNIX timestamp when this was received -.IP \[bu] -\fBout_channel\fR (short_channel_id, optional): the channel that the HTLC was forwarded to -.IP \[bu] -\fBpayment_hash\fR (hex, optional): payment hash sought by HTLC (always 64 characters) - -.RE - -If \fBout_channel\fR is present: - -.RS -.IP \[bu] -\fBfee_msat\fR (msat): the amount this paid in fees -.IP \[bu] -\fBout_msat\fR (msat): the amount we sent out the \fIout_channel\fR - -.RE - -If \fBstatus\fR is "settled" or "failed": - -.RS -.IP \[bu] -\fBresolved_time\fR (number): the UNIX timestamp when this was resolved - -.RE - -If \fBstatus\fR is "local_failed" or "failed": - -.RS -.IP \[bu] -\fBfailcode\fR (u32, optional): the numeric onion code returned -.IP \[bu] -\fBfailreason\fR (string, optional): the name of the onion code returned - -.RE -.SH AUTHOR - -Rene Pickhardt \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-getinfo\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:66506c6c5ebb9628f20bb6e20d696ac8e4b650d20e48ef8626e877f8447a1544 diff --git a/doc/lightning-listfunds.7 b/doc/lightning-listfunds.7 deleted file mode 100644 index 2bef91259..000000000 --- a/doc/lightning-listfunds.7 +++ /dev/null @@ -1,113 +0,0 @@ -.TH "LIGHTNING-LISTFUNDS" "7" "" "" "lightning-listfunds" -.SH NAME -lightning-listfunds - Command showing all funds currently managed by the c-lightning node -.SH SYNOPSIS - -\fBlistfunds\fR [\fIspent\fR] - -.SH DESCRIPTION - -The \fBlistfunds\fR RPC command displays all funds available, either in -unspent outputs (UTXOs) in the internal wallet or funds locked in -currently open channels\. - - -\fIspent\fR is a boolean: if true, then the \fIoutputs\fR will include spent outputs -in addition to the unspent ones\. Default is false\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] - -\fBoutputs\fR (array of objects): - -.RS -.IP \[bu] -\fBtxid\fR (txid): the ID of the spendable transaction -.IP \[bu] -\fBoutput\fR (u32): the index within \fItxid\fR -.IP \[bu] -\fBamount_msat\fR (msat): the amount of the output -.IP \[bu] -\fBscriptpubkey\fR (hex): the scriptPubkey of the output -.IP \[bu] -\fBstatus\fR (string) (one of "unconfirmed", "confirmed", "spent") -.IP \[bu] -\fBaddress\fR (string, optional): the bitcoin address of the output -.IP \[bu] -\fBredeemscript\fR (hex, optional): the redeemscript, only if it's p2sh-wrapped - -.RE - -If \fBstatus\fR is "confirmed": - -.RS -.IP \[bu] -\fBblockheight\fR (u32): Block height where it was confirmed - -.RE - -If \fBreserved\fR is "true": - -.RS -.IP \[bu] -\fBreserved_to_block\fR (u32): Block height where reservation will expire - -.RE - -.IP \[bu] - -\fBchannels\fR (array of objects): - -.RS -.IP \[bu] -\fBpeer_id\fR (pubkey): the peer with which the channel is opened -.IP \[bu] -\fBour_amount_msat\fR (msat): available satoshis on our node’s end of the channel -.IP \[bu] -\fBamount_msat\fR (msat): total channel value -.IP \[bu] -\fBfunding_txid\fR (txid): funding transaction id -.IP \[bu] -\fBfunding_output\fR (u32): the 0-based index of the output in the funding transaction -.IP \[bu] -\fBconnected\fR (boolean): whether the channel peer is connected -.IP \[bu] -\fBstate\fR (string): the channel state, in particular "CHANNELD_NORMAL" means the channel can be used normally (one of "OPENINGD", "CHANNELD_AWAITING_LOCKIN", "CHANNELD_NORMAL", "CHANNELD_SHUTTING_DOWN", "CLOSINGD_SIGEXCHANGE", "CLOSINGD_COMPLETE", "AWAITING_UNILATERAL", "FUNDING_SPEND_SEEN", "ONCHAIN", "DUALOPEND_OPEN_INIT", "DUALOPEND_AWAITING_LOCKIN") - -.RE - -If \fBstate\fR is "CHANNELD_NORMAL": - -.RS -.IP \[bu] -\fBshort_channel_id\fR (short_channel_id): short channel id of channel - -.RE - -If \fBstate\fR is "CHANNELD_SHUTTING_DOWN", "CLOSINGD_SIGEXCHANGE", "CLOSINGD_COMPLETE", "AWAITING_UNILATERAL", "FUNDING_SPEND_SEEN" or "ONCHAIN": - -.RS -.IP \[bu] -\fBshort_channel_id\fR (short_channel_id, optional): short channel id of channel (only if funding reached lockin depth before closing) - -.RE - - -.RE -.SH AUTHOR - -Felix \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-newaddr\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-withdraw\fR(7), \fBlightning-listtransactions\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:1f231ccc1bb70f63b8af8c80b059f5a90fec51cc5aebac69da5241ca952f3a7f diff --git a/doc/lightning-listinvoices.7 b/doc/lightning-listinvoices.7 deleted file mode 100644 index c25784478..000000000 --- a/doc/lightning-listinvoices.7 +++ /dev/null @@ -1,72 +0,0 @@ -.TH "LIGHTNING-LISTINVOICES" "7" "" "" "lightning-listinvoices" -.SH NAME -lightning-listinvoices - Command for querying invoice status -.SH SYNOPSIS - -\fBlistinvoices\fR [\fIlabel\fR] [\fIinvstring\fR] [\fIpayment_hash\fR] [\fIoffer_id\fR] - -.SH DESCRIPTION - -The \fBlistinvoices\fR RPC command gets the status of a specific invoice, -if it exists, or the status of all invoices if given no argument\. - - -A specific invoice can be queried by providing either the \fBlabel\fR -provided when creating the invoice, the \fBinvstring\fR string representing -the invoice, the \fBpayment_hash\fR of the invoice, or the local \fBoffer_id\fR -this invoice was issued for\. Only one of the query parameters can be used at once\. - -.SH RETURN VALUE - -On success, an object containing \fBinvoices\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBlabel\fR (string): unique label supplied at invoice creation -.IP \[bu] -\fBdescription\fR (string): description used in the invoice -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): Whether it's paid, unpaid or unpayable (one of "unpaid", "paid", "expired") -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp of when it will become / became unpayable -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount required to pay this invoice -.IP \[bu] -\fBbolt11\fR (string, optional): the BOLT11 string (always present unless \fIbolt12\fR is) -.IP \[bu] -\fBbolt12\fR (string, optional): the BOLT12 string (always present unless \fIbolt11\fR is) -.IP \[bu] -\fBlocal_offer_id\fR (hex, optional): the \fIid\fR of our offer which created this invoice (\fBexperimental-offers\fR only)\. (always 64 characters) -.IP \[bu] -\fBpayer_note\fR (string, optional): the optional \fIpayer_note\fR from invoice_request which created this invoice (\fBexperimental-offers\fR only)\. - -.RE - -If \fBstatus\fR is "paid": - -.RS -.IP \[bu] -\fBpay_index\fR (u64): Unique incrementing index for this payment -.IP \[bu] -\fBamount_received_msat\fR (msat): the amount actually received (could be slightly greater than \fIamount_msat\fR, since clients may overpay) -.IP \[bu] -\fBpaid_at\fR (u64): UNIX timestamp of when it was paid -.IP \[bu] -\fBpayment_preimage\fR (hex): proof of payment (always 64 characters) - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-waitinvoice\fR(7), \fBlightning-delinvoice\fR(7), \fBlightning-invoice\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:debce16ac6b7bebecb1309884709c5b85fcc952d2fdae462e6f97448cb6c7e51 diff --git a/doc/lightning-listnodes.7 b/doc/lightning-listnodes.7 deleted file mode 100644 index 7c98bbcba..000000000 --- a/doc/lightning-listnodes.7 +++ /dev/null @@ -1,128 +0,0 @@ -.TH "LIGHTNING-LISTNODES" "7" "" "" "lightning-listnodes" -.SH NAME -lightning-listnodes - Command to get the list of nodes in the known network\. -.SH SYNOPSIS - -\fBlistnodes\fR [id] - -.SH DESCRIPTION - -The \fBlistnodes\fR command returns nodes the node has learned about via gossip messages, or a single one if the node \fIid\fR was specified\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "listnodes", - "params": { - "id": "02e29856dab8ddd9044c18486e4cab79ec717b490447af2d4831e290e48d57638a" - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object containing \fBnodes\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBnodeid\fR (pubkey): the public key of the node -.IP \[bu] -\fBlast_timestamp\fR (u32, optional): A node_announcement has been received for this node (UNIX timestamp) - -.RE - -If \fBlast_timestamp\fR is present: - -.RS -.IP \[bu] -\fBalias\fR (string): The fun alias this node advertized (up to 32 characters) -.IP \[bu] -\fBcolor\fR (hex): The favorite RGB color this node advertized (always 6 characters) -.IP \[bu] -\fBfeatures\fR (hex): BOLT #9 features bitmap this node advertized -.IP \[bu] -\fBaddresses\fR (array of objects): The addresses this node advertized: -.RS -.IP \[bu] -\fBtype\fR (string): Type of connection (one of "ipv4", "ipv6", "torv2", "torv3") -.IP \[bu] -\fBaddress\fR (string): address in expected format for \fItype\fR -.IP \[bu] -\fBport\fR (u16): port number - -.RE - - -.RE - -If \fBoption_will_fund\fR is present: - -.RS -.IP \[bu] -\fBoption_will_fund\fR (object): -.RS -.IP \[bu] -\fBlease_fee_base_msat\fR (msat): the fixed fee for a lease (whole number of satoshis) -.IP \[bu] -\fBlease_fee_basis\fR (u32): the proportional fee in basis points (parts per 10,000) for a lease -.IP \[bu] -\fBfunding_weight\fR (u32): the onchain weight you'll have to pay for a lease -.IP \[bu] -\fBchannel_fee_max_base_msat\fR (msat): the maximum base routing fee this node will charge during the lease -.IP \[bu] -\fBchannel_fee_max_proportional_thousandths\fR (u32): the maximum proportional routing fee this node will charge during the lease (in thousandths, not millionths like channel_update) -.IP \[bu] -\fBcompact_lease\fR (hex): the lease as represented in the node_announcement - -.RE - - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "nodes": [ - { - "nodeid": "02e29856dab8ddd9044c14586e4cab79ec717b490447af2d4831e290e48d58638a", - "alias": "some_alias", - "color": "68f442", - "last_timestamp": 1597213741, - "features": "02a2a1", - "addresses": [ - { - "type": "ipv4", - "address": "zzz.yy.xx.xx", - "port": 9735 - } - ] - } - ] -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -FIXME: - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f391e720e6ebead19c2ad2ad6a75f4aa8646dba6cfa920a52ef433ec6d4f347c diff --git a/doc/lightning-listoffers.7 b/doc/lightning-listoffers.7 deleted file mode 100644 index bd6e52de5..000000000 --- a/doc/lightning-listoffers.7 +++ /dev/null @@ -1,87 +0,0 @@ -.TH "LIGHTNING-LISTOFFERS" "7" "" "" "lightning-listoffers" -.SH NAME -lightning-listoffers - Command for listing offers -.SH SYNOPSIS - -\fB(WARNING: experimental-offers only)\fR - - -\fBlistoffers\fR [\fIoffer_id\fR] [\fIactive_only\fR] - -.SH DESCRIPTION - -The \fBlistoffers\fR RPC command list all offers, or with \fBoffer_id\fR, -only the offer with that offer_id (if it exists)\. If \fBactive_only\fR is -set and is true, only offers with \fBactive\fR true are returned\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "listoffers", - "params": { - "active_only": false - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object containing \fBoffers\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBoffer_id\fR (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) -.IP \[bu] -\fBactive\fR (boolean): whether this can still be used -.IP \[bu] -\fBsingle_use\fR (boolean): whether this expires as soon as it's paid -.IP \[bu] -\fBbolt12\fR (string): the bolt12 encoding of the offer -.IP \[bu] -\fBbolt12_unsigned\fR (string): the bolt12 encoding of the offer, without signature -.IP \[bu] -\fBused\fR (boolean): True if an associated invoice has been paid -.IP \[bu] -\fBlabel\fR (string, optional): the (optional) user-specified label - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "offers": [ - { - "offer_id": "053a5c566fbea2681a5ff9c05a913da23e45b95d09ef5bd25d7d408f23da7084", - "active": true, - "single_use": false, - "bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcgqvqcdgq2z9pk7enxv4jjqen0wgs8yatnw3ujz83qkc6rvp4j28rt3dtrn32zkvdy7efhnlrpr5rp5geqxs783wtlj550qs8czzku4nk3pqp6m593qxgunzuqcwkmgqkmp6ty0wyvjcqdguv3pnpukedwn6cr87m89t74h3auyaeg89xkvgzpac70z3m9rn5xzu28c", - "used": false - }, - { - "offer_id": "3247d3597fec19e362ca683416a48a0f76a44c1600725a7ee1936548feadacca", - "active": true, - "single_use": false, - "bolt12": "lno1qgsqvgnwgcg35z6ee2h3yczraddm72xrfua9uve2rlrm9deu7xyfzrcxqd24x3qgqgqlgzs3gdhkven9v5sxvmmjype82um50ys3ug9kxsmqdvj3c6ut2cuu2s4nrf8k2dulccgaqcdzxgp583utjlu49rcyqt8hc3s797umxn3r9367rdqc577rma7key58fywkajxnuzyapge86hj2pg80rjrma40xdqrxnsnva5l3ce7hz4ua8wf755dees4y9vnq", - "used": true - } - ] -} -.RE - -.fi -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-offer\fR(7), \fBlightning-offerout\fR(7), \fBlightning-listoffers\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:3a0d50b8da9f8f11a4e86cf20017fb35dd79dba9cbb8f740e094b430fd30bd01 diff --git a/doc/lightning-listpays.7 b/doc/lightning-listpays.7 deleted file mode 100644 index 522f0abb2..000000000 --- a/doc/lightning-listpays.7 +++ /dev/null @@ -1,78 +0,0 @@ -.TH "LIGHTNING-LISTPAYS" "7" "" "" "lightning-listpays" -.SH NAME -lightning-listpays - Command for querying payment status -.SH SYNOPSIS - -\fBlistpays\fR [bolt11] [payment_hash] [status] - -.SH DESCRIPTION - -The \fBlistpay\fR RPC command gets the status of all \fIpay\fR commands, or a -single one if either \fIbolt11\fR or \fIpayment_hash\fR was specified\. -It is possible filter the payments also by \fIstatus\fR\. - -.SH RETURN VALUE - -On success, an object containing \fBpays\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): status of the payment (one of "pending", "failed", "complete") -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment if known -.IP \[bu] -\fBlabel\fR (string, optional): the label, if given to sendpay -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (if pay supplied one) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string (if supplied for pay: \fBexperimental-offers\fR only)\. - -.RE - -If \fBstatus\fR is "pending" or "complete": - -.RS -.IP \[bu] -\fBamount_sent_msat\fR (msat): the amount we actually sent, including fees -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount the destination received, if known - -.RE - -If \fBstatus\fR is "complete": - -.RS -.IP \[bu] -\fBpreimage\fR (hex): proof of payment (always 64 characters) -.IP \[bu] -\fBnumber_of_parts\fR (u64, optional): the number of parts for a successful payment (only if more than one)\. - -.RE - -If \fBstatus\fR is "failed": - -.RS -.IP \[bu] -\fBerroronion\fR (hex, optional): the error onion returned on failure, if any\. - -.RE - -The returned array is ordered by increasing \fBcreated_at\fR fields\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-pay\fR(7), \fBlightning-paystatus\fR(7), \fBlightning-listsendpays\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:692ceb55d59f5fdf5a3787841a169e2e5b5181d1270bb56277bf40951230553f diff --git a/doc/lightning-listpeers.7 b/doc/lightning-listpeers.7 deleted file mode 100644 index 7371f8cf9..000000000 --- a/doc/lightning-listpeers.7 +++ /dev/null @@ -1,647 +0,0 @@ -.TH "LIGHTNING-LISTPEERS" "7" "" "" "lightning-listpeers" -.SH NAME -lightning-listpeers - Command returning data on connected lightning nodes -.SH SYNOPSIS - -\fBlistpeers\fR [\fIid\fR] [\fIlevel\fR] - -.SH DESCRIPTION - -The \fBlistpeers\fR RPC command returns data on nodes that are connected -or are not connected but have open channels with this node\. - - -Once a connection to another lightning node has been established, using -the \fBconnect\fR command, data on the node can be returned using -\fBlistpeers\fR and the \fIid\fR that was used with the \fBconnect\fR command\. - - -If no \fIid\fR is supplied, then data on all lightning nodes that are -connected, or not connected but have open channels with this node, are -returned\. - - -Supplying \fIid\fR will filter the results to only return data on a node -with a matching \fIid\fR, if one exists\. - - -Supplying \fIlevel\fR will show log entries related to that peer at the -given log level\. Valid log levels are "io", "debug", "info", and -"unusual"\. - - -If a channel is open with a node and the connection has been lost, then -the node will still appear in the output of the command and the value of -the \fIconnected\fR attribute of the node will be "false"\. - - -The channel will remain open for a set blocktime, after which if the -connection has not been re-established, the channel will close and the -node will no longer appear in the command output\. - -.SH RETURN VALUE - -On success, an object containing \fBpeers\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBid\fR (pubkey): the public key of the peer -.IP \[bu] -\fBconnected\fR (boolean): True if the peer is currently connected -.IP \[bu] - -\fBchannels\fR (array of objects): - -.RS -.IP \[bu] -\fBstate\fR (string): the channel state, in particular "CHANNELD_NORMAL" means the channel can be used normally (one of "OPENINGD", "CHANNELD_AWAITING_LOCKIN", "CHANNELD_NORMAL", "CHANNELD_SHUTTING_DOWN", "CLOSINGD_SIGEXCHANGE", "CLOSINGD_COMPLETE", "AWAITING_UNILATERAL", "FUNDING_SPEND_SEEN", "ONCHAIN", "DUALOPEND_OPEN_INIT", "DUALOPEND_AWAITING_LOCKIN") -.IP \[bu] -\fBopener\fR (string): Who initiated the channel (one of "local", "remote") -.IP \[bu] -\fBfeatures\fR (array of strings): -.RS -.IP \[bu] -BOLT #9 features which apply to this channel (one of "option_static_remotekey", "option_anchor_outputs") - -.RE - -.IP \[bu] -\fBscratch_txid\fR (txid, optional): The txid we would use if we went onchain now -.IP \[bu] -\fBfeerate\fR (object, optional): Feerates for the current tx: -.RS -.IP \[bu] -\fBperkw\fR (u32): Feerate per 1000 weight (i\.e kSipa) -.IP \[bu] -\fBperkb\fR (u32): Feerate per 1000 virtual bytes - -.RE - -.IP \[bu] -\fBowner\fR (string, optional): The current subdaemon controlling this connection -.IP \[bu] -\fBshort_channel_id\fR (short_channel_id, optional): The short_channel_id (once locked in) -.IP \[bu] -\fBchannel_id\fR (hex, optional): The full channel_id (always 64 characters) -.IP \[bu] -\fBfunding_txid\fR (txid, optional): ID of the funding transaction -.IP \[bu] -\fBinitial_feerate\fR (string, optional): For inflight opens, the first feerate used to initiate the channel open -.IP \[bu] -\fBlast_feerate\fR (string, optional): For inflight opens, the most recent feerate used on the channel open -.IP \[bu] -\fBnext_feerate\fR (string, optional): For inflight opens, the next feerate we'll use for the channel open -.IP \[bu] -\fBnext_fee_step\fR (u32, optional): For inflight opens, the next feerate step we'll use for the channel open -.IP \[bu] -\fBinflight\fR (array of objects, optional): Current candidate funding transactions (only for dual-funding): -.RS -.IP \[bu] -\fBfunding_txid\fR (txid): ID of the funding transaction -.IP \[bu] -\fBfunding_outnum\fR (u32): The 0-based output number of the funding transaction which opens the channel -.IP \[bu] -\fBfeerate\fR (string): The feerate for this funding transaction in per-1000-weight, with "kpw" appended -.IP \[bu] -\fBtotal_funding_msat\fR (msat): total amount in the channel -.IP \[bu] -\fBour_funding_msat\fR (msat): amount we have in the channel -.IP \[bu] -\fBscratch_txid\fR (txid): The commitment transaction txid we would use if we went onchain now - -.RE - -.IP \[bu] -\fBclose_to\fR (hex, optional): scriptPubkey which we have to close to if we mutual close -.IP \[bu] -\fBprivate\fR (boolean, optional): if False, we will not announce this channel -.IP \[bu] -\fBcloser\fR (string, optional): Who initiated the channel close (\fBnull\fR is deprecated!) (one of "local", "remote", \fInull\fR) -.IP \[bu] -\fBfunding\fR (object, optional): -.RS -.IP \[bu] -\fBlocal_msat\fR (msat): Amount of channel we funded -.IP \[bu] -\fBremote_msat\fR (msat): Amount of channel they funded - -.RE - -.IP \[bu] -\fBto_us_msat\fR (msat, optional): how much of channel is owed to us -.IP \[bu] -\fBmin_to_us_msat\fR (msat, optional): least amount owed to us ever -.IP \[bu] -\fBmax_to_us_msat\fR (msat, optional): most amount owed to us ever -.IP \[bu] -\fBtotal_msat\fR (msat, optional): total amount in the channel -.IP \[bu] -\fBfee_base_msat\fR (msat, optional): amount we charge to use the channel -.IP \[bu] -\fBfee_proportional_millionths\fR (u32, optional): amount we charge to use the channel in parts-per-million -.IP \[bu] -\fBdust_limit_msat\fR (msat, optional): minimum amount for an output on the channel transactions -.IP \[bu] -\fBmax_total_htlc_in_msat\fR (msat, optional): max amount accept in a single payment -.IP \[bu] -\fBtheir_reserve_msat\fR (msat, optional): minimum we insist they keep in channel -.IP \[bu] -\fBour_reserve_msat\fR (msat, optional): minimum they insist we keep in channel -.IP \[bu] -\fBspendable_msat\fR (msat, optional): total we could send through channel -.IP \[bu] -\fBreceivable_msat\fR (msat, optional): total peer could send through channel -.IP \[bu] -\fBminimum_htlc_in_msat\fR (msat, optional): the minimum amount HTLC we accept -.IP \[bu] -\fBtheir_to_self_delay\fR (u32, optional): the number of blocks before they can take their funds if they unilateral close -.IP \[bu] -\fBour_to_self_delay\fR (u32, optional): the number of blocks before we can take our funds if we unilateral close -.IP \[bu] -\fBmax_accepted_htlcs\fR (u32, optional): Maximum number of incoming HTLC we will accept at once -.IP \[bu] -\fBstate_changes\fR (array of objects, optional): Prior state changes: -.RS -.IP \[bu] -\fBtimestamp\fR (string): UTC timestamp of form YYYY-mm-ddTHH:MM:SS\.%03dZ -.IP \[bu] -\fBold_state\fR (string): Previous state (one of "OPENINGD", "CHANNELD_AWAITING_LOCKIN", "CHANNELD_NORMAL", "CHANNELD_SHUTTING_DOWN", "CLOSINGD_SIGEXCHANGE", "CLOSINGD_COMPLETE", "AWAITING_UNILATERAL", "FUNDING_SPEND_SEEN", "ONCHAIN", "DUALOPEND_OPEN_INIT", "DUALOPEND_AWAITING_LOCKIN") -.IP \[bu] -\fBnew_state\fR (string): New state (one of "OPENINGD", "CHANNELD_AWAITING_LOCKIN", "CHANNELD_NORMAL", "CHANNELD_SHUTTING_DOWN", "CLOSINGD_SIGEXCHANGE", "CLOSINGD_COMPLETE", "AWAITING_UNILATERAL", "FUNDING_SPEND_SEEN", "ONCHAIN", "DUALOPEND_OPEN_INIT", "DUALOPEND_AWAITING_LOCKIN") -.IP \[bu] -\fBcause\fR (string): What caused the change (one of "unknown", "local", "user", "remote", "protocol", "onchain") -.IP \[bu] -\fBmessage\fR (string): Human-readable explanation - -.RE - -.IP \[bu] -\fBstatus\fR (array of strings, optional): -.RS -.IP \[bu] -Billboard log of significant changes - -.RE - -.IP \[bu] -\fBin_payments_offered\fR (u64, optional): Number of incoming payment attempts -.IP \[bu] -\fBin_offered_msat\fR (msat, optional): Total amount of incoming payment attempts -.IP \[bu] -\fBin_payments_fulfilled\fR (u64, optional): Number of successful incoming payment attempts -.IP \[bu] -\fBin_fulfilled_msat\fR (msat, optional): Total amount of successful incoming payment attempts -.IP \[bu] -\fBout_payments_offered\fR (u64, optional): Number of outgoing payment attempts -.IP \[bu] -\fBout_offered_msat\fR (msat, optional): Total amount of outgoing payment attempts -.IP \[bu] -\fBout_payments_fulfilled\fR (u64, optional): Number of successful outgoing payment attempts -.IP \[bu] -\fBout_fulfilled_msat\fR (msat, optional): Total amount of successful outgoing payment attempts -.IP \[bu] - -\fBhtlcs\fR (array of objects, optional): current HTLCs in this channel: - -.RS -.IP \[bu] -\fBdirection\fR (string): Whether it came from peer, or is going to peer (one of "in", "out") -.IP \[bu] -\fBid\fR (u64): Unique ID for this htlc on this channel in this direction -.IP \[bu] -\fBamount_msat\fR (msat): Amount send/received for this HTLC -.IP \[bu] -\fBexpiry\fR (u32): Block this HTLC expires at -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the payment_preimage which will prove payment (always 64 characters) -.IP \[bu] -\fBlocal_trimmed\fR (boolean, optional): if this is too small to enforce onchain (always \fItrue\fR) -.IP \[bu] -\fBstatus\fR (string, optional): set if this HTLC is currently waiting on a hook (and shows what plugin) - -.RE - -If \fBdirection\fR is "out": - -.RS -.IP \[bu] -\fBstate\fR (string): Status of the HTLC (one of "SENT_ADD_HTLC", "SENT_ADD_COMMIT", "RCVD_ADD_REVOCATION", "RCVD_ADD_ACK_COMMIT", "SENT_ADD_ACK_REVOCATION", "RCVD_REMOVE_HTLC", "RCVD_REMOVE_COMMIT", "SENT_REMOVE_REVOCATION", "SENT_REMOVE_ACK_COMMIT", "RCVD_REMOVE_ACK_REVOCATION") - -.RE - -If \fBdirection\fR is "in": - -.RS -.IP \[bu] -\fBstate\fR (string): Status of the HTLC (one of "RCVD_ADD_HTLC", "RCVD_ADD_COMMIT", "SENT_ADD_REVOCATION", "SENT_ADD_ACK_COMMIT", "RCVD_ADD_ACK_REVOCATION", "SENT_REMOVE_HTLC", "SENT_REMOVE_COMMIT", "RCVD_REMOVE_REVOCATION", "RCVD_REMOVE_ACK_COMMIT", "SENT_REMOVE_ACK_REVOCATION") - -.RE - - -.RE - -If \fBclose_to\fR is present: - -.RS -.IP \[bu] -\fBclose_to_addr\fR (string, optional): The bitcoin address we will close to - -.RE - -If \fBscratch_txid\fR is present: - -.RS -.IP \[bu] -\fBlast_tx_fee_msat\fR (msat): fee attached to this the current tx - -.RE - -If \fBshort_channel_id\fR is present: - -.RS -.IP \[bu] -\fBdirection\fR (u32): 0 if we're the lesser node_id, 1 if we're the greater - -.RE - -If \fBinflight\fR is present: - -.RS -.IP \[bu] -\fBinitial_feerate\fR (string): The feerate for the initial funding transaction in per-1000-weight, with "kpw" appended -.IP \[bu] -\fBlast_feerate\fR (string): The feerate for the latest funding transaction in per-1000-weight, with "kpw" appended -.IP \[bu] -\fBnext_feerate\fR (string): The minimum feerate for the next funding transaction in per-1000-weight, with "kpw" appended - -.RE - -.IP \[bu] - -\fBlog\fR (array of objects, optional): if \fIlevel\fR is specified, logs for this peer: - -.RS -.IP \[bu] -\fBtype\fR (string) (one of "SKIPPED", "BROKEN", "UNUSUAL", "INFO", "DEBUG", "IO_IN", "IO_OUT") - -.RE - -If \fBtype\fR is "SKIPPED": - -.RS -.IP \[bu] -\fBnum_skipped\fR (u32): number of deleted/omitted entries - -.RE - -If \fBtype\fR is "BROKEN", "UNUSUAL", "INFO" or "DEBUG": - -.RS -.IP \[bu] -\fBtime\fR (string): UNIX timestamp with 9 decimal places -.IP \[bu] -\fBsource\fR (string): The particular logbook this was found in -.IP \[bu] -\fBlog\fR (string): The actual log message -.IP \[bu] -\fBnode_id\fR (pubkey): The peer this is associated with - -.RE - -If \fBtype\fR is "IO_IN" or "IO_OUT": - -.RS -.IP \[bu] -\fBtime\fR (string): UNIX timestamp with 9 decimal places -.IP \[bu] -\fBsource\fR (string): The particular logbook this was found in -.IP \[bu] -\fBlog\fR (string): The actual log message -.IP \[bu] -\fBnode_id\fR (pubkey): The peer this is associated with -.IP \[bu] -\fBdata\fR (hex): The IO which occurred - -.RE - - -.RE - -If \fBconnected\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBnetaddr\fR (array of strings): A single entry array: -.RS -.IP \[bu] -address, e\.g\. 1\.2\.3\.4:1234 - -.RE - -.IP \[bu] -\fBfeatures\fR (hex): bitmap of BOLT #9 features from peer's INIT message - -.RE - -On success, an object with a "peers" key is returned containing a list -of 0 or more objects\. - - -Each object in the list contains the following data: - -.RS -.IP \[bu] -\fIid\fR : The unique id of the peer -.IP \[bu] -\fIconnected\fR : A boolean value showing the connection status -.IP \[bu] -\fInetaddr\fR : A list of network addresses the node is listening on -.IP \[bu] -\fIfeatures\fR : Bit flags showing supported features (BOLT #9) -.IP \[bu] -\fIchannels\fR : An array of objects describing channels with the peer\. -.IP \[bu] -\fIlog\fR : Only present if \fIlevel\fR is set\. List logs related to the -peer at the specified \fIlevel\fR - -.RE - -If \fIid\fR is supplied and no matching nodes are found, a "peers" object -with an empty list is returned\. - - -The objects in the \fIchannels\fR array will have at least these fields: - -.RS -.IP \[bu] -\fIstate\fR: Any of these strings: -.RS -.IP \[bu] -\fB"OPENINGD"\fR: The channel funding protocol with the peer is ongoing -and both sides are negotiating parameters\. -.IP \[bu] -\fB"CHANNELD_AWAITING_LOCKIN"\fR: The peer and you have agreed on channel -parameters and are just waiting for the channel funding transaction to -be confirmed deeply\. -Both you and the peer must acknowledge the channel funding transaction -to be confirmed deeply before entering the next state\. -.IP \[bu] -\fB"CHANNELD_NORMAL"\fR: The channel can be used for normal payments\. -.IP \[bu] -\fB"CHANNELD_SHUTTING_DOWN"\fR: A mutual close was requested (by you or -peer) and both of you are waiting for HTLCs in-flight to be either -failed or succeeded\. -The channel can no longer be used for normal payments and forwarding\. -Mutual close will proceed only once all HTLCs in the channel have -either been fulfilled or failed\. -.IP \[bu] -\fB"CLOSINGD_SIGEXCHANGE"\fR: You and the peer are negotiating the mutual -close onchain fee\. -.IP \[bu] -\fB"CLOSINGD_COMPLETE"\fR: You and the peer have agreed on the mutual close -onchain fee and are awaiting the mutual close getting confirmed deeply\. -.IP \[bu] -\fB"AWAITING_UNILATERAL"\fR: You initiated a unilateral close, and are now -waiting for the peer-selected unilateral close timeout to complete\. -.IP \[bu] -\fB"FUNDING_SPEND_SEEN"\fR: You saw the funding transaction getting -spent (usually the peer initiated a unilateral close) and will now -determine what exactly happened (i\.e\. if it was a theft attempt)\. -.IP \[bu] -\fB"ONCHAIN"\fR: You saw the funding transaction getting spent and now -know what happened (i\.e\. if it was a proper unilateral close by the -peer, or a theft attempt)\. -.IP \[bu] -\fB"CLOSED"\fR: The channel closure has been confirmed deeply\. -The channel will eventually be removed from this array\. - -.RE - -.IP \[bu] -\fIstate_changes\fR: An array of objects describing prior state change events\. -.IP \[bu] -\fIopener\fR: A string \fB"local"\fR or \fB"remote\fR" describing which side opened this -channel\. -.IP \[bu] -\fIcloser\fR: A string \fB"local"\fR or \fB"remote\fR" describing which side -closed this channel or \fBnull\fR if the channel is not (being) closed yet\. -.IP \[bu] -\fIstatus\fR: An array of strings containing the most important log messages -relevant to this channel\. -Also known as the "billboard"\. -.IP \[bu] -\fIowner\fR: A string describing which particular sub-daemon of \fBlightningd\fR -currently is responsible for this channel\. -One of: \fB"lightning_openingd"\fR, \fB"lightning_channeld"\fR, -\fB"lightning_closingd"\fR, \fB"lightning_onchaind"\fR\. -.IP \[bu] -\fIto_us_msat\fR: A string describing how much of the funds is owned by us; -a number followed by a string unit\. -.IP \[bu] -\fItotal_msat\fR: A string describing the total capacity of the channel; -a number followed by a string unit\. -.IP \[bu] -\fIfee_base_msat\fR: The fixed routing fee we charge for forwards going out over -this channel, regardless of payment size\. -.IP \[bu] -\fIfee_proportional_millionths\fR: The proportional routing fees in ppm (parts- -per-millionths) we charge for forwards going out over this channel\. -.IP \[bu] -\fIfeatures\fR: An array of feature names supported by this channel\. - -.RE - -These fields may exist if the channel has gotten beyond the \fB"OPENINGD"\fR -state, or in various circumstances: - -.RS -.IP \[bu] -\fIshort_channel_id\fR: A string of the short channel ID for the channel; -Format is \fB"BBBBxTTTxOOO"\fR, where \fB"BBBB"\fR is the numeric block height -at which the funding transaction was confirmed, \fB"TTT"\fR is the numeric -funding transaction index within that block, and \fB"OOO"\fR is the -numeric output index of the transaction output that actually anchors -this channel\. -.IP \[bu] -\fIdirection\fR: The channel-direction we own, as per BOLT #7\. -We own channel-direction 0 if our node ID is "less than" the peer node ID -in a lexicographical ordering of our node IDs, otherwise we own -channel-direction 1\. -Our \fBchannel_update\fR will use this \fIdirection\fR\. -.IP \[bu] -\fIchannel_id\fR: The full channel ID of the channel; -the funding transaction ID XORed with the output number\. -.IP \[bu] -\fIfunding_txid\fR: The funding transaction ID of the channel\. -.IP \[bu] -\fIclose_to\fR: The raw \fBscriptPubKey\fR that was indicated in the starting -\fBfundchannel_start\fR command and accepted by the peer\. -If the \fBscriptPubKey\fR encodes a standardized address, an additional -\fIclose_to_addr\fR field will be present with the standardized address\. -.IP \[bu] -\fIprivate\fR: A boolean, true if the channel is unpublished, false if the -channel is published\. -.IP \[bu] -\fIfunding_msat\fR: An object, whose field names are the node -IDs involved in the channel, and whose values are strings (numbers with -a unit suffix) indicating how much that node originally contributed in -opening the channel\. -.IP \[bu] -\fImin_to_us_msat\fR: A string describing the historic point at which -we owned the least amount of funds in this channel; -a number followed by a string unit\. -If the peer were to succesfully steal from us, this is the amount we -would still retain\. -.IP \[bu] -\fImax_to_us_msat\fR: A string describing the historic point at which -we owned the most amount of funds in this channel; -a number followed by a string unit\. -If we were to successfully steal from the peer, this is the amount we -could potentially get\. -.IP \[bu] -\fIdust_limit_msat\fR: A string describing an amount; -if an HTLC or the amount wholly-owned by one node is at or below this -amount, it will be considered "dusty" and will not appear in a close -transaction, and will be donated to miners as fee; -a number followed by a string unit\. -.IP \[bu] -\fImax_total_htlc_in_msat\fR: A string describing an amount; -the sum of all HTLCs in the channel cannot exceed this amount; -a number followed by a string unit\. -.IP \[bu] -\fItheir_reserve_msat\fR: A string describing the minimum amount that -the peer must keep in the channel when it attempts to send out; -if it has less than this in the channel, it cannot send to us on -that channel; -a number followed by a string unit\. -We impose this on them, default is 1% of the total channel capacity\. -.IP \[bu] -\fIour_reserve_msat\fR: A string describing the minimum amount that -you must keep in the channel when you attempt to send out; -if you have less than this in the channel, you cannot send out -via this channel; -a number followed by a string unit\. -The peer imposes this on us, default is 1% of the total channel capacity\. -.IP \[bu] -\fIspendable_msat\fR and \fIreceivable_msat\fR: A string describing an -\fB\fIestimate\fR\fR of how much we can send or receive over this channel in a -single payment (or payment-part for multi-part payments); -a number followed by a string unit\. -This is an \fB\fIestimate\fR\fR, which can be wrong because adding HTLCs requires -an increase in fees paid to onchain miners, and onchain fees change -dynamically according to onchain activity\. -For a sufficiently-large channel, this can be limited by the rules imposed -under certain blockchains; -for example, individual Bitcoin mainnet payment-parts cannot exceed -42\.94967295 mBTC\. -.IP \[bu] -\fIminimum_htlc_in_msat\fR: A string describing the minimum amount that -an HTLC must have before we accept it\. -.IP \[bu] -\fItheir_to_self_delay\fR: The number of blocks that the peer must wait -to claim their funds, if they close unilaterally\. -.IP \[bu] -\fIour_to_self_delay\fR: The number of blocks that you must wait to claim -your funds, if you close unilaterally\. -.IP \[bu] -\fImax_accepted_htlcs\fR: The maximum number of HTLCs you will accept on -this channel\. -.IP \[bu] -\fIin_payments_offered\fR: The number of incoming HTLCs offered over this -channel\. -.IP \[bu] -\fIin_offered_msat\fR: A string describing the total amount of all incoming -HTLCs offered over this channel; -a number followed by a string unit\. -.IP \[bu] -\fIin_payments_fulfilled\fR: The number of incoming HTLCs offered \fIand -successfully claimed\fR over this channel\. -.IP \[bu] -\fIin_fulfilled_msat\fR: A string describing the total amount of all -incoming HTLCs offered \fIand successfully claimed\fR over this channel; -a number followed by a string unit\. -.IP \[bu] -\fIout_payments_offered\fR: The number of outgoing HTLCs offered over -this channel\. -.IP \[bu] -\fIout_offered_msat\fR: A string describing the total amount of all -outgoing HTLCs offered over this channel; -a number followed by a string unit\. -.IP \[bu] -\fIout_payments_fulfilled\fR: The number of outgoing HTLCs offered \fIand -successfully claimed\fR over this channel\. -.IP \[bu] -\fIout_fulfilled_msat\fR: A string describing the total amount of all -outgoing HTLCs offered \fIand successfully claimed\fR over this channel; -a number followed by a string unit\. -.IP \[bu] -\fIscratch_txid\fR: The txid of the latest transaction (what we would sign and -send to chain if the channel were to fail now)\. -.IP \[bu] -\fIlast_tx_fee\fR: The fee on that latest transaction\. -.IP \[bu] -\fIfeerate\fR: An object containing the latest feerate as both \fIperkw\fR and \fIperkb\fR\. -.IP \[bu] -\fIhtlcs\fR: An array of objects describing the HTLCs currently in-flight -in the channel\. - -.RE - -Objects in the \fIhtlcs\fR array will contain these fields: - -.RS -.IP \[bu] -\fIdirection\fR: Either the string \fB"out"\fR or \fB"in"\fR, whether it is an -outgoing or incoming HTLC\. -.IP \[bu] -\fIid\fR: A numeric ID uniquely identifying this HTLC\. -.IP \[bu] -\fIamount_msat\fR: The value of the HTLC\. -.IP \[bu] -\fIexpiry\fR: The blockheight at which the HTLC will be forced to return -to its offerer: an \fB"in"\fR HTLC will be returned to the peer, an -\fB"out"\fR HTLC will be returned to you\. -\fBNOTE\fR If the \fIexpiry\fR of any outgoing HTLC will arrive in the next -block, \fBlightningd\fR(8) will automatically unilaterally close the -channel in order to enforce the timeout onchain\. -.IP \[bu] -\fIpayment_hash\fR: The payment hash, whose preimage must be revealed to -successfully claim this HTLC\. -.IP \[bu] -\fIstate\fR: A string describing whether the HTLC has been communicated to -or from the peer, whether it has been signed in a new commitment, whether -the previous commitment (that does not contain it) has been revoked, as -well as when the HTLC is fulfilled or failed offchain\. -.IP \[bu] -\fIlocal_trimmed\fR: A boolean, existing and \fBtrue\fR if the HTLC is not -actually instantiated as an output (i\.e\. "trimmed") on the commitment -transaction (and will not be instantiated on a unilateral close)\. -Generally true if the HTLC is below the \fIdust_limit_msat\fR for the -channel\. - -.RE - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. - -.RE -.SH AUTHOR - -Michael Hawkins \fI\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), lightning-fundchannel_\fBstart\fR(7), -\fBlightning-setchannelfee\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR Lightning -RFC site (BOLT #9): -\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/09-features.md\fR - -\" SHA256STAMP:494bfc944d687593469fd420566a08dceeb84765e771e8e2d67cce4392d9b154 diff --git a/doc/lightning-listsendpays.7 b/doc/lightning-listsendpays.7 deleted file mode 100644 index ac0e30eeb..000000000 --- a/doc/lightning-listsendpays.7 +++ /dev/null @@ -1,78 +0,0 @@ -.TH "LIGHTNING-LISTSENDPAYS" "7" "" "" "lightning-listsendpays" -.SH NAME -lightning-listsendpays - Low-level command for querying sendpay status -.SH SYNOPSIS - -\fBlistsendpays\fR [\fIbolt11\fR] [\fIpayment_hash\fR] [\fIstatus\fR] - -.SH DESCRIPTION - -The \fBlistsendpays\fR RPC command gets the status of all \fIsendpay\fR -commands (which is also used by the \fIpay\fR command), or with \fIbolt11\fR or -\fIpayment_hash\fR limits results to that specific payment\. You cannot -specify both\. It is possible filter the payments also by \fIstatus\fR\. - - -Note that in future there may be more than one concurrent \fIsendpay\fR -command per \fIpay\fR, so this command should be used with caution\. - -.SH RETURN VALUE - -Note that the returned array is ordered by increasing \fIid\fR\. - - -On success, an object containing \fBpayments\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBid\fR (u64): unique ID for this payment attempt -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): status of the payment (one of "pending", "failed", "complete") -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBamount_sent_msat\fR (msat): The amount sent -.IP \[bu] -\fBamount_msat\fR (msat, optional): The amount delivered to destination (if known) -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment if known -.IP \[bu] -\fBlabel\fR (string, optional): the label, if given to sendpay -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (if pay supplied one) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string (if supplied for pay: \fBexperimental-offers\fR only)\. - -.RE - -If \fBstatus\fR is "complete": - -.RS -.IP \[bu] -\fBpayment_preimage\fR (hex): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) - -.RE - -If \fBstatus\fR is "failed": - -.RS -.IP \[bu] -\fBerroronion\fR (hex, optional): the onion message returned - -.RE -.SH AUTHOR - -Christian Decker \fI is mainly -responsible\. - -.SH SEE ALSO - -\fBlightning-listpays\fR(7), \fBlightning-sendpay\fR(7), \fBlightning-listinvoice\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:434378df97caee4272db4a11fc43a5e082af8c492f5fbc953add49c418c6872e diff --git a/doc/lightning-listtransactions.7 b/doc/lightning-listtransactions.7 deleted file mode 100644 index 58f261437..000000000 --- a/doc/lightning-listtransactions.7 +++ /dev/null @@ -1,141 +0,0 @@ -.TH "LIGHTNING-LISTTRANSACTIONS" "7" "" "" "lightning-listtransactions" -.SH NAME -lightning-listtransactions - Command to get the list of transactions that was stored in the wallet\. -.SH SYNOPSIS - -\fBlisttransactions\fR - -.SH DESCRIPTION - -The \fBlisttransactions\fR command returns transactions tracked in the wallet\. This includes deposits, withdrawals and transactions related to channels\. A transaction may have multiple types, e\.g\., a transaction may both be a close and a deposit if it closes the channel and returns funds to the wallet\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "listtransactions", - "params": {} -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object containing \fBtransactions\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBhash\fR (txid): the transaction id -.IP \[bu] -\fBrawtx\fR (hex): the raw transaction -.IP \[bu] -\fBblockheight\fR (u32): the block height of this tx -.IP \[bu] -\fBtxindex\fR (u32): the transaction number within the block -.IP \[bu] -\fBlocktime\fR (u32): The nLocktime for this tx -.IP \[bu] -\fBversion\fR (u32): The nVersion for this tx -.IP \[bu] -\fBinputs\fR (array of objects): Each input, in order: -.RS -.IP \[bu] -\fBtxid\fR (txid): the transaction id spent -.IP \[bu] -\fBindex\fR (u32): the output spent -.IP \[bu] -\fBsequence\fR (u32): the nSequence value -.IP \[bu] -\fBtype\fR (string, optional): the purpose of this input (\fIEXPERIMENTAL_FEATURES\fR only) (one of "theirs", "deposit", "withdraw", "channel_funding", "channel_mutual_close", "channel_unilateral_close", "channel_sweep", "channel_htlc_success", "channel_htlc_timeout", "channel_penalty", "channel_unilateral_cheat") -.IP \[bu] -\fBchannel\fR (short_channel_id, optional): the channel this input is associated with (\fIEXPERIMENTAL_FEATURES\fR only) - -.RE - -.IP \[bu] -\fBoutputs\fR (array of objects): Each output, in order: -.RS -.IP \[bu] -\fBindex\fR (u32): the 0-based output number -.IP \[bu] -\fBmsat\fR (msat): the amount of the output -.IP \[bu] -\fBscriptPubKey\fR (hex): the scriptPubKey -.IP \[bu] -\fBtype\fR (string, optional): the purpose of this output (\fIEXPERIMENTAL_FEATURES\fR only) (one of "theirs", "deposit", "withdraw", "channel_funding", "channel_mutual_close", "channel_unilateral_close", "channel_sweep", "channel_htlc_success", "channel_htlc_timeout", "channel_penalty", "channel_unilateral_cheat") -.IP \[bu] -\fBchannel\fR (short_channel_id, optional): the channel this output is associated with (\fIEXPERIMENTAL_FEATURES\fR only) - -.RE - -.IP \[bu] -\fBtype\fR (array of strings, optional): -.RS -.IP \[bu] -Reason we care about this transaction (\fIEXPERIMENTAL_FEATURES\fR only) (one of "theirs", "deposit", "withdraw", "channel_funding", "channel_mutual_close", "channel_unilateral_close", "channel_sweep", "channel_htlc_success", "channel_htlc_timeout", "channel_penalty", "channel_unilateral_cheat") - -.RE - -.IP \[bu] -\fBchannel\fR (short_channel_id, optional): the channel this transaction is associated with (\fIEXPERIMENTAL_FEATURES\fR only) - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "transactions": [ - { - "hash": "05985072bbe20747325e69a159fe08176cc1bbc96d25e8848edad2dddc1165d0", - "rawtx": "02000000027032912651fc25a3e0893acd5f9640598707e2dfef92143bb5a4020e335442800100000017160014a5f48b9aa3cb8ca6cc1040c11e386745bb4dc932ffffffffd229a4b4f78638ebcac10a68b0561585a5d6e4d3b769ad0a909e9b9afaeae24e00000000171600145c83da9b685f9142016c6f5eb5f98a45cfa6f686ffffffff01915a01000000000017a9143a4dfd59e781f9c3018e7d0a9b7a26d58f8d22bf8700000000", - "blockheight": 0, - "txindex": 0, - "locktime": 0, - "version": 2, - "inputs": [ - { - "txid": "804254330e02a4b53b1492efdfe207875940965fcd3a89e0a325fc5126913270", - "index": 1, - "sequence": 4294967295 - }, - { - "txid": "4ee2eafa9a9b9e900aad69b7d3e4d6a5851556b0680ac1caeb3886f7b4a429d2", - "index": 0, - "sequence": 4294967295 - } - ], - "outputs": [ - { - "index": 0, - "satoshis": "88721000msat", - "scriptPubKey": "a9143a4dfd59e781f9c3018e7d0a9b7a26d58f8d22bf87" - } - ] - } - ] -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -\fBlightning-newaddr\fR(7), \fBlightning-listfunds\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:ce171bdb7bccae8ec12ceb172e4939c4b903462d3744ff56e6939388de92ef91 diff --git a/doc/lightning-multifundchannel.7 b/doc/lightning-multifundchannel.7 deleted file mode 100644 index 081af3a58..000000000 --- a/doc/lightning-multifundchannel.7 +++ /dev/null @@ -1,215 +0,0 @@ -.TH "LIGHTNING-MULTIFUNDCHANNEL" "7" "" "" "lightning-multifundchannel" -.SH NAME -lightning-multifundchannel - Command for establishing many lightning channels -.SH SYNOPSIS - -\fBmultifundchannel\fR \fIdestinations\fR [\fIfeerate\fR] [\fIminconf\fR] [\fIutxos\fR] [\fIminchannels\fR] [\fIcommitment_feerate\fR] - -.SH DESCRIPTION - -The \fBmultifundchannel\fR RPC command opens multiple payment channels -with nodes by committing a single funding transaction to the blockchain -that is shared by all channels\. - - -If not already connected, \fBmultifundchannel\fR will automatically attempt -to connect; you may provide a \fI@host:port\fR hint appended to the node ID -so that c-lightning can learn how to connect to the node; -see \fBlightning-connect\fR(7)\. - - -Once the transaction is confirmed, normal channel operations may begin\. -Readiness is indicated by \fBlistpeers\fR reporting a \fIstate\fR of -\fBCHANNELD_NORMAL\fR for the channel\. - - -\fIdestinations\fR is an array of objects, with the fields: - -.RS -.IP \[bu] -\fIid\fR is the node ID, with an optional \fI@host:port\fR appended to it -in a manner understood by \fBconnect\fR; see \fBlightning-connect\fR(7)\. -Each entry in the \fIdestinations\fR array must have a unique node \fIid\fR\. -.IP \[bu] -\fIamount\fR is the amount in satoshis taken from the internal wallet -to fund the channel\. -The string \fIall\fR can be used to specify all available funds -(or 16,777,215 satoshi if more is available and large channels were -not negotiated with the peer)\. -Otherwise it is in satoshi precision; it can be - a whole number, - a whole number ending in \fIsat\fR, - a whole number ending in \fI000msat\fR, or - a number with 1 to 8 decimal places ending in \fIbtc\fR\. -The value cannot be less than the dust limit, currently 546 satoshi -as of this writing, nor more than 16,777,215 satoshi -(unless large channels were negotiated with the peer)\. -.IP \[bu] -\fIannounce\fR is an optional flag that indicates whether to announce -the channel with this, default \fBtrue\fR\. -If set to \fBfalse\fR, the channel is unpublished\. -.IP \[bu] -\fIpush_msat\fR is the amount of millisatoshis to outright give to the -node\. -This is a gift to the peer, and you do not get a proof-of-payment -out of this\. -.IP \[bu] -\fIclose_to\fR is a Bitcoin address to which the channel funds should be sent to -on close\. Only valid if both peers have negotiated -\fBoption_upfront_shutdown_script\fR\. Returns \fBclose_to\fR set to -closing script iff is negotiated\. -.IP \[bu] -\fIrequest_amt\fR is the amount of liquidity you'd like to lease from peer\. -If peer supports \fBoption_will_fund\fR, indicates to them to include this -much liquidity into the channel\. Must also pass in \fIcompact_lease\fR\. -.IP \[bu] -\fIcompact_lease\fR is a compact represenation of the peer's expected -channel lease terms\. If the peer's terms don't match this set, we will -fail to open the channel to this destination\. - -.RE - -There must be at least one entry in \fIdestinations\fR; -it cannot be an empty array\. - - -\fIfeerate\fR is an optional feerate used for the opening transaction and, if -\fIcommitment_feerate\fR is not set, as the initial feerate for -commitment and HTLC transactions\. It can be one of -the strings \fIurgent\fR (aim for next block), \fInormal\fR (next 4 blocks or -so) or \fIslow\fR (next 100 blocks or so) to use lightningd’s internal -estimates: \fInormal\fR is the default\. - - -Otherwise, \fIfeerate\fR is a number, with an optional suffix: \fIperkw\fR means -the number is interpreted as satoshi-per-kilosipa (weight), and \fIperkb\fR -means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting -the suffix is equivalent to \fIperkb\fR\. - - -\fIminconf\fR specifies the minimum number of confirmations that used -outputs should have\. Default is 1\. - - -\fIutxos\fR specifies the utxos to be used to fund the channel, as an array -of "txid:vout"\. - - -\fIminchannels\fR, if specified, will re-attempt funding as long as at least -this many peers remain (must not be zero)\. -The \fBmultifundchannel\fR command will only fail if too many peers fail -the funding process\. - - -\fIcommitment_feerate\fR is the initial feerate for commitment and HTLC -transactions\. See \fIfeerate\fR for valid values\. - -.SH RETURN VALUE - -This command opens multiple channels with a single large transaction, -thus only one transaction is returned\. - - -If \fIminchannels\fR was specified and is less than the number of destinations, -then it is possible that one or more of the destinations -do not have a channel even if \fBmultifundchannel\fR succeeded\. - - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtx\fR (hex): The raw transaction which funded the channel -.IP \[bu] -\fBtxid\fR (txid): The txid of the transaction which funded the channel -.IP \[bu] -\fBchannel_ids\fR (array of objects): -.RS -.IP \[bu] -\fBid\fR (pubkey): The peer we opened the channel with -.IP \[bu] -\fBoutnum\fR (u32): The 0-based output index showing which output funded the channel -.IP \[bu] -\fBchannel_id\fR (hex): The channel_id of the resulting channel (always 64 characters) -.IP \[bu] -\fBclose_to\fR (hex, optional): The raw scriptPubkey which mutual close will go to; only present if \fIclose_to\fR parameter was specified and peer supports \fBoption_upfront_shutdown_script\fR - -.RE - -.IP \[bu] -\fBfailed\fR (array of objects, optional): any peers we failed to open with (if \fIminchannels\fR was specified less than the number of destinations): -.RS -.IP \[bu] -\fBid\fR (pubkey): The peer we failed to open the channel with -.IP \[bu] -\fBmethod\fR (string): What stage we failed at (one of "connect", "openchannel_init", "fundchannel_start", "fundchannel_complete") -.IP \[bu] -\fBerror\fR (object): -.RS -.IP \[bu] -\fBcode\fR (integer): JSON error code from failing stage -.IP \[bu] -\fBmessage\fR (string): Message from stage -.IP \[bu] -\fBdata\fR: Additional error data - -.RE - - -.RE - - -.RE - -On failure, none of the channels are created\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -300: The maximum allowed funding amount is exceeded\. -.IP \[bu] -301: There are not enough funds in the internal wallet (including fees) to create the transaction\. -.IP \[bu] -302: The output amount is too small, and would be considered dust\. -.IP \[bu] -303: Broadcasting of the funding transaction failed, the internal call to bitcoin-cli returned with an error\. - -.RE - -Failure may also occur if \fBlightningd\fR and the peer cannot agree on -channel parameters (funding limits, channel reserves, fees, etc\.)\. -See lightning-fundchannel_\fBstart\fR(7) and lightning-fundchannel_\fBcomplete\fR(7)\. - - -There may be rare edge cases where a communications failure later in -the channel funding process will cancel the funding locally, but -the peer thinks the channel is already waiting for funding lockin\. -In that case, the next time we connect to the peer, our node will -tell the peer to forget the channel, but some nodes (in particular, -c-lightning nodes) will disconnect when our node tells them to -forget the channel\. -If you immediately \fBmultifundchannel\fR with that peer, it could -trigger this connect-forget-disconnect behavior, causing the -second \fBmultifundchannel\fR to fail as well due to disconnection\. -Doing a \fBconnect\fR with the peers separately, and waiting for a -few seconds, should help clear this hurdle; -running \fBmultifundchannel\fR a third time would also clear this\. - -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7), lightning-listfunds(), \fBlightning-listpeers\fR(7), -\fBlightning-fundchannel\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:dfbc1c3daffa0e935343c05f35e99e517ef828bd4e887a3306af52294e0e938d diff --git a/doc/lightning-multiwithdraw.7 b/doc/lightning-multiwithdraw.7 deleted file mode 100644 index 85b118bed..000000000 --- a/doc/lightning-multiwithdraw.7 +++ /dev/null @@ -1,83 +0,0 @@ -.TH "LIGHTNING-MULTIWITHDRAW" "7" "" "" "lightning-multiwithdraw" -.SH NAME -lightning-multiwithdraw - Command for withdrawing to multiple addresses -.SH SYNOPSIS - -\fBmultiwithdraw\fR \fIoutputs\fR [\fIfeerate\fR] [\fIminconf\fR] [\fIutxos\fR] - -.SH DESCRIPTION - -The \fBmultiwithdraw\fR RPC command sends funds from c-lightning’s internal -wallet to the addresses specified in \fIoutputs\fR, -which is an array containing objects of the form \fB{address: amount}\fR\. -The \fBamount\fR may be the string \fI"all"\fR, indicating that all onchain funds -be sent to the specified address\. -Otherwise, it is in satoshi precision; -it can be -a whole number, -a whole number ending in \fIsat\fR, -a whole number ending in \fI000msat\fR, -or a number with 1 to 8 decimal places ending in \fIbtc\fR\. - - -\fIfeerate\fR is an optional feerate to use\. It can be one of the strings -\fIurgent\fR (aim for next block), \fInormal\fR (next 4 blocks or so) or \fIslow\fR -(next 100 blocks or so) to use lightningd’s internal estimates: \fInormal\fR -is the default\. - - -Otherwise, \fIfeerate\fR is a number, with an optional suffix: \fIperkw\fR means -the number is interpreted as satoshi-per-kilosipa (weight), and \fIperkb\fR -means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting -the suffix is equivalent to \fIperkb\fR\. - - -\fIminconf\fR specifies the minimum number of confirmations that used -outputs should have\. Default is 1\. - - -\fIutxos\fR specifies the utxos to be used to be withdrawn from, as an array -of "txid:vout"\. These must be drawn from the node's available UTXO set\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtx\fR (hex): The raw transaction which was sent -.IP \[bu] -\fBtxid\fR (txid): The txid of the \fBtx\fR - -.RE - -On failure, an error is reported and the withdrawal transaction is not -created\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -301: There are not enough funds in the internal wallet (including -fees) to create the transaction\. -.IP \[bu] -302: The dust limit is not met\. - -.RE -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listfunds\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-newaddr\fR(7), -\fBlightning-txprepare\fR(7), \fBlightning-withdraw\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:0d0e1d364c4e436e33d3c15d4af7198591437cc2257ec646f3ebec0b90f54046 diff --git a/doc/lightning-newaddr.7 b/doc/lightning-newaddr.7 deleted file mode 100644 index 9de4d4ee8..000000000 --- a/doc/lightning-newaddr.7 +++ /dev/null @@ -1,56 +0,0 @@ -.TH "LIGHTNING-NEWADDR" "7" "" "" "lightning-newaddr" -.SH NAME -lightning-newaddr - Command for generating a new address to be used by c-lightning -.SH SYNOPSIS - -\fBnewaddr\fR [ \fIaddresstype\fR ] - -.SH DESCRIPTION - -The \fBnewaddr\fR RPC command generates a new address which can -subsequently be used to fund channels managed by the c-lightning node\. - - -The funding transaction needs to be confirmed before funds can be used\. - - -\fIaddresstype\fR specifies the type of address wanted; i\.e\. \fIp2sh-segwit\fR -(e\.g\. \fB2MxaozoqWwiUcuD9KKgUSrLFDafLqimT9Ta\fR on bitcoin testnet or -\fB3MZxzq3jBSKNQ2e7dzneo9hy4FvNzmMmt3\fR on bitcoin mainnet) or \fIbech32\fR -(e\.g\. \fBtb1qu9j4lg5f9rgjyfhvfd905vw46eg39czmktxqgg\fR on bitcoin testnet -or \fBbc1qwqdg6squsna38e46795at95yu9atm8azzmyvckulcc7kytlcckxswvvzej\fR on -bitcoin mainnet)\. The special value \fIall\fR generates both address types -for the same underlying key\. - - -If no \fIaddresstype\fR is specified the address generated is a \fIbech32\fR address\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBbech32\fR (string, optional): The bech32 (native segwit) address -.IP \[bu] -\fBp2sh-segwit\fR (string, optional): The p2sh-wrapped address - -.RE -.SH ERRORS - -If an unrecognized address type is requested an error message will be -returned\. - -.SH AUTHOR - -Felix \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listfunds\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-withdraw\fR(7), \fBlightning-listtransactions\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f18774bcca3a39c5608f6623280e902b0e0316626e49c0e0ac759c619167bc7e diff --git a/doc/lightning-notifications.7 b/doc/lightning-notifications.7 deleted file mode 100644 index 0e9dd5001..000000000 --- a/doc/lightning-notifications.7 +++ /dev/null @@ -1,115 +0,0 @@ -.TH "LIGHTNING-NOTIFICATIONS" "7" "" "" "lightning-notifications" -.SH NAME -lightning-notifications - Command to set up notifications\. -.SH SYNOPSIS - -\fBnotifications\fR \fIenable\fR - -.SH DESCRIPTION - -The \fBnotifications\fR the RPC command enabled notifications for this JSON-RPC -connection\. By default (and for backwards-compatibility) notifications are -disabled\. - - -Various commands, especially complex and slow ones, offer -notifications which indicate their progress\. - -.RS -.IP \[bu] -\fIenable\fR: \fItrue\fR to enable notifications, \fIfalse\fR to disable them\. - -.RE -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "notifications", - "params": { - "enable": true - } -} -.RE - -.fi -.SH NOTIFICATIONS - -Notifications are JSON-RPC objects without an \fIid\fR field\. \fIlightningd\fR sends -notifications (once enabled with this \fInotifications\fR command) with a \fIparams\fR -\fIid\fR field indicating which command the notification refers to\. - - -Implementations should ignore notifications without an \fIid\fR parameter, or -unknown \fImethod\fR\. - - -Common \fImethod\fRs include: - -.RS -.IP \[bu] -\fImessage\fR: param \fImessage\fR: a descriptional string indicating something -which occurred relating to the command\. Param \fIlevel\fR indicates the level, -as per \fBlightning-getlog\fR(7): \fIinfo\fR and \fIdebug\fR are typical\. -.IP \[bu] -\fIprogress\fR: param \fInum\fR and \fItotal\fR, where \fInum\fR starts at 0 and is always -less than \fItotal\fR\. Optional param \fIstage\fR with fields \fInum\fR and \fItotal\fR, -indicating what stage we are progressing through\. - -.RE -.SH RETURN VALUE - -On success, an empty object is returned\. - - -On success, if \fIenable\fR was \fItrue\fR, notifications will be forwarded -from then on\. - - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters\. - -.RE -.SH EXAMPLE NOTIFICATIONS -.nf -.RS -{ - "method": "message", - "params": { - "id": 83, - "message": "This is a test message", - "level": "DEBUG" - } -} -.RE - -.fi -.nf -.RS -{ - "method": "progress", - "params": { - "id": 83, - "num": 0, - "total": 30 - "stage": { - "num": 0, - "total": 2 - } - } -} -.RE - -.fi -.SH AUTHOR - -Rusty Russell \fI wrote the initial version of this man page\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:651537a5b1e0c017bf362443ea346a762be510d94dffb5da761bdfc56047242a diff --git a/doc/lightning-offer.7 b/doc/lightning-offer.7 deleted file mode 100644 index 04461efe9..000000000 --- a/doc/lightning-offer.7 +++ /dev/null @@ -1,162 +0,0 @@ -.TH "LIGHTNING-OFFER" "7" "" "" "lightning-offer" -.SH NAME -lightning-offer - Command for accepting payments -.SH SYNOPSIS - -\fB(WARNING: experimental-offers only)\fR - - -\fBoffer\fR \fIamount\fR \fIdescription\fR [\fIvendor\fR] [\fIlabel\fR] [\fIquantity_min\fR] [\fIquantity_max\fR] [\fIabsolute_expiry\fR] [\fIrecurrence\fR] [\fIrecurrence_base\fR] [\fIrecurrence_paywindow\fR] [\fIrecurrence_limit\fR] [\fIsingle_use\fR] - -.SH DESCRIPTION - -The \fBoffer\fR RPC command creates an offer (or returns an existing -one), which is a precursor to creating one or more invoices\. It -automatically enables the processing of an incoming invoice_request, -and issuing of invoices\. - - -Note that it creates two variants of the offer: a signed and an -unsigned one (which is smaller)\. Wallets should accept both: the -current specification allows either\. - - -The \fIamount\fR parameter can be the string "any", which creates an offer -that can be paid with any amount (e\.g\. a donation)\. Otherwise it can -be a positive value in millisatoshi precision; it can be a whole -number, or a whole number ending in \fImsat\fR or \fIsat\fR, or a number with -three decimal places ending in \fIsat\fR, or a number with 1 to 11 decimal -places ending in \fIbtc\fR\. - - -\fIamount\fR can also have an ISO 4217 postfix (i\.e\. USD), in which case -currency conversion will need to be done for the invoice itself\. A -plugin is needed which provides the "currencyconvert" API for this -currency, otherwise the offer creation will fail\. - - -The \fIdescription\fR is a short description of purpose of the offer, -e\.g\. \fIcoffee\fR\. This value is encoded into the resulting offer and is -viewable by anyone you expose this offer to\. It must be UTF-8, and -cannot use \fI\u\fR JSON escape codes\. - - -The \fIvendor\fR is another (optional) field exposed in the offer, and -reflects who is issuing this offer (i\.e\. you) if appropriate\. - - -The \fIlabel\fR field is an internal-use name for the offer, which can -be any UTF-8 string\. - - -The present of \fIquantity_min\fR or \fIquantity_max\fR indicates that the -invoice can specify more than one of the items within this (inclusive) -range\. The \fIamount\fR for the invoice will need to be multiplied -accordingly\. These are encoded in the offer\. - - -The \fIabsolute_expiry\fR is optionally the time the offer is valid until, -in seconds since the first day of 1970 UTC\. If not set, the offer -remains valid (though it can be deactivated by the issuer of course)\. -This is encoded in the offer\. - - -\fIrecurrence\fR means that an invoice is expected at regular intervals\. -The argument is a positive number followed by one of "seconds", -"minutes", "hours", "days", "weeks", "months" or "years" (variants -without the trailing "s" are also permitted)\. This is encoded in the -offer\. The semantics of recurrence is fairly predictable, but fully -documented in BOLT 12\. e\.g\. "4weeks"\. - - -\fIrecurrence_base\fR is an optional time in seconds since the first day -of 1970 UTC, optionally with a "@" prefix\. This indicates when the -first period begins; without this, the recurrence periods start from -the first invoice\. The "@" prefix means that the invoice must start -by paying the first period; otherwise it is permitted to start at any -period\. This is encoded in the offer\. e\.g\. "@1609459200" indicates -you must start paying on the 1st January 2021\. - - -\fIrecurrence_paywindow\fR is an optional argument of form -'-time+time[%]'\. The first time is the number of seconds before the -start of a period in which an invoice and payment is valid, the second -time is the number of seconds after the start of the period\. For -example \fI-604800+86400\fR means you can fetch an pay the invoice 4 weeks -before the given period starts, and up to 1 day afterwards\. The -optional \fI%\fR indicates that the amount of the invoice will be scaled -by the time remaining in the period\. If this is not specified, the -default is that payment is allowed during the current and previous -periods\. This is encoded in the offer\. - - -\fIrecurrence_limit\fR is an optional argument to indicate the maximum -period which exists\. eg\. "12" means there are 13 periods, from 0 to -12 inclusive\. This is encoded in the offer\. - - -\fIrefund_for\fR is the payment_preimage of a previous (paid) invoice\. -This implies \fIsend_invoice\fR and \fIsingle_use\fR\. This is encoded in the -offer\. - - -\fIsingle_use\fR (default false) indicates that the offer is only valid -once; we may issue multiple invoices, but as soon as one is paid all other -invoices will be expired (i\.e\. only one person can pay this offer)\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBoffer_id\fR (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) -.IP \[bu] -\fBactive\fR (boolean): whether this can still be used (always \fItrue\fR) -.IP \[bu] -\fBsingle_use\fR (boolean): whether this expires as soon as it's paid (reflects the \fIsingle_use\fR parameter) -.IP \[bu] -\fBbolt12\fR (string): the bolt12 encoding of the offer -.IP \[bu] -\fBbolt12_unsigned\fR (string): the bolt12 encoding of the offer, without a signature -.IP \[bu] -\fBused\fR (boolean): True if an associated invoice has been paid -.IP \[bu] -\fBcreated\fR (boolean): false if the offer already existed -.IP \[bu] -\fBlabel\fR (string, optional): the (optional) user-specified label - -.RE - -On failure, an error is returned and no offer is created\. If the -lightning process fails before responding, the caller should use -\fBlightning-listoffers\fR(7) to query whether this offer was created or -not\. - - -If the offer already existed, and is still active, that is returned; -if it's not active then this call fails\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -1000: Offer with this offer_id already exists (but is not active)\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-offerout\fR(7), \fBlightning-listoffers\fR(7), \fBlightning-disableoffer\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:caa067d4f2b43e99445f165545fe98593402fbb6f10d939067ed2bc963e3fdc3 diff --git a/doc/lightning-offerout.7 b/doc/lightning-offerout.7 deleted file mode 100644 index 54a39a91f..000000000 --- a/doc/lightning-offerout.7 +++ /dev/null @@ -1,118 +0,0 @@ -.TH "LIGHTNING-OFFEROUT" "7" "" "" "lightning-offerout" -.SH NAME -lightning-offerout - Command for offering payments -.SH SYNOPSIS - -\fB(WARNING: experimental-offers only)\fR - - -\fBofferout\fR \fIamount\fR \fIdescription\fR [\fIvendor\fR] [\fIlabel\fR] [\fIabsolute_expiry\fR] [\fIrefund_for\fR] - -.SH DESCRIPTION - -The \fBofferout\fR RPC command creates an offer, which is a request to -send an invoice for us to pay (technically, this is referred to as a -\fBsend_invoice\fR offer to distinguish a normal \fBlightningd-offer\fR(7) -offer)\. It automatically enables the accepting and payment of -corresponding invoice message (we will only pay once, however!)\. - - -Note that it creates two variants of the offer: a signed and an -unsigned one (which is smaller)\. Wallets should accept both: the -current specification allows either\. - - -The \fIamount\fR parameter can be the string "any", which creates an offer -that can be paid with any amount (e\.g\. a donation)\. Otherwise it can -be a positive value in millisatoshi precision; it can be a whole -number, or a whole number ending in \fImsat\fR or \fIsat\fR, or a number with -three decimal places ending in \fIsat\fR, or a number with 1 to 11 decimal -places ending in \fIbtc\fR\. - - -The \fIdescription\fR is a short description of purpose of the offer, -e\.g\. \fIwithdrawl from ATM\fR\. This value is encoded into the resulting offer and is -viewable by anyone you expose this offer to\. It must be UTF-8, and -cannot use \fI\u\fR JSON escape codes\. - - -The \fIvendor\fR is another (optional) field exposed in the offer, and -reflects who is issuing this offer (i\.e\. you) if appropriate\. - - -The \fIlabel\fR field is an internal-use name for the offer, which can -be any UTF-8 string\. - - -The \fIabsolute_expiry\fR is optionally the time the offer is valid until, -in seconds since the first day of 1970 UTC\. If not set, the offer -remains valid (though it can be deactivated by the issuer of course)\. -This is encoded in the offer\. - - -\fIrefund_for\fR is a previous (paid) invoice of ours\. The -payment_preimage of this is encoded in the offer, and redemption -requires that the invoice we receive contains a valid signature using -that previous \fBpayer_key\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBoffer_id\fR (hex): the id of this offer (merkle hash of non-signature fields) (always 64 characters) -.IP \[bu] -\fBactive\fR (boolean): whether this will pay a matching incoming invoice (always \fItrue\fR) -.IP \[bu] -\fBsingle_use\fR (boolean): whether this expires as soon as it's paid out (always \fItrue\fR) -.IP \[bu] -\fBbolt12\fR (string): the bolt12 encoding of the offer -.IP \[bu] -\fBbolt12_unsigned\fR (string): the bolt12 encoding of the offer, without a signature -.IP \[bu] -\fBused\fR (boolean): True if an incoming invoice has been paid (always \fIfalse\fR) -.IP \[bu] -\fBcreated\fR (boolean): false if the offer already existed -.IP \[bu] -\fBlabel\fR (string, optional): the (optional) user-specified label - -.RE - -On failure, an error is returned and no offer is created\. If the -lightning process fails before responding, the caller should use -\fBlightning-listoffers\fR(7) to query whether this offer was created or -not\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -1000: Offer with this offer_id already exists\. - -.RE -.SH NOTES - -The specification allows quantity, recurrence and alternate currencies on -offers which contain \fBsend_invoice\fR, but these are not implemented here\. - - -We could also allow multi-use offers, but usually you're only offering to -send money once\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-sendinvoice\fR(7), \fBlightning-offer\fR(7), \fBlightning-listoffers\fR(7), \fBlightning-disableoffer\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:375120b2e154a5421745b2e0ab0e4f869f375e68cdd78e42d4a6ff0343064b41 diff --git a/doc/lightning-openchannel_abort.7 b/doc/lightning-openchannel_abort.7 deleted file mode 100644 index 948e10b31..000000000 --- a/doc/lightning-openchannel_abort.7 +++ /dev/null @@ -1,63 +0,0 @@ -.TH "LIGHTNING-OPENCHANNEL_ABORT" "7" "" "" "lightning-openchannel_abort" -.SH NAME -lightning-openchannel_abort - Command to abort a channel to a peer -.SH SYNOPSIS - -\fBopenchannel_abort\fR \fIchannel_id\fR - -.SH DESCRIPTION - -\fBopenchannel_init\fR is a low level RPC command which initiates a channel -open with a specified peer\. It uses the openchannel protocol -which allows for interactive transaction construction\. - - -\fIchannel_id\fR is id of this channel\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBchannel_id\fR (hex): the channel id of the aborted channel (always 64 characters) -.IP \[bu] -\fBchannel_canceled\fR (boolean): whether this is completely canceled (there may be remaining in-flight transactions) -.IP \[bu] -\fBreason\fR (string): usually "Abort requested", but if it happened to fail at the same time it could be different - -.RE - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -311: Unknown channel id\. -.IP \[bu] -312: Channel in an invalid state - -.RE -.SH SEE ALSO - -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7), -lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBbump\fR(7), -lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7), -\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), -\fBlightning-multifundchannel\fR(7) - -.SH AUTHOR - -@niftynei \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:cb9f65567c0517ba63deb4afe1f6d625f83b13cfdfa422820ae36024d3a5a83f diff --git a/doc/lightning-openchannel_bump.7 b/doc/lightning-openchannel_bump.7 deleted file mode 100644 index 065506798..000000000 --- a/doc/lightning-openchannel_bump.7 +++ /dev/null @@ -1,100 +0,0 @@ -.TH "LIGHTNING-OPENCHANNEL_BUMP" "7" "" "" "lightning-openchannel_bump" -.SH NAME -lightning-openchannel_bump - Command to initiate a channel RBF -.SH SYNOPSIS - -\fBopenchannel_bump\fR \fIchannel_id\fR \fIamount\fR \fIinitalpsbt\fR [\fIfunding_feerate\fR] - -.SH DESCRIPTION - -\fBopenchannel_bump\fR is a RPC command which initiates a channel -RBF (Replace-By-Fee) for the specified channel\. It uses the openchannel protocol -which allows for interactive transaction construction\. - - -\fIid\fR is the id of the channel to RBF\. - - -\fIamount\fR is the satoshi value that we will contribute to the channel\. -This value will be \fIadded\fR to the provided PSBT in the output which is -encumbered by the 2-of-2 script for this channel\. - - -\fIinitialpsbt\fR is the funded, incomplete PSBT that specifies the UTXOs and -change output for our channel contribution\. It can be updated, -see \fBopenchannel_update\fR; \fIinitialpsbt\fR must have at least one input\. -Must have the Non-Witness UTXO (PSBT_IN_NON_WITNESS_UTXO) set for -every input\. An error (code 309) will be returned if this requirement -is not met\. - - -\fIfunding_feerate\fR is an optional field\. Sets the feerate for the -funding transaction\. Defaults to 1/64th greater than the last -feerate used for this channel\. - - -Warning: bumping a leased channel will lose the lease\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBchannel_id\fR (hex): the channel id of the channel (always 64 characters) -.IP \[bu] -\fBpsbt\fR (string): the (incomplete) PSBT of the RBF transaction -.IP \[bu] -\fBcommitments_secured\fR (boolean): whether the \fIpsbt\fR is complete (always \fIfalse\fR) -.IP \[bu] -\fBfunding_serial\fR (u64): the serial_id of the funding output in the \fIpsbt\fR - -.RE - -If the peer does not support \fBoption_dual_fund\fR, this command -will return an error\. - - -If the channel is not in a state that is eligible for RBF, this command -will return an error\. - - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -300: The amount exceeded the maximum configured funding amount\. -.IP \[bu] -301: The provided PSBT cannot afford the funding amount\. -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -309: PSBT missing required fields -.IP \[bu] -311: Unknown channel id\. -.IP \[bu] -312: Channel in an invalid state - -.RE -.SH SEE ALSO - -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7), -lightning-openchannel_\fBsigned\fR(7), lightning-openchannel_\fBabort\fR(7), -lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7), -\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), -\fBlightning-multifundchannel\fR(7) - -.SH AUTHOR - -@niftynei \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:eb53ca6e98a83063ac523123871b8bc32b0c9e60d0601d036883e7e7ee07177d diff --git a/doc/lightning-openchannel_init.7 b/doc/lightning-openchannel_init.7 deleted file mode 100644 index e24edf06d..000000000 --- a/doc/lightning-openchannel_init.7 +++ /dev/null @@ -1,127 +0,0 @@ -.TH "LIGHTNING-OPENCHANNEL_INIT" "7" "" "" "lightning-openchannel_init" -.SH NAME -lightning-openchannel_init - Command to initiate a channel to a peer -.SH SYNOPSIS - -\fBopenchannel_init\fR \fIid\fR \fIamount\fR \fIinitalpsbt\fR [\fIcommitment_feerate\fR] [\fIfunding_feerate\fR] [\fIannounce\fR] [\fIclose_to\fR] [\fIrequest_amt\fR] [\fIcompact_lease\fR] - -.SH DESCRIPTION - -\fBopenchannel_init\fR is a low level RPC command which initiates a channel -open with a specified peer\. It uses the openchannel protocol -which allows for interactive transaction construction\. - - -\fIid\fR is the node id of the remote peer\. - - -\fIamount\fR is the satoshi value that we will contribute to the channel\. -This value will be \fIadded\fR to the provided PSBT in the output which is -encumbered by the 2-of-2 script for this channel\. - - -\fIinitialpsbt\fR is the funded, incomplete PSBT that specifies the UTXOs and -change output for our channel contribution\. It can be updated, -see \fBopenchannel_update\fR; \fIinitialpsbt\fR must have at least one input\. -Must have the Non-Witness UTXO (PSBT_IN_NON_WITNESS_UTXO) set for -every input\. An error (code 309) will be returned if this requirement -is not met\. - - -\fIcommitment_feerate\fR is an optional field\. Sets the feerate for -commitment transactions: see \fBfundchannel\fR\. - - -\fIfunding_feerate\fR is an optional field\. Sets the feerate for the -funding transaction\. Defaults to 'opening' feerate\. - - -\fIannounce\fR is an optional field\. Whether or not to announce this channel\. - - -\fIclose_to\fR is a Bitcoin address to which the channel funds should be -sent on close\. Only valid if both peers have negotiated -\fBoption_upfront_shutdown_script\fR\. - - -\fIrequest_amt\fR is an amount of liquidity you'd like to lease from the peer\. -If peer supports \fBoption_will_fund\fR, indicates to them to include this -much liquidity into the channel\. Must also pass in \fIcompact_lease\fR\. - - -\fIcompact_lease\fR is a compact represenation of the peer's expected -channel lease terms\. If the peer's terms don't match this set, we will -fail to open the channel\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBchannel_id\fR (hex): the channel id of the channel (always 64 characters) -.IP \[bu] -\fBpsbt\fR (string): the (incomplete) PSBT of the funding transaction -.IP \[bu] -\fBcommitments_secured\fR (boolean): whether the \fIpsbt\fR is complete (always \fIfalse\fR) -.IP \[bu] -\fBfunding_serial\fR (u64): the serial_id of the funding output in the \fIpsbt\fR - -.RE - -If the peer does not support \fBoption_dual_fund\fR, this command -will return an error\. - - -If you sent a \fIrequest_amt\fR and the peer supports \fBoption_will_fund\fR and is -interested in leasing you liquidity in this channel, returns their updated -channel fee max (\fIchannel_fee_proportional_basis\fR, \fIchannel_fee_base_msat\fR), -updated rate card for the lease fee (\fIlease_fee_proportional_basis\fR, -\fIlease_fee_base_sat\fR) and their on-chain weight \fIweight_charge\fR, which will -be added to the lease fee at a rate of \fIfunding_feerate\fR \fI \fRweight_charge* -/ 1000\. - - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -300: The amount exceeded the maximum configured funding amount\. -.IP \[bu] -301: The provided PSBT cannot afford the funding amount\. -.IP \[bu] -304: Still syncing with bitcoin network -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -306: Unknown peer id\. -.IP \[bu] -309: PSBT missing required fields -.IP \[bu] -310: v2 channel open protocol not supported by peer -.IP \[bu] -312: Channel in an invalid state - -.RE -.SH SEE ALSO - -lightning-openchannel_\fBupdate\fR(7), lightning-openchannel_\fBsigned\fR(7), -lightning-openchannel_\fBabort\fR(7), lightning-openchannel_\fBbump\fR(7), -lightning-fundchannel_\fBstart\fR(7), -lightning-fundchannel_\fBcomplete\fR(7), \fBlightning-fundchannel\fR(7), -\fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), \fBlightning-multifundchannel\fR(7) - -.SH AUTHOR - -@niftynei \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:5aa606f1cfdd1de3c346bb010a5c8b8477908f4d70901db4f3b3e307ac387ffa diff --git a/doc/lightning-openchannel_signed.7 b/doc/lightning-openchannel_signed.7 deleted file mode 100644 index 9f4b06403..000000000 --- a/doc/lightning-openchannel_signed.7 +++ /dev/null @@ -1,81 +0,0 @@ -.TH "LIGHTNING-OPENCHANNEL_SIGNED" "7" "" "" "lightning-openchannel_signed" -.SH NAME -lightning-openchannel_signed - Command to conclude a channel open -.SH SYNOPSIS - -\fBopenchannel_signed\fR \fIchannel_id\fR \fIsigned_psbt\fR - -.SH DESCRIPTION - -\fBopenchannel_signed\fR is a low level RPC command which concludes a channel -open with the specified peer\. It uses the v2 openchannel protocol, which -allows for interactive transaction construction\. - - -This command should be called after \fBopenchannel_update\fR returns -\fIcommitments_secured\fR \fBtrue\fR\. - - -This command will broadcast the finalized funding transaction, -if we receive valid signatures from the peer\. - - -\fIchannel_id\fR is the id of the channel\. - - -\fIsigned_psbt\fR is the PSBT returned from \fBopenchannel_update\fR (where -\fIcommitments_secured\fR was true) with partial signatures or finalized -witness stacks included for every input that we contributed to the -PSBT\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBchannel_id\fR (hex): the channel id of the channel (always 64 characters) -.IP \[bu] -\fBtx\fR (hex): the funding transaction -.IP \[bu] -\fBtxid\fR (txid): The txid of the \fBtx\fR - -.RE - -On error, the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -303: Funding transaction broadcast failed\. -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -309: PSBT missing required fields\. -.IP \[bu] -311: Unknown channel id\. -.IP \[bu] -312: Channel in an invalid state - -.RE -.SH SEE ALSO - -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBupdate\fR(7), -lightning-openchannel_\fBabort\fR(7), lightning-openchannel_\fBbump\fR(7), -lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7), -\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), -\fBlightning-utxopsbt\fR(7), \fBlightning-multifundchannel\fR(7) - -.SH AUTHOR - -@niftynei \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:b41890ddae64449f218338b0d211358a3b6fb006cd11f2dc10adc7b7e660ee07 diff --git a/doc/lightning-openchannel_update.7 b/doc/lightning-openchannel_update.7 deleted file mode 100644 index 7868874ad..000000000 --- a/doc/lightning-openchannel_update.7 +++ /dev/null @@ -1,92 +0,0 @@ -.TH "LIGHTNING-OPENCHANNEL_UPDATE" "7" "" "" "lightning-openchannel_update" -.SH NAME -lightning-openchannel_update - Command to update a collab channel open -.SH SYNOPSIS - -\fBopenchannel_update\fR \fIchannel_id\fR \fIpsbt\fR - -.SH DESCRIPTION - -\fBopenchannel_update\fR is a low level RPC command which continues an open -channel, as specified by \fIchannel_id\fR\. An updated \fIpsbt\fR is passed in; any -changes from the PSBT last returned (either from \fBopenchannel_init\fR or -a previous call to \fBopenchannel_update\fR) will be communicated to the peer\. - - -Must be called after \fBopenchannel_init\fR and before \fBopenchannel_signed\fR\. - - -Must be called until \fIcommitments_secured\fR is returned as true, at which point -\fBopenchannel_signed\fR should be called with a signed version of the PSBT -returned by the last call to \fBopenchannel_update\fR\. - - -\fIchannel_id\fR is the id of the channel\. - - -\fIpsbt\fR is the updated PSBT to be sent to the peer\. May be identical to -the PSBT last returned by either \fBopenchannel_init\fR or \fBopenchannel_update\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBchannel_id\fR (hex): the channel id of the channel (always 64 characters) -.IP \[bu] -\fBpsbt\fR (string): the PSBT of the funding transaction -.IP \[bu] -\fBcommitments_secured\fR (boolean): whether the \fIpsbt\fR is complete (if true, sign \fIpsbt\fR and call \fBopenchannel_signed\fR to complete the channel open) -.IP \[bu] -\fBfunding_outnum\fR (u32): The index of the funding output in the psbt -.IP \[bu] -\fBclose_to\fR (hex, optional): scriptPubkey which we have to close to if we mutual close - -.RE - -If \fIcommitments_secured\fR is true, will also return: - -.RS -.IP \[bu] -The derived \fIchannel_id\fR\. -.IP \[bu] -A \fIclose_to\fR script, iff a \fBclose_to\fR address was provided to -\fBopenchannel_init\fR and the peer supports \fBoption_upfront_shutdownscript\fR\. -.IP \[bu] -The \fIfunding_outnum\fR, the index of the funding output for this channel -in the funding transaction\. - -.RE -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -305: Peer is not connected\. -.IP \[bu] -309: PSBT missing required fields -.IP \[bu] -311: Unknown channel id\. -.IP \[bu] -312: Channel in an invalid state - -.RE -.SH SEE ALSO - -lightning-openchannel_\fBinit\fR(7), lightning-openchannel_\fBsigned\fR(7), -lightning-openchannel_\fBbump\fR(7), lightning-openchannel_\fBabort\fR(7), -lightning-fundchannel_\fBstart\fR(7), lightning-fundchannel_\fBcomplete\fR(7), -\fBlightning-fundchannel\fR(7), \fBlightning-fundpsbt\fR(7), \fBlightning-utxopsbt\fR(7), -\fBlightning-multifundchannel\fR(7) - -.SH AUTHOR - -@niftynei \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:1fefdbe12a003eb46b52eeb0947ebb23f1c92e450b2452fd29c8e0e6a4386f4b diff --git a/doc/lightning-parsefeerate.7 b/doc/lightning-parsefeerate.7 deleted file mode 100644 index 1945e109b..000000000 --- a/doc/lightning-parsefeerate.7 +++ /dev/null @@ -1,44 +0,0 @@ -.TH "LIGHTNING-PARSEFEERATE" "7" "" "" "lightning-parsefeerate" -.SH NAME -lightning-parsefeerate - Command for parsing a feerate string to a feerate -.SH SYNOPSIS - -\fBparsefeerate\fR \fIfeerate_str\fR - -.SH DESCRIPTION - -The \fBparsefeerate\fR command returns the current feerate for any valid -\fIfeerate_str\fR\. This is useful for finding the current feerate that a -\fBfundpsbt\fR or \fButxopsbt\fR command might use\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBperkw\fR (u32, optional): Value of \fIfeerate_str\fR in kilosipa - -.RE -.SH ERRORS - -The \fBparsefeerate\fR command will error if the \fIfeerate_str\fR format is -not recognized\. - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. - -.RE -.SH TRIVIA - -In C-lightning we like to call the weight unit "sipa" -in honor of Pieter Wuille, -who uses the name "sipa" on IRC and elsewhere\. -Internally we call the \fIperkw\fR style as "feerate per kilosipa"\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:f2ab6dcbc7dcb19dde468e243a1d236d96d48e3f175282b7a92c9fff6cbbaa14 diff --git a/doc/lightning-pay.7 b/doc/lightning-pay.7 deleted file mode 100644 index 3ee01d564..000000000 --- a/doc/lightning-pay.7 +++ /dev/null @@ -1,185 +0,0 @@ -.TH "LIGHTNING-PAY" "7" "" "" "lightning-pay" -.SH NAME -lightning-pay - Command for sending a payment to a BOLT11 invoice -.SH SYNOPSIS - -\fBpay\fR \fIbolt11\fR [\fImsatoshi\fR] [\fIlabel\fR] [\fIriskfactor\fR] -[\fImaxfeepercent\fR] [\fIretry_for\fR] [\fImaxdelay\fR] [\fIexemptfee\fR] - -.SH DESCRIPTION - -The \fBpay\fR RPC command attempts to find a route to the given -destination, and send the funds it asks for\. If the \fIbolt11\fR does not -contain an amount, \fImsatoshi\fR is required, otherwise if it is specified -it must be \fInull\fR\. \fImsatoshi\fR is in millisatoshi precision; it can be a -whole number, or a whole number with suffix \fImsat\fR or \fIsat\fR, or a three -decimal point number with suffix \fIsat\fR, or an 1 to 11 decimal point -number suffixed by \fIbtc\fR\. - - -(Note: if \fBexperimental-offers\fR is enabled, \fIbolt11\fR can actually be -a bolt12 invoice, such as one received from \fBlightningd-fetchinvoice\fR(7))\. - - -The \fIlabel\fR field is used to attach a label to payments, and is returned -in \fBlightning-listpays\fR(7) and \fBlightning-listsendpays\fR(7)\. The \fIriskfactor\fR -is described in detail in \fBlightning-getroute\fR(7), and defaults to 10\. The -\fImaxfeepercent\fR limits the money paid in fees, and defaults to 0\.5\. The -\fBmaxfeepercent\fR is a percentage of the amount that is to be paid\. The \fBexemptfee\fR -option can be used for tiny payments which would be dominated by the fee -leveraged by forwarding nodes\. Setting \fBexemptfee\fR allows the -\fBmaxfeepercent\fR check to be skipped on fees that are smaller than -\fBexemptfee\fR (default: 5000 millisatoshi)\. - - -The response will occur when the payment fails or succeeds\. Once a -payment has succeeded, calls to \fBpay\fR with the same \fIbolt11\fR will -succeed immediately\. - - -Until \fIretry_for\fR seconds passes (default: 60), the command will keep -finding routes and retrying the payment\. However, a payment may be -delayed for up to \fBmaxdelay\fR blocks by another node; clients should be -prepared for this worst case\. - - -When using \fIlightning-cli\fR, you may skip optional parameters by using -\fInull\fR\. Alternatively, use \fB-k\fR option to provide parameters by name\. - -.SH RANDOMIZATION - -To protect user privacy, the payment algorithm performs some -randomization\. - - -1: Route Randomization - - -Route randomization means the payment algorithm does not always use the -lowest-fee or shortest route\. This prevents some highly-connected node -from learning all of the user payments by reducing their fees below the -network average\. - - -2: Shadow Route - - -Shadow route means the payment algorithm will virtually extend the route -by adding delays and fees along it, making it appear to intermediate nodes -that the route is longer than it actually is\. This prevents intermediate -nodes from reliably guessing their distance from the payee\. - - -Route randomization will never exceed \fImaxfeepercent\fR of the payment\. -Route randomization and shadow routing will not take routes that would -exceed \fImaxdelay\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBpayment_preimage\fR (hex): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBcreated_at\fR (number): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBparts\fR (u32): how many attempts this took -.IP \[bu] -\fBamount_msat\fR (msat): Amount the recipient received -.IP \[bu] -\fBamount_sent_msat\fR (msat): Total amount we sent (including fees) -.IP \[bu] -\fBstatus\fR (string): status of payment (always "complete") -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment - -.RE - -The following warnings may also be returned: - -.RS -.IP \[bu] -\fBwarning_partial_completion\fR: Not all parts of a multi-part payment have completed - -.RE - -You can monitor the progress and retries of a payment using the -\fBlightning-paystatus\fR(7) command\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -201: Already paid with this \fIhash\fR using different amount or -destination\. -.IP \[bu] -203: Permanent failure at destination\. The \fIdata\fR field of the error -will be routing failure object\. -.IP \[bu] -205: Unable to find a route\. -.IP \[bu] -206: Route too expensive\. Either the fee or the needed total -locktime for the route exceeds your \fImaxfeepercent\fR or \fImaxdelay\fR -settings, respectively\. The \fIdata\fR field of the error will indicate -the actual \fIfee\fR as well as the \fIfeepercent\fR percentage that the fee -has of the destination payment amount\. It will also indicate the -actual \fIdelay\fR along the route\. -.IP \[bu] -207: Invoice expired\. Payment took too long before expiration, or -already expired at the time you initiated payment\. The \fIdata\fR field -of the error indicates \fInow\fR (the current time) and \fIexpiry\fR (the -invoice expiration) as UNIX epoch time in seconds\. -.IP \[bu] -210: Payment timed out without a payment in progress\. - -.RE - -Error codes 202 and 204 will only get reported at \fBsendpay\fR; in -\fBpay\fR we will keep retrying if we would have gotten those errors\. - - -A routing failure object has the fields below: - -.RS -.IP \[bu] -\fIerring_index\fR: The index of the node along the route that reported -the error\. 0 for the local node, 1 for the first hop, and so on\. -.IP \[bu] -\fIerring_node\fR: The hex string of the pubkey id of the node that -reported the error\. -.IP \[bu] -\fIerring_channel\fR: The short channel ID of the channel that has the -error, or \fI0:0:0\fR if the destination node raised the error\. -.IP \[bu] -\fIfailcode\fR: The failure code, as per BOLT #4\. -.IP \[bu] -\fIchannel_update\fR\. The hex string of the \fIchannel_update\fR message -received from the remote node\. Only present if error is from the -remote node and the \fIfailcode\fR has the UPDATE bit set, as per BOLT #4\. - -.RE - -The \fIdata\fR field of errors will include statistics \fIgetroute_tries\fR and -\fIsendpay_tries\fR\. It will also contain a \fIfailures\fR field with detailed -data about routing errors\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listpays\fR(7), \fBlightning-decodepay\fR(7), \fBlightning-listinvoice\fR(7), -\fBlightning-delinvoice\fR(7), \fBlightning-getroute\fR(7), \fBlightning-invoice\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:be8510fe40dfd6ed80effab84c777b43879dfccdef6c7aef8a29697f385a07ed diff --git a/doc/lightning-ping.7 b/doc/lightning-ping.7 deleted file mode 100644 index 9761250e0..000000000 --- a/doc/lightning-ping.7 +++ /dev/null @@ -1,73 +0,0 @@ -.TH "LIGHTNING-PING" "7" "" "" "lightning-ping" -.SH NAME -lightning-ping - Command to check if a node is up\. -.SH SYNOPSIS - -\fBping\fR \fIid\fR [len] [pongbytes] - -.SH DESCRIPTION - -The \fBping\fR command checks if the node with \fIid\fR is ready to talk\. It accepts the following parameters: - -.RS -.IP \[bu] -\fIid\fR: A string that represents the node id; -.IP \[bu] -\fIlen\fR: A integer that represents the length of the ping (default 128); -.IP \[bu] -\fIpongbytes\fR: An integer that represents the length of the reply (default 128)\. - -.RE -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "ping", - "params": { - "len": 128, - "pongbytes": 128 - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtotlen\fR (u16): the answer length of the reply message (including header: 0 means no reply expected) - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters or unknown peer\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "totlen": 132 -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -\fBlightning-connect\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:8d8c540f082ae2c5444b246ede1b32c6b29861c1d84dc1850ae7e64b2466f4b6 diff --git a/doc/lightning-plugin.7 b/doc/lightning-plugin.7 deleted file mode 100644 index 3826ba174..000000000 --- a/doc/lightning-plugin.7 +++ /dev/null @@ -1,83 +0,0 @@ -.TH "LIGHTNING-PLUGIN" "7" "" "" "lightning-plugin" -.SH NAME -lightning-plugin - Manage plugins with RPC -.SH SYNOPSIS - -\fBplugin\fR command [parameter] [second_parameter] - -.SH DESCRIPTION - -The \fBplugin\fR RPC command allows to manage plugins without having to -restart lightningd\. It takes 1 to 3 parameters: a command -(start/stop/startdir/rescan/list) which describes the action to take and -optionally one or two parameters which describes the plugin on which the -action has to be taken\. - - -The \fIstart\fR command takes a path as the first parameter and will load -the plugin available from this path\. Any additional parameters are -passed to the plugin\. It will wait for the plugin to complete the -handshake with \fBlightningd\fR for 20 seconds at the most\. - - -The \fIstop\fR command takes a plugin name as parameter\. It will kill and -unload the specified plugin\. - - -The \fIstartdir\fR command takes a directory path as first parameter and will -load all plugins this directory contains\. It will wait for each plugin to -complete the handshake with \fBlightningd\fR for 20 seconds at the most\. - - -The \fIrescan\fR command starts all not-already-loaded plugins from the -default plugins directory (by default \fI~/\.lightning/plugins\fR)\. - - -The \fIlist\fR command will return all the active plugins\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBcommand\fR (string): the subcommand this is responding to (one of "start", "stop", "rescan", "startdir", "list") - -.RE - -If \fBcommand\fR is "start", "startdir", "rescan" or "list": - -.RS -.IP \[bu] -\fBplugins\fR (array of objects): -.RS -.IP \[bu] -\fBname\fR (string): full pathname of the plugin -.IP \[bu] -\fBactive\fR (boolean): status; since plugins are configured asynchronously, a freshly started plugin may not appear immediately\. - -.RE - - -.RE - -If \fBcommand\fR is "stop": - -.RS -.IP \[bu] -\fBresult\fR (string): A message saying it successfully stopped - -.RE - -On error, the reason why the action could not be taken upon the -plugin is returned\. - -.SH AUTHOR - -Antoine Poinsot \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:27dda2bc4ba10a2965bd0b96f5e90d96303c34fb87f40c35ab3dbdd6eddacfa7 diff --git a/doc/lightning-reserveinputs.7 b/doc/lightning-reserveinputs.7 deleted file mode 100644 index 9f27c4124..000000000 --- a/doc/lightning-reserveinputs.7 +++ /dev/null @@ -1,81 +0,0 @@ -.TH "LIGHTNING-RESERVEINPUTS" "7" "" "" "lightning-reserveinputs" -.SH NAME -lightning-reserveinputs - Construct a transaction and reserve the UTXOs it spends -.SH SYNOPSIS - -\fBreserveinputs\fR \fIpsbt\fR [\fIexclusive\fR] [\fIreserve\fR] - -.SH DESCRIPTION - -The \fBreserveinputs\fR RPC command places (or increases) reservations on any -inputs specified in \fIpsbt\fR which are known to lightningd\. It will fail -with an error if any of the inputs are known to be spent, and ignore inputs -which are unknown\. - - -Normally the command will fail (with no reservations made) if an input -is already reserved\. If \fIexclusive\fR is set to \fIFalse\fR, then existing -reservations are simply extended, rather than causing failure\. - - -By default, reservations are for the next 72 blocks (approximately 6 -hours), but this can be changed by setting \fIreserve\fR\. - -.SH RETURN VALUE - -On success, an object containing \fBreservations\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBtxid\fR (txid): the transaction id -.IP \[bu] -\fBvout\fR (u32): the output number which was reserved -.IP \[bu] -\fBwas_reserved\fR (boolean): whether the input was already reserved -.IP \[bu] -\fBreserved\fR (boolean): whether the input is now reserved (always \fItrue\fR) -.IP \[bu] -\fBreserved_to_block\fR (u32): what blockheight the reservation will expire - -.RE - -On success, a \fIreservations\fR array is returned, with an entry for each input -which was reserved: - -.RS -.IP \[bu] -\fItxid\fR is the input transaction id\. -.IP \[bu] -\fIvout\fR is the input index\. -.IP \[bu] -\fIwas_reserved\fR indicates whether the input was already reserved\. -.IP \[bu] -\fIreserved\fR indicates that the input is now reserved (i\.e\. true)\. -.IP \[bu] -\fIreserved_to_block\fR indicates what blockheight the reservation will expire\. - -.RE - -On failure, an error is reported and no UTXOs are reserved\. - - -The following error codes may occur: - -.RS -.IP \[bu] --32602: Invalid parameter, such as specifying a spent/reserved input in \fIpsbt\fR\. - -.RE -.SH AUTHOR - -niftynei \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-unreserveinputs\fR(7), \fBlightning-signpsbt\fR(7), \fBlightning-sendpsbt\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:2bfe105517873caed097f1ec009dfda2ecfb561d57b2f31208a7e12a4645ee5e diff --git a/doc/lightning-sendcustommsg.7 b/doc/lightning-sendcustommsg.7 deleted file mode 100644 index 4e7448cdb..000000000 --- a/doc/lightning-sendcustommsg.7 +++ /dev/null @@ -1,71 +0,0 @@ -.TH "LIGHTNING-SENDCUSTOMMSG" "7" "" "" "lightning-sendcustommsg" -.SH NAME -lightning-sendcustommsg - Low-level interface to send protocol messages to peers -.SH SYNOPSIS - -\fBsendcustommsg\fR \fInode_id\fR \fImsg\fR - -.SH DESCRIPTION - -The \fBsendcustommsg\fR RPC method allows the user to inject a custom message -into the communication with the peer with the given \fBnode_id\fR\. This is -intended as a low-level interface to implement custom protocol extensions on -top, not for direct use by end-users\. - - -The message must be a hex encoded well-formed message, including the 2-byte -type prefix, but excluding the length prefix which will be added by the RPC -method\. The messages must not use even-numbered types, since these may require -synchronous handling on the receiving side, and can cause the connection to be -dropped\. The message types may also not use one of the internally handled -types, since that may cause issues with the internal state tracking of -c-lightning\. - - -The node specified by \fBnode_id\fR must be a peer, i\.e\., it must have a direct -connection with the node receiving the RPC call, and the connection must be -established\. For a method to send arbitrary messages over multiple hops, -including hops that do not understand the custom message, see the -\fBcreateonion\fR and \fBsendonion\fR RPC methods\. Messages can only be injected if -the connection is handled by \fBopeningd\fR or \fBchanneld\fR\. Messages cannot be -injected when the peer is handled by \fBonchaind\fR or \fBclosingd\fR since these do -not have a connection, or are synchronous daemons that do not handle -spontaneous messages\. - - -On the reveiving end a plugin may implement the \fBcustommsg\fR plugin hook and -get notified about incoming messages\. - -.SH RETURN VALUE - -The method will validate the arguments and queue the message for delivery -through the daemon that is currently handling the connection\. Queuing provides -best effort guarantees and the message may not be delivered if the connection -is terminated while the message is queued\. The RPC method will return as soon -as the message is queued\. - - -If any of the above limitations is not respected the method returns an -explicit error message stating the issue\. - - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBstatus\fR (string): Information about where message was queued - -.RE -.SH AUTHOR - -Christian Decker \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-createonion\fR(7), \fBlightning-sendonion\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:d23b71ad2b8eaa6fc99d4871054a9ebdc1e9592d4d9538e1d2bc5705d64b83fd diff --git a/doc/lightning-sendinvoice.7 b/doc/lightning-sendinvoice.7 deleted file mode 100644 index 8d292d25e..000000000 --- a/doc/lightning-sendinvoice.7 +++ /dev/null @@ -1,106 +0,0 @@ -.TH "LIGHTNING-SENDINVOICE" "7" "" "" "lightning-sendinvoice" -.SH NAME -lightning-sendinvoice - Command for send an invoice for an offer -.SH SYNOPSIS - -\fB(WARNING: experimental-offers only)\fR - - -\fBsendinvoice\fR \fIoffer\fR \fIlabel\fR [\fImsatoshi\fR] [\fItimeout\fR] [\fIquantity\fR] - -.SH DESCRIPTION - -The \fBsendinvoice\fR RPC command creates and sends an invoice to the -issuer of an \fIoffer\fR for it to pay: the offer must contain -\fIsend_invoice\fR; see \fBlightning-fetchinvoice\fR(7)\. - - -If \fBfetchinvoice-noconnect\fR is not specified in the configuation, it -will connect to the destination in the (currently common!) case where it -cannot find a route which supports \fBoption_onion_messages\fR\. - - -\fIoffer\fR is the bolt12 offer string beginning with "lno1"\. - - -\fIlabel\fR is the unique label to use for this invoice\. - - -\fImsatoshi\fR is optional: it is required if the \fIoffer\fR does not specify -an amount at all, or specifies it in a different currency\. Otherwise -you may set it (e\.g\. to provide a tip), and if not it defaults to the -amount contained in the offer (multiplied by \fIquantity\fR if any)\. - - -\fItimeout\fR is how many seconds to wait for the offering node to pay the -invoice or return an error, default 90 seconds\. This will also be the -timeout on the invoice that is sent\. - - -\fIquantity\fR is optional: it is required if the \fIoffer\fR specifies -\fIquantity_min\fR or \fIquantity_max\fR, otherwise it is not allowed\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBlabel\fR (string): unique label supplied at invoice creation -.IP \[bu] -\fBdescription\fR (string): description used in the invoice -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): Whether it's paid, unpaid or unpayable (one of "unpaid", "paid", "expired") -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp of when it will become / became unpayable -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount required to pay this invoice -.IP \[bu] -\fBbolt12\fR (string, optional): the BOLT12 string - -.RE - -If \fBstatus\fR is "paid": - -.RS -.IP \[bu] -\fBpay_index\fR (u64): Unique incrementing index for this payment -.IP \[bu] -\fBamount_received_msat\fR (msat): the amount actually received (could be slightly greater than \fIamount_msat\fR, since clients may overpay) -.IP \[bu] -\fBpaid_at\fR (u64): UNIX timestamp of when it was paid -.IP \[bu] -\fBpayment_preimage\fR (hex): proof of payment (always 64 characters) - -.RE - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -1002: Offer has expired\. -.IP \[bu] -1003: Cannot find a route to the node making the offer\. -.IP \[bu] -1004: The node making the offer returned an error message\. -.IP \[bu] -1005: We timed out waiting for the invoice to be paid - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-fetchinvoice\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:c51a5986fea210df9fa9fc3a15ea5ed5384124a82efc7c5d2a46f2fb2303ce91 diff --git a/doc/lightning-sendonion.7 b/doc/lightning-sendonion.7 deleted file mode 100644 index 7e6e66db3..000000000 --- a/doc/lightning-sendonion.7 +++ /dev/null @@ -1,159 +0,0 @@ -.TH "LIGHTNING-SENDONION" "7" "" "" "lightning-sendonion" -.SH NAME -lightning-sendonion - Send a payment with a custom onion packet -.SH SYNOPSIS - -\fBsendonion\fR \fIonion\fR \fIfirst_hop\fR \fIpayment_hash\fR [\fIlabel\fR] [\fIshared_secrets\fR] [\fIpartid\fR] [\fIbolt11\fR] -[\fImsatoshi\fR] [\fIdestination\fR] - -.SH DESCRIPTION - -The \fBsendonion\fR RPC command can be used to initiate a payment attempt with a -custom onion packet\. The onion packet is used to deliver instructions for hops -along the route on how to behave\. Normally these instructions are indications -on where to forward a payment and what parameters to use, or contain details -of the payment for the final hop\. However, it is possible to add arbitrary -information for hops in the custom onion, allowing for custom extensions that -are not directly supported by c-lightning\. - - -The onion is specific to the route that is being used and the \fIpayment_hash\fR -used to construct, and therefore cannot be reused for other payments or to -attempt a separate route\. The custom onion can generally be created using the -\fBdevtools/onion\fR CLI tool, or the \fBcreateonion\fR RPC command\. - - -The \fIonion\fR parameter is a hex-encoded 1366 bytes long blob that was returned -by either of the tools that can generate onions\. It contains the payloads -destined for each hop and some metadata\. Please refer to \fBBOLT 04\fR (\fIhttps://github.com/lightningnetwork/lightning-rfc/blob/master/04-onion-routing.md\fR) for -further details\. - - -The \fIfirst_hop\fR parameter instructs c-lightning which peer to send the onion -to\. It is a JSON dictionary that corresponds to the first element of the route -array returned by \fIgetroute\fR\. The following is a minimal example telling -c-lightning to use any available channel to \fB022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59\fR -to add an HTLC for 1002 millisatoshis and a delay of 21 blocks on top of the current blockheight: - -.nf -.RS -{ - "id": "022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59", - "amount_msat": "1002msat", - "delay": 21, -} -.RE - -.fi - -The \fIpayment_hash\fR parameter specifies the 32 byte hex-encoded hash to use as -a challenge to the HTLC that we are sending\. It is specific to the onion and -has to match the one the onion was created with\. - - -The \fIlabel\fR parameter can be used to provide a human readable reference to -retrieve the payment at a later time\. - - -The \fIshared_secrets\fR parameter is a JSON list of 32 byte hex-encoded secrets -that were used when creating the onion\. c-lightning can send a payment with a -custom onion without the knowledge of these secrets, however it will not be -able to parse an eventual error message since that is encrypted with the -shared secrets used in the onion\. If \fIshared_secrets\fR is provided c-lightning -will decrypt the error, act accordingly, e\.g\., add a \fBchannel_update\fR included -in the error to its network view, and set the details in \fIlistsendpays\fR -correctly\. If it is not provided c-lightning will store the encrypted onion, -and expose it in \fIlistsendpays\fR allowing the caller to decrypt it -externally\. The following is an example of a 3 hop onion: - -.nf -.RS -[ - "298606954e9de3e9d938d18a74fed794c440e8eda82e52dc08600953c8acf9c4", - "2dc094de72adb03b90894192edf9f67919cb2691b37b1f7d4a2f4f31c108b087", - "a7b82b240dbd77a4ac8ea07709b1395d8c510c73c17b4b392bb1f0605d989c85" -] -.RE - -.fi - -If \fIshared_secrets\fR is not provided the c-lightning node does not know how -long the route is, which channels or nodes are involved, and what an eventual -error could have been\. It can therefore be used for oblivious payments\. - - -The \fIpartid\fR value, if provided and non-zero, allows for multiple parallel -partial payments with the same \fIpayment_hash\fR\. - - -The \fIbolt11\fR parameter, if provided, will be returned in -\fIwaitsendpay\fR and \fIlistsendpays\fR results\. - - -The \fIdestination\fR parameter, if provided, will be returned in \fBlistpays\fR result\. - - -The \fImsatoshi\fR parameter is used to annotate the payment, and is returned by -\fIwaitsendpay\fR and \fIlistsendpays\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBid\fR (u64): unique ID for this payment attempt -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): status of the payment (could be complete if already sent previously) (one of "pending", "complete") -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBamount_sent_msat\fR (msat): The amount sent -.IP \[bu] -\fBamount_msat\fR (msat, optional): The amount delivered to destination (if known) -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment if known -.IP \[bu] -\fBlabel\fR (string, optional): the label, if given to sendpay -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (if supplied) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string (if supplied: \fBexperimental-offers\fR only)\. - -.RE - -If \fBstatus\fR is "complete": - -.RS -.IP \[bu] -\fBpayment_preimage\fR (hex): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) - -.RE - -If \fBstatus\fR is "pending": - -.RS -.IP \[bu] -\fBmessage\fR (string, optional): Monitor status with listpays or waitsendpay - -.RE - -If \fIshared_secrets\fR was provided and an error was returned by one of the -intermediate nodes the error details are decrypted and presented -here\. Otherwise the error code is 202 for an unparseable onion\. - -.SH AUTHOR - -Christian Decker \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-createonion\fR(7), \fBlightning-sendpay\fR(7), \fBlightning-listsendpays\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:873193b166cc6bf6fc4981af7d8e30e91216293c59d7d31417c61f5cc12cd4f7 diff --git a/doc/lightning-sendonionmessage.7 b/doc/lightning-sendonionmessage.7 deleted file mode 100644 index b30b70a27..000000000 --- a/doc/lightning-sendonionmessage.7 +++ /dev/null @@ -1,45 +0,0 @@ -.TH "LIGHTNING-SENDONIONMESSAGE" "7" "" "" "lightning-sendonionmessage" -.SH NAME -lightning-sendonionmessage - low-level command to send an onion message -.SH SYNOPSIS - -\fB(WARNING: experimental-onion-messages only)\fR - - -\fBsendonionmessage\fR \fIhops\fR [\fIreply_path\fR] - -.SH DESCRIPTION - -The \fBsendonionmessage\fR RPC command can be used to send a message via -the lightning network\. These are currently used by \fIoffers\fR to request -and receive invoices\. - - -\fIhops\fR is an array of json objects: \fIid\fR as a public key of the node, -and either \fIrawtlv\fR containing a hexidecimal TLV to include, or any of -the fields \fIshort_channel_id\fR, \fIblinding\fR, \fIenctlv\fR, \fIinvoice\fR, -\fIinvoice_request\fR and \fIinvoice_error\fR to construct the onionmessage -TLV with\. - - -\fIreply_path\fR is a json object, containing a pubkey \fIblinding\fR, and an -array \fIpath\fR of objects containing \fIid\fR (a pubkey) and \fIenctlv\fR (a hex -value, optional for final element)\. - -.SH RETURN VALUE - -On success, an empty object is returned\. - -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-fetchinvoice\fR(7), \fBlightning-offer\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:171791a064eee48ee5e4a3c233071e3cbfb458ac20a860bea30523e1fd3712ac diff --git a/doc/lightning-sendpay.7 b/doc/lightning-sendpay.7 deleted file mode 100644 index 708fec526..000000000 --- a/doc/lightning-sendpay.7 +++ /dev/null @@ -1,170 +0,0 @@ -.TH "LIGHTNING-SENDPAY" "7" "" "" "lightning-sendpay" -.SH NAME -lightning-sendpay - Low-level command for sending a payment via a route -.SH SYNOPSIS - -\fBsendpay\fR \fIroute\fR \fIpayment_hash\fR [\fIlabel\fR] [\fImsatoshi\fR] -[\fIbolt11\fR] [\fIpayment_secret\fR] [\fIpartid\fR] - -.SH DESCRIPTION - -The \fBsendpay\fR RPC command attempts to send funds associated with the -given \fIpayment_hash\fR, along a route to the final destination in the -route\. - - -Generally, a client would call \fBlightning-getroute\fR(7) to resolve a route, -then use \fBsendpay\fR to send it\. If it fails, it would call -\fBlightning-getroute\fR(7) again to retry\. - - -The response will occur when the payment is on its way to the -destination\. The \fBsendpay\fR RPC command does not wait for definite -success or definite failure of the payment\. Instead, use the -\fBwaitsendpay\fR RPC command to poll or wait for definite success or -definite failure\. - - -The \fIlabel\fR and \fIbolt11\fR parameters, if provided, will be returned in -\fIwaitsendpay\fR and \fIlistsendpays\fR results\. - - -The \fImsatoshi\fR amount must be provided if \fIpartid\fR is non-zero, otherwise -it must be equal to the final -amount to the destination\. By default it is in millisatoshi precision; it can be a whole number, or a whole number -ending in \fImsat\fR or \fIsat\fR, or a number with three decimal places ending -in \fIsat\fR, or a number with 1 to 11 decimal places ending in \fIbtc\fR\. - - -The \fIpayment_secret\fR is the value that the final recipient requires to -accept the payment, as defined by the \fBpayment_data\fR field in BOLT 4 -and the \fBs\fR field in the BOLT 11 invoice format\. It is required if -\fIpartid\fR is non-zero\. - - -The \fIpartid\fR value, if provided and non-zero, allows for multiple parallel -partial payments with the same \fIpayment_hash\fR\. The \fImsatoshi\fR amount -(which must be provided) for each \fBsendpay\fR with matching -\fIpayment_hash\fR must be equal, and \fBsendpay\fR will fail if there are -already \fImsatoshi\fR worth of payments pending\. - - -Once a payment has succeeded, calls to \fBsendpay\fR with the same -\fIpayment_hash\fR but a different \fImsatoshi\fR or destination will fail; -this prevents accidental multiple payments\. Calls to \fBsendpay\fR with -the same \fIpayment_hash\fR, \fImsatoshi\fR, and destination as a previous -successful payment (even if a different route or \fIpartid\fR) will return immediately -with success\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBid\fR (u64): unique ID for this payment attempt -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): status of the payment (could be complete if already sent previously) (one of "pending", "complete") -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBamount_sent_msat\fR (msat): The amount sent -.IP \[bu] -\fBamount_msat\fR (msat, optional): The amount delivered to destination (if known) -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment if known -.IP \[bu] -\fBlabel\fR (string, optional): the \fIlabel\fR, if given to sendpay -.IP \[bu] -\fBpartid\fR (u64, optional): the \fIpartid\fR, if given to sendpay -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (if supplied) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string (if supplied: \fBexperimental-offers\fR only)\. - -.RE - -If \fBstatus\fR is "complete": - -.RS -.IP \[bu] -\fBpayment_preimage\fR (hex): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) - -.RE - -If \fBstatus\fR is "pending": - -.RS -.IP \[bu] -\fBmessage\fR (string): Monitor status with listpays or waitsendpay - -.RE - -On error, if the error occurred from a node other than the final -destination, the route table will be updated so that -\fBlightning-getroute\fR(7) should return an alternate route (if any)\. An -error from the final destination implies the payment should not be -retried\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -201: Already paid with this \fIhash\fR using different amount or -destination\. -.IP \[bu] -202: Unparseable onion reply\. The \fIdata\fR field of the error will -have an \fIonionreply\fR field, a hex string representation of the raw -onion reply\. -.IP \[bu] -203: Permanent failure at destination\. The \fIdata\fR field of the error -will be routing failure object\. -.IP \[bu] -204: Failure along route; retry a different route\. The \fIdata\fR field -of the error will be routing failure object\. - -.RE - -A routing failure object has the fields below: - -.RS -.IP \[bu] -\fIerring_index\fR\. The index of the node along the route that reported -the error\. 0 for the local node, 1 for the first hop, and so on\. -.IP \[bu] -\fIerring_node\fR\. The hex string of the pubkey id of the node that -reported the error\. -.IP \[bu] -\fIerring_channel\fR\. The short channel ID of the channel that has -the error, or \fI0:0:0\fR if the destination node raised the error\. In -addition \fIerring_direction\fR will indicate which direction of the -channel caused the failure\. -.IP \[bu] -\fIfailcode\fR\. The failure code, as per BOLT #4\. -.IP \[bu] -\fIchannel_update\fR\. The hex string of the \fIchannel_update\fR message -received from the remote node\. Only present if error is from the -remote node and the \fIfailcode\fR has the UPDATE bit set, as per BOLT -#4\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listinvoice\fR(7), \fBlightning-delinvoice\fR(7), -\fBlightning-getroute\fR(7), \fBlightning-invoice\fR(7), \fBlightning-pay\fR(7), -\fBlightning-waitsendpay\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:5abab6ab51d61c0a4222f73abc40951b67ca466fca7c05f59507ca1246bfc525 diff --git a/doc/lightning-sendpsbt.7 b/doc/lightning-sendpsbt.7 deleted file mode 100644 index 42e672f6d..000000000 --- a/doc/lightning-sendpsbt.7 +++ /dev/null @@ -1,73 +0,0 @@ -.TH "LIGHTNING-SENDPSBT" "7" "" "" "lightning-sendpsbt" -.SH NAME -lightning-sendpsbt - Command to finalize, extract and send a partially signed bitcoin transaction (PSBT)\. -.SH SYNOPSIS - -\fBsendpsbt\fR \fIpsbt\fR [\fIreserve\fR] - -.SH DESCRIPTION - -The \fBsendpsbt\fR is a low-level RPC command which sends a fully-signed PSBT\. - -.RS -.IP \[bu] -\fIpsbt\fR: A string that represents psbt value\. -.IP \[bu] -\fIreserve\fR: an optional number of blocks to increase reservation of any of our inputs by; default is 72\. - -.RE -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "sendpsbt", - "params": { - "psbt": "some_psbt" - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtx\fR (hex): The raw transaction which was sent -.IP \[bu] -\fBtxid\fR (txid): The txid of the \fBtx\fR - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters or some error happened during the command process\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "txid": "05985072bbe20747325e69a159fe08176cc1bbc96d25e8848edad2dddc1165d0", - "tx": "02000000027032912651fc25a3e0893acd5f9640598707e2dfef92143bb5a4020e335442800100000017160014a5f48b9aa3cb8ca6cc1040c11e386745bb4dc932ffffffffd229a4b4f78638ebcac10a68b0561585a5d6e4d3b769ad0a909e9b9afaeae24e00000000171600145c83da9b685f9142016c6f5eb5f98a45cfa6f686ffffffff01915a01000000000017a9143a4dfd59e781f9c3018e7d0a9b7a26d58f8d22bf8700000000", -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -\fBlightning-fundpsbt\fR(7), \fBlightning-signpsbt\fR(7), \fBlightning-listtransactions\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:3f2cda2e8b3a13f457bcccd2480a3bd79f64f6b70221bd7eb4c28d04c51d0e2b diff --git a/doc/lightning-setchannelfee.7 b/doc/lightning-setchannelfee.7 deleted file mode 100644 index df35ad074..000000000 --- a/doc/lightning-setchannelfee.7 +++ /dev/null @@ -1,86 +0,0 @@ -.TH "LIGHTNING-SETCHANNELFEE" "7" "" "" "lightning-setchannelfee" -.SH NAME -lightning-setchannelfee - Command for setting specific routing fees on a lightning channel -.SH SYNOPSIS - -\fBsetchannelfee\fR \fIid\fR [\fIbase\fR] [\fIppm\fR] - -.SH DESCRIPTION - -The \fBsetchannelfee\fR RPC command sets channel specific routing fees as -defined in BOLT #7\. The channel has to be in normal or awaiting state\. -This can be checked by \fBlistpeers\fR reporting a \fIstate\fR of -CHANNELD_NORMAL or CHANNELD_AWAITING_LOCKIN for the channel\. - - -\fIid\fR is required and should contain a scid (short channel ID), channel -id or peerid (pubkey) of the channel to be modified\. If \fIid\fR is set to -"all", the fees for all channels are updated that are in state -CHANNELD_NORMAL or CHANNELD_AWAITING_LOCKIN\. - - -\fIbase\fR is an optional value in millisatoshi that is added as base fee to -any routed payment\. If the parameter is left out, the global config -value fee-base will be used again\. It can be a whole number, or a whole -number ending in \fImsat\fR or \fIsat\fR, or a number with three decimal places -ending in \fIsat\fR, or a number with 1 to 11 decimal places ending in -\fIbtc\fR\. - - -\fIppm\fR is an optional value that is added proportionally per-millionths -to any routed payment volume in satoshi\. For example, if ppm is 1,000 -and 1,000,000 satoshi is being routed through the channel, an -proportional fee of 1,000 satoshi is added, resulting in a 0\.1% fee\. If -the parameter is left out, the global config value will be used again\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBbase\fR (u32): The fee_base_msat value -.IP \[bu] -\fBppm\fR (u32): The fee_proportional_millionths value -.IP \[bu] -\fBchannels\fR (array of objects): channel(s) whose rate is now set: -.RS -.IP \[bu] -\fBpeer_id\fR (pubkey): The node_id of the peer -.IP \[bu] -\fBchannel_id\fR (hex): The channel_id of the channel (always 64 characters) -.IP \[bu] -\fBshort_channel_id\fR (short_channel_id, optional): the short_channel_id (if locked in) - -.RE - - -.RE -.SH ERRORS - -The following error codes may occur: - -.RS -.IP \[bu] --1: Channel is in incorrect state, i\.e\. Catchall nonspecific error\. -.IP \[bu] --32602: JSONRPC2_INVALID_PARAMS, i\.e\. Given id is not a channel ID -or short channel ID\. - -.RE -.SH AUTHOR - -Michael Schmoock \fI is the author of this -feature\. Rusty Russell \fI is mainly -responsible for the c-lightning project\. - -.SH SEE ALSO - -\fBlightningd-config\fR(5), \fBlightning-fundchannel\fR(7), -\fBlightning-listchannels\fR(7), \fBlightning-listpeers\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:adc53b579ff0592bc35a6ccdbbf19f78241def679f48ae4eceeee39acc277857 diff --git a/doc/lightning-signmessage.7 b/doc/lightning-signmessage.7 deleted file mode 100644 index de7d3fade..000000000 --- a/doc/lightning-signmessage.7 +++ /dev/null @@ -1,43 +0,0 @@ -.TH "LIGHTNING-SIGNMESSAGE" "7" "" "" "lightning-signmessage" -.SH NAME -lightning-signmessage - Command to create a signature from this node -.SH SYNOPSIS - -\fBsignmessage\fR \fImessage\fR - -.SH DESCRIPTION - -The \fBsignmessage\fR RPC command creates a digital signature of -\fImessage\fR using this node's secret key\. A receiver who knows your -node's \fIid\fR and the \fImessage\fR can be sure that the resulting signature could -only be created by something with access to this node's secret key\. - - -\fImessage\fR must be less that 65536 characters\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBsignature\fR (hex): The signature (always 128 characters) -.IP \[bu] -\fBrecid\fR (hex): The recovery id (0, 1, 2 or 3) (always 2 characters) -.IP \[bu] -\fBzbase\fR (string): \fIsignature\fR and \fIrecid\fR encoded in a style compatible with \fBlnd\fR's \fBSignMessageRequest\fR (\fIhttps://api.lightning.community/#grpc-request-signmessagerequest\fR) - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-checkmessage\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:7ef4acf3cc994edafd0d97908a00fb14096de46fba13f2af87869a016c1fad1f diff --git a/doc/lightning-signpsbt.7 b/doc/lightning-signpsbt.7 deleted file mode 100644 index 43187c3af..000000000 --- a/doc/lightning-signpsbt.7 +++ /dev/null @@ -1,80 +0,0 @@ -.TH "LIGHTNING-SIGNPSBT" "7" "" "" "lightning-signpsbt" -.SH NAME -lightning-signpsbt - Command to sign a wallet's inputs on a provided bitcoin transaction (PSBT)\. -.SH SYNOPSIS - -\fBsignpsbt\fR \fIpsbt\fR [\fIsignonly\fR] - -.SH DESCRIPTION - -\fBsignpsbt\fR is a low-level RPC command which signs a PSBT as defined by -BIP-174\. - -.RS -.IP \[bu] -\fIpsbt\fR: A string that represents the PSBT value\. -.IP \[bu] -\fIsignonly\fR: An optional array of input numbers to sign\. - -.RE - -By default, all known inputs are signed, and others ignored: with -\fIsignonly\fR, only those inputs are signed, and an error is returned if -one of them cannot be signed\. - - -Note that the command will fail if there are no inputs to sign, or -if the inputs to be signed were not previously reserved\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "signpsbt", - "params": { - "psbt": "some_psbt" - } -} -.RE - -.fi -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBsigned_psbt\fR (string): The fully signed PSBT - -.RE - -On failure, one of the following error codes may be returned: - -.RS -.IP \[bu] --32602: Error in given parameters, or there aren't wallet's inputs to sign, or we couldn't sign all of \fIsignonly\fR, or inputs are not reserved\. - -.RE -.SH EXAMPLE JSON RESPONSE -.nf -.RS -{ - "psbt": "some_psbt" -} -.RE - -.fi -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH SEE ALSO - -\fBlightning-fundpsbt\fR(7), \fBlightning-sendpsbt\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:9da0e98fa79790764f4557c141eb5c0d359eaeda15e6c2b79662d63447f6f53e diff --git a/doc/lightning-stop.7 b/doc/lightning-stop.7 deleted file mode 100644 index ee5f7d69e..000000000 --- a/doc/lightning-stop.7 +++ /dev/null @@ -1,39 +0,0 @@ -.TH "LIGHTNING-STOP" "7" "" "" "lightning-stop" -.SH NAME -lightning-stop - Command to shutdown the c-lightning node\. -.SH SYNOPSIS - -\fBstop\fR - -.SH DESCRIPTION - -The \fBstop\fR is a RPC command to shut off the c-lightning node\. - -.SH EXAMPLE JSON REQUEST -.nf -.RS -{ - "id": 82, - "method": "stop", - "params": {} -} -.RE - -.fi -.SH RETURN VALUE - -On success, returns a single element (string) (always "Shutdown complete") - - -Once it has returned, the daemon has cleaned up completely, and if -desired may be restarted immediately\. - -.SH AUTHOR - -Vincenzo Palazzo \fI wrote the initial version of this man page, but many others did the hard work of actually implementing this rpc command\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:44b434290aefb260701a37230256ca295ddcede54ea8d83a6a1b5f32fa0df9f8 diff --git a/doc/lightning-txdiscard.7 b/doc/lightning-txdiscard.7 deleted file mode 100644 index 65bcefe7b..000000000 --- a/doc/lightning-txdiscard.7 +++ /dev/null @@ -1,49 +0,0 @@ -.TH "LIGHTNING-TXDISCARD" "7" "" "" "lightning-txdiscard" -.SH NAME -lightning-txdiscard - Abandon a transaction from txprepare, release inputs -.SH SYNOPSIS - -\fBtxdiscard\fR \fItxid\fR - -.SH DESCRIPTION - -The \fBtxdiscard\fR RPC command releases inputs which were reserved for -use of the \fItxid\fR from \fBlightning-txprepare\fR(7)\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBunsigned_tx\fR (hex): the unsigned transaction -.IP \[bu] -\fBtxid\fR (txid): the transaction id of \fIunsigned_tx\fR - -.RE - -If there is no matching \fItxid\fR, an error is reported\. Note that this may -happen due to incorrect usage, such as \fBtxdiscard\fR or \fBtxsend\fR -already being called for \fItxid\fR\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: An unknown \fItxid\fR\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-txprepare\fR(7), \fBlightning-txsend\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:7257c3119d49b4252aad8e03949c41a777ba5e94eb82db7c4a3ce576a157dc59 diff --git a/doc/lightning-txprepare.7 b/doc/lightning-txprepare.7 deleted file mode 100644 index fb39f44b7..000000000 --- a/doc/lightning-txprepare.7 +++ /dev/null @@ -1,100 +0,0 @@ -.TH "LIGHTNING-TXPREPARE" "7" "" "" "lightning-txprepare" -.SH NAME -lightning-txprepare - Command to prepare to withdraw funds from the internal wallet -.SH SYNOPSIS - -\fBtxprepare\fR \fIoutputs\fR [\fIfeerate\fR] [\fIminconf\fR] [\fIutxos\fR] - -.SH DESCRIPTION - -The \fBtxprepare\fR RPC command creates an unsigned transaction which -spends funds from c-lightning’s internal wallet to the outputs specified -in \fIoutputs\fR\. - - -The \fIoutputs\fR is the array of output that include \fIdestination\fR -and \fIamount\fR({\fIdestination\fR: \fIamount\fR})\. Its format is like: -[{address1: amount1}, {address2: amount2}] -or -[{address: \fIall\fR}]\. -It supports any number of \fBconfirmed\fR outputs\. - - -The \fIdestination\fR of output is the address which can be of any Bitcoin accepted -type, including bech32\. - - -The \fIamount\fR of output is the amount to be sent from the internal wallet -(expressed, as name suggests, in amount)\. The string \fIall\fR can be used to specify -all available funds\. Otherwise, it is in amount precision; it can be a whole -number, a whole number ending in \fIsat\fR, a whole number ending in \fI000msat\fR, -or a number with 1 to 8 decimal places ending in \fIbtc\fR\. - - -\fIfeerate\fR is an optional feerate to use\. It can be one of the strings -\fIurgent\fR (aim for next block), \fInormal\fR (next 4 blocks or so) or \fIslow\fR -(next 100 blocks or so) to use lightningd’s internal estimates: \fInormal\fR -is the default\. - - -Otherwise, \fIfeerate\fR is a number, with an optional suffix: \fIperkw\fR means -the number is interpreted as satoshi-per-kilosipa (weight), and \fIperkb\fR -means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting -the suffix is equivalent to \fIperkb\fR\. - - -\fIminconf\fR specifies the minimum number of confirmations that used -outputs should have\. Default is 1\. - - -\fIutxos\fR specifies the utxos to be used to fund the transaction, as an array -of "txid:vout"\. These must be drawn from the node's available UTXO set\. - - -\fBtxprepare\fR is similar to the first part of a \fBwithdraw\fR command, but -supports multiple outputs and uses \fIoutputs\fR as parameter\. The second part -is provided by \fBtxsend\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBpsbt\fR (string): the PSBT representing the unsigned transaction -.IP \[bu] -\fBunsigned_tx\fR (hex): the unsigned transaction -.IP \[bu] -\fBtxid\fR (txid): the transaction id of \fIunsigned_tx\fR; you hand this to \fBlightning-txsend\fR(7) or \fBlightning-txdiscard\fR(7), as the inputs of this transaction are reserved\. - -.RE - -On failure, an error is reported and the transaction is not created\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -301: There are not enough funds in the internal wallet (including -fees) to create the transaction\. -.IP \[bu] -302: The dust limit is not met\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-withdraw\fR(7), \fBlightning-txsend\fR(7), \fBlightning-txdiscard\fR(7), -\fBlightning-feerates\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:86aeba7e85c19d1ea314c61e692debd5a6f2607a12f84a10e7880db1f1539f40 diff --git a/doc/lightning-txsend.7 b/doc/lightning-txsend.7 deleted file mode 100644 index 704632ec8..000000000 --- a/doc/lightning-txsend.7 +++ /dev/null @@ -1,50 +0,0 @@ -.TH "LIGHTNING-TXSEND" "7" "" "" "lightning-txsend" -.SH NAME -lightning-txsend - Command to sign and send transaction from txprepare -.SH SYNOPSIS - -\fBtxsend\fR \fItxid\fR - -.SH DESCRIPTION - -The \fBtxsend\fR RPC command signs and broadcasts a transaction created by -\fBtxprepare\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBpsbt\fR (string): the completed PSBT representing the signed transaction -.IP \[bu] -\fBtx\fR (hex): the fully signed transaction -.IP \[bu] -\fBtxid\fR (txid): the transaction id of \fItx\fR - -.RE - -On failure, an error is reported (from bitcoind), and the inputs from -the transaction are unreserved\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-txprepare\fR(7), \fBlightning-txdiscard\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:e198424cea08555234c4e8d6626bf03c88b3d878b2a20186ac3b612ab9ea9079 diff --git a/doc/lightning-unreserveinputs.7 b/doc/lightning-unreserveinputs.7 deleted file mode 100644 index bf0bf63eb..000000000 --- a/doc/lightning-unreserveinputs.7 +++ /dev/null @@ -1,67 +0,0 @@ -.TH "LIGHTNING-UNRESERVEINPUTS" "7" "" "" "lightning-unreserveinputs" -.SH NAME -lightning-unreserveinputs - Release reserved UTXOs -.SH SYNOPSIS - -\fBunreserveinputs\fR \fIpsbt\fR [\fIreserve\fR] - -.SH DESCRIPTION - -The \fBunreserveinputs\fR RPC command releases (or reduces reservation) -on UTXOs which were previously marked as reserved, generally by -\fBlightning-reserveinputs\fR(7)\. - - -The inputs to unreserve are the inputs specified in the passed-in \fIpsbt\fR\. - - -If \fIreserve\fR is specified, it is the number of blocks to decrease -reservation by; default is 72\. - -.SH RETURN VALUE - -On success, an object containing \fBreservations\fR is returned\. It is an array of objects, where each object contains: - -.RS -.IP \[bu] -\fBtxid\fR (txid): the transaction id -.IP \[bu] -\fBvout\fR (u32): the output number which was reserved -.IP \[bu] -\fBwas_reserved\fR (boolean): whether the input was already reserved (usually \fBtrue\fR) -.IP \[bu] -\fBreserved\fR (boolean): whether the input is now reserved (may still be \fBtrue\fR if it was reserved for a long time) - -.RE - -If \fBreserved\fR is \fItrue\fR: - -.RS -.IP \[bu] -\fBreserved_to_block\fR (u32): what blockheight the reservation will expire - -.RE - -On failure, an error is reported and no UTXOs are unreserved\. - - -The following error codes may occur: - -.RS -.IP \[bu] --32602: Invalid parameter, i\.e\. an unparseable PSBT\. - -.RE -.SH AUTHOR - -niftynei \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-unreserveinputs\fR(7), \fBlightning-signpsbt\fR(7), \fBlightning-sendpsbt\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:ff7207d1205cf34ae8f1487f8cec719ea15d9d27ed2d805a8c095eb0d22935c8 diff --git a/doc/lightning-utxopsbt.7 b/doc/lightning-utxopsbt.7 deleted file mode 100644 index 31018b66e..000000000 --- a/doc/lightning-utxopsbt.7 +++ /dev/null @@ -1,127 +0,0 @@ -.TH "LIGHTNING-UTXOPSBT" "7" "" "" "lightning-utxopsbt" -.SH NAME -lightning-utxopsbt - Command to populate PSBT inputs from given UTXOs -.SH SYNOPSIS - -\fButxopsbt\fR \fIsatoshi\fR \fIfeerate\fR \fIstartweight\fR \fIutxos\fR [\fIreserve\fR] [\fIreservedok\fR] [\fIlocktime\fR] [\fImin_witness_weight\fR] [\fIexcess_as_change\fR] - -.SH DESCRIPTION - -\fIutxopsbt\fR is a low-level RPC command which creates a PSBT using unreserved -inputs in the wallet, optionally reserving them as well\. - - -It deliberately mirrors the parameters and output of -\fBlightning-fundpsbt\fR(7) except instead of an optional \fIminconf\fR -parameter to select unreserved outputs from the wallet, it takes a -compulsory list of outputs to use\. - - -\fIutxos\fR must be an array of "txid:vout", each of which must be -reserved or available: the total amount must be sufficient to pay for -the resulting transaction plus \fIstartweight\fR at the given \fIfeerate\fR, -with at least \fIsatoshi\fR left over (unless \fIsatoshi\fR is \fBall\fR, which -is equivalent to setting it to zero)\. - - -\fIreserve\fR is either boolean or a number: if \fItrue\fR or a non-zero -number then \fIreserveinputs\fR is called (successfully, with -\fIexclusive\fR true) on the returned PSBT for this number of blocks (or -72 blocks if \fIreserve\fR is simply \fItrue\fR)\. - - -Unless \fIreservedok\fR is set to true (default is false) it will also fail -if any of the \fIutxos\fR are already reserved\. - - -\fIlocktime\fR is an optional locktime: if not set, it is set to a recent -block height\. - - -\fImin_witness_weight\fR is an optional minimum weight to use for a UTXO's -witness\. If the actual witness weight is greater than the provided minimum, -the actual witness weight will be used\. - - -\fIexcess_as_change\fR is an optional boolean to flag to add a change output -for the excess sats\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBpsbt\fR (string): Unsigned PSBT which fulfills the parameters given -.IP \[bu] -\fBfeerate_per_kw\fR (u32): The feerate used to create the PSBT, in satoshis-per-kiloweight -.IP \[bu] -\fBestimated_final_weight\fR (u32): The estimated weight of the transaction once fully signed -.IP \[bu] -\fBexcess_msat\fR (msat): The amount above \fIsatoshi\fR which is available\. This could be zero, or dust; it will be zero if \fIchange_outnum\fR is also returned -.IP \[bu] -\fBchange_outnum\fR (u32, optional): The 0-based output number where change was placed (only if parameter \fIexcess_as_change\fR was true and there was sufficient funds) -.IP \[bu] -\fBreservations\fR (array of objects, optional): If \fIreserve\fR was true or a non-zero number, just as per \fBlightning-reserveinputs\fR(7): -.RS -.IP \[bu] -\fBtxid\fR (txid): The txid of the transaction -.IP \[bu] -\fBvout\fR (u32): The 0-based output number -.IP \[bu] -\fBwas_reserved\fR (boolean): Whether this output was previously reserved -.IP \[bu] -\fBreserved\fR (boolean): Whether this output is now reserved (always \fItrue\fR) -.IP \[bu] -\fBreserved_to_block\fR (u32): The blockheight the reservation will expire - -.RE - - -.RE - -On success, returns the \fIpsbt\fR it created, containing the inputs, -\fIfeerate_per_kw\fR showing the exact numeric feerate it used, -\fIestimated_final_weight\fR for the estimated weight of the transaction -once fully signed, and \fIexcess_msat\fR containing the amount above \fIsatoshi\fR -which is available\. This could be zero, or dust\. If \fIsatoshi\fR was "all", -then \fIexcess_msat\fR is the entire amount once fees are subtracted -for the weights of the inputs and \fIstartweight\fR\. - - -If \fIreserve\fR was \fItrue\fR or a non-zero number, then a \fIreservations\fR -array is returned, exactly like \fIreserveinputs\fR\. - - -If \fIexcess_as_change\fR is true and the excess is enough to cover -an additional output above the \fBdust_limit\fR, then an output is -added to the PSBT for the excess amount\. The \fIexcess_msat\fR will -be zero\. A \fIchange_outnum\fR will be returned with the index of -the change output\. - - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -301: Insufficient UTXOs to meet \fIsatoshi\fR value\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-fundpsbt\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:fb99401ea9c242b5369822685c02acd4137629e62f80fd4451ae76013d3a6b17 diff --git a/doc/lightning-waitanyinvoice.7 b/doc/lightning-waitanyinvoice.7 deleted file mode 100644 index 0ac5268b3..000000000 --- a/doc/lightning-waitanyinvoice.7 +++ /dev/null @@ -1,93 +0,0 @@ -.TH "LIGHTNING-WAITANYINVOICE" "7" "" "" "lightning-waitanyinvoice" -.SH NAME -lightning-waitanyinvoice - Command for waiting for payments -.SH SYNOPSIS - -\fBwaitanyinvoice\fR [\fIlastpay_index\fR] [\fItimeout\fR] - -.SH DESCRIPTION - -The \fBwaitanyinvoice\fR RPC command waits until an invoice is paid, then -returns a single entry as per \fBlistinvoice\fR\. It will not return for -any invoices paid prior to or including the \fIlastpay_index\fR\. - - -This is usually called iteratively: once with no arguments, then -repeatedly with the returned \fIpay_index\fR entry\. This ensures that no -paid invoice is missed\. - - -The \fIpay_index\fR is a monotonically-increasing number assigned to an -invoice when it gets paid\. The first valid \fIpay_index\fR is 1; specifying -\fIlastpay_index\fR of 0 equivalent to not specifying a \fIlastpay_index\fR\. -Negative \fIlastpay_index\fR is invalid\. - - -If \fItimeout\fR is specified, wait at most that number of seconds, which -must be an integer\. -If the specified \fItimeout\fR is reached, this command will return with an -error\. -You can specify this to 0 so that \fBwaitanyinvoice\fR will return -immediately with an error if no pending invoice is available yet\. -If unspecified, this command will wait indefinitely\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBlabel\fR (string): unique label supplied at invoice creation -.IP \[bu] -\fBdescription\fR (string): description used in the invoice -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): Whether it's paid or expired (one of "paid", "expired") -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp of when it will become / became unpayable -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount required to pay this invoice -.IP \[bu] -\fBbolt11\fR (string, optional): the BOLT11 string (always present unless \fIbolt12\fR is) -.IP \[bu] -\fBbolt12\fR (string, optional): the BOLT12 string (always present unless \fIbolt11\fR is) - -.RE - -If \fBstatus\fR is "paid": - -.RS -.IP \[bu] -\fBpay_index\fR (u64): Unique incrementing index for this payment -.IP \[bu] -\fBamount_received_msat\fR (msat): the amount actually received (could be slightly greater than \fIamount_msat\fR, since clients may overpay) -.IP \[bu] -\fBpaid_at\fR (u64): UNIX timestamp of when it was paid -.IP \[bu] -\fBpayment_preimage\fR (hex): proof of payment (always 64 characters) - -.RE - -Possible errors are: - -.RS -.IP \[bu] -904\. -The \fItimeout\fR was reached without an invoice being paid\. - -.RE -.SH AUTHOR - -Rusty Russell \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-waitinvoice\fR(7), \fBlightning-listinvoice\fR(7), -\fBlightning-delinvoice\fR(7), \fBlightning-invoice\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:df915f7735c2d5d229f2609bcf3d19fafc568ede0144d4137836d6e6af541a3b diff --git a/doc/lightning-waitblockheight.7 b/doc/lightning-waitblockheight.7 deleted file mode 100644 index 13c806b05..000000000 --- a/doc/lightning-waitblockheight.7 +++ /dev/null @@ -1,39 +0,0 @@ -.TH "LIGHTNING-WAITBLOCKHEIGHT" "7" "" "" "lightning-waitblockheight" -.SH NAME -lightning-waitblockheight - Command for waiting for blocks on the blockchain -.SH SYNOPSIS - -\fBwaitblockheight\fR \fIblockheight\fR [\fItimeout\fR] - -.SH DESCRIPTION - -The \fBwaitblockheight\fR RPC command waits until the blockchain -has reached the specified \fIblockheight\fR\. -It will only wait up to \fItimeout\fR seconds (default 60)\. - - -If the \fIblockheight\fR is a present or past block height, then this -command returns immediately\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBblockheight\fR (u32): The current block height (>= \fIblockheight\fR parameter) - -.RE - -If \fItimeout\fR seconds is reached without the specified blockheight -being reached, this command will fail with a code of \fB2000\fR\. - -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:7613b15d691e7f0b7125f091ff34ade2c1eea42a8147e21581ae455cca32e551 diff --git a/doc/lightning-waitinvoice.7 b/doc/lightning-waitinvoice.7 deleted file mode 100644 index 366195176..000000000 --- a/doc/lightning-waitinvoice.7 +++ /dev/null @@ -1,77 +0,0 @@ -.TH "LIGHTNING-WAITINVOICE" "7" "" "" "lightning-waitinvoice" -.SH NAME -lightning-waitinvoice - Command for waiting for specific payment -.SH SYNOPSIS - -\fBwaitinvoice\fR \fIlabel\fR - -.SH DESCRIPTION - -The \fBwaitinvoice\fR RPC command waits until a specific invoice is paid, -then returns that single entry as per \fBlistinvoice\fR\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBlabel\fR (string): unique label supplied at invoice creation -.IP \[bu] -\fBdescription\fR (string): description used in the invoice -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): Whether it's paid or expired (one of "paid", "expired") -.IP \[bu] -\fBexpires_at\fR (u64): UNIX timestamp of when it will become / became unpayable -.IP \[bu] -\fBamount_msat\fR (msat, optional): the amount required to pay this invoice -.IP \[bu] -\fBbolt11\fR (string, optional): the BOLT11 string (always present unless \fIbolt12\fR is) -.IP \[bu] -\fBbolt12\fR (string, optional): the BOLT12 string (always present unless \fIbolt11\fR is) - -.RE - -If \fBstatus\fR is "paid": - -.RS -.IP \[bu] -\fBpay_index\fR (u64): Unique incrementing index for this payment -.IP \[bu] -\fBamount_received_msat\fR (msat): the amount actually received (could be slightly greater than \fIamount_msat\fR, since clients may overpay) -.IP \[bu] -\fBpaid_at\fR (u64): UNIX timestamp of when it was paid -.IP \[bu] -\fBpayment_preimage\fR (hex): proof of payment (always 64 characters) - -.RE - -On error the returned object will contain \fBcode\fR and \fBmessage\fR properties, -with \fBcode\fR being one of the following: - -.RS -.IP \[bu] --32602: If the given parameters are wrong\. -.IP \[bu] --1: If the invoice is deleted while unpaid, or the invoice does not exist\. -.IP \[bu] -903: If the invoice expires before being paid, or is already expired\. - -.RE -.SH AUTHOR - -Christian Decker \fI is mainly -responsible\. - -.SH SEE ALSO - -\fBlightning-waitanyinvoice\fR(7), \fBlightning-listinvoice\fR(7), -\fBlightning-delinvoice\fR(7), \fBlightning-invoice\fR(7) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:e4d1ceb94138d92fc0166e336f47150f3aa25880b0fb9330f72fc95635b04473 diff --git a/doc/lightning-waitsendpay.7 b/doc/lightning-waitsendpay.7 deleted file mode 100644 index 64a5612f9..000000000 --- a/doc/lightning-waitsendpay.7 +++ /dev/null @@ -1,139 +0,0 @@ -.TH "LIGHTNING-WAITSENDPAY" "7" "" "" "lightning-waitsendpay" -.SH NAME -lightning-waitsendpay - Command for sending a payment via a route -.SH SYNOPSIS - -\fBwaitsendpay\fR \fIpayment_hash\fR [\fItimeout\fR] [\fIpartid\fR] - -.SH DESCRIPTION - -The \fBwaitsendpay\fR RPC command polls or waits for the status of an -outgoing payment that was initiated by a previous \fBsendpay\fR -invocation\. - - -The \fIpartid\fR argument must match that of the \fBsendpay\fR command\. - - -Optionally the client may provide a \fItimeout\fR, an integer in seconds, -for this RPC command to return\. If the \fItimeout\fR is provided and the -given amount of time passes without the payment definitely succeeding or -definitely failing, this command returns with a 200 error code (payment -still in progress)\. If \fItimeout\fR is not provided this call will wait -indefinitely\. - - -Indicating a \fItimeout\fR of 0 effectively makes this call a pollable query -of the status of the payment\. - - -If the payment completed with success, this command returns with -success\. Otherwise, if the payment completed with failure, this command -returns an error\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBid\fR (u64): unique ID for this payment attempt -.IP \[bu] -\fBpayment_hash\fR (hex): the hash of the \fIpayment_preimage\fR which will prove payment (always 64 characters) -.IP \[bu] -\fBstatus\fR (string): status of the payment (always "complete") -.IP \[bu] -\fBcreated_at\fR (u64): the UNIX timestamp showing when this payment was initiated -.IP \[bu] -\fBamount_sent_msat\fR (msat): The amount sent -.IP \[bu] -\fBamount_msat\fR (msat, optional): The amount delivered to destination (if known) -.IP \[bu] -\fBdestination\fR (pubkey, optional): the final destination of the payment if known -.IP \[bu] -\fBlabel\fR (string, optional): the label, if given to sendpay -.IP \[bu] -\fBpartid\fR (u64, optional): the \fIpartid\fR, if given to sendpay -.IP \[bu] -\fBbolt11\fR (string, optional): the bolt11 string (if pay supplied one) -.IP \[bu] -\fBbolt12\fR (string, optional): the bolt12 string (if supplied for pay: \fBexperimental-offers\fR only)\. - -.RE - -If \fBstatus\fR is "complete": - -.RS -.IP \[bu] -\fBpayment_preimage\fR (hex): the proof of payment: SHA256 of this \fBpayment_hash\fR (always 64 characters) - -.RE - -On error, and even if the error occurred from a node other than the -final destination, the route table will no longer be updated\. Use the -\fIexclude\fR parameter of the \fBgetroute\fR command to ignore the failing -route\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -200: Timed out before the payment could complete\. -.IP \[bu] -202: Unparseable onion reply\. The \fIdata\fR field of the error will -have an \fIonionreply\fR field, a hex string representation of the raw -onion reply\. -.IP \[bu] -203: Permanent failure at destination\. The \fIdata\fR field of the error -will be routing failure object\. -.IP \[bu] -204: Failure along route; retry a different route\. The \fIdata\fR field -of the error will be routing failure object\. -.IP \[bu] -208: A payment for \fIpayment_hash\fR was never made and there is -nothing to wait for\. -.IP \[bu] -209: The payment already failed, but the reason for failure was not -stored\. This should only occur when querying failed payments on very -old databases\. - -.RE - -A routing failure object has the fields below: - -.RS -.IP \[bu] -\fIerring_index\fR: The index of the node along the route that reported -the error\. 0 for the local node, 1 for the first hop, and so on\. -.IP \[bu] -\fIerring_node\fR: The hex string of the pubkey id of the node that -reported the error\. -.IP \[bu] -\fIerring_channel\fR: The short channel ID of the channel that has the -error (or the final channel if the destination raised the error)\. -.IP \[bu] -\fIerring_direction\fR: The direction of traversing the -\fIerring_channel\fR: -.IP \[bu] -\fIfailcode\fR: The failure code, as per BOLT #4\. -.IP \[bu] -\fIfailcodename\fR: The human-readable name corresponding to \fIfailcode\fR, -if known\. - -.RE -.SH AUTHOR - -ZmnSCPxj \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-sendpay\fR(7), \fBlightning-pay\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:5d15f597c042e235dc48781da7c34774e142e872ba0008e49d47cc45f8af75b0 diff --git a/doc/lightning-withdraw.7 b/doc/lightning-withdraw.7 deleted file mode 100644 index 8f8441f03..000000000 --- a/doc/lightning-withdraw.7 +++ /dev/null @@ -1,87 +0,0 @@ -.TH "LIGHTNING-WITHDRAW" "7" "" "" "lightning-withdraw" -.SH NAME -lightning-withdraw - Command for withdrawing funds from the internal wallet -.SH SYNOPSIS - -\fBwithdraw\fR \fIdestination\fR \fIsatoshi\fR [\fIfeerate\fR] [\fIminconf\fR] [\fIutxos\fR] - -.SH DESCRIPTION - -The \fBwithdraw\fR RPC command sends funds from c-lightning’s internal -wallet to the address specified in \fIdestination\fR\. - - -The address can be of any Bitcoin accepted type, including bech32\. - - -\fIsatoshi\fR is the amount to be withdrawn from the internal wallet -(expressed, as name suggests, in satoshi)\. The string \fIall\fR can be used -to specify withdrawal of all available funds\. Otherwise, it is in -satoshi precision; it can be a whole number, a whole number ending in -\fIsat\fR, a whole number ending in \fI000msat\fR, or a number with 1 to 8 -decimal places ending in \fIbtc\fR\. - - -\fIfeerate\fR is an optional feerate to use\. It can be one of the strings -\fIurgent\fR (aim for next block), \fInormal\fR (next 4 blocks or so) or \fIslow\fR -(next 100 blocks or so) to use lightningd’s internal estimates: \fInormal\fR -is the default\. - - -Otherwise, \fIfeerate\fR is a number, with an optional suffix: \fIperkw\fR means -the number is interpreted as satoshi-per-kilosipa (weight), and \fIperkb\fR -means it is interpreted bitcoind-style as satoshi-per-kilobyte\. Omitting -the suffix is equivalent to \fIperkb\fR\. - - -\fIminconf\fR specifies the minimum number of confirmations that used -outputs should have\. Default is 1\. - - -\fIutxos\fR specifies the utxos to be used to be withdrawn from, as an array -of "txid:vout"\. These must be drawn from the node's available UTXO set\. - -.SH RETURN VALUE - -On success, an object is returned, containing: - -.RS -.IP \[bu] -\fBtx\fR (hex): the fully signed bitcoin transaction -.IP \[bu] -\fBtxid\fR (txid): the transaction id of \fItx\fR -.IP \[bu] -\fBpsbt\fR (string): the PSBT representing the unsigned transaction - -.RE - -On failure, an error is reported and the withdrawal transaction is not -created\. - - -The following error codes may occur: - -.RS -.IP \[bu] --1: Catchall nonspecific error\. -.IP \[bu] -301: There are not enough funds in the internal wallet (including -fees) to create the transaction\. -.IP \[bu] -302: The dust limit is not met\. - -.RE -.SH AUTHOR - -Felix \fI is mainly responsible\. - -.SH SEE ALSO - -\fBlightning-listfunds\fR(7), \fBlightning-fundchannel\fR(7), \fBlightning-newaddr\fR(7), -\fBlightning-txprepare\fR(7), \fBlightning-feerates\fR(7)\. - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -\" SHA256STAMP:37feb16fb06f011ebcdadb1962e890c8d331e5e8a204b7274f29f83439ff5360 diff --git a/doc/lightningd-config.5 b/doc/lightningd-config.5 deleted file mode 100644 index 82ba48ce2..000000000 --- a/doc/lightningd-config.5 +++ /dev/null @@ -1,653 +0,0 @@ -.TH "LIGHTNINGD-CONFIG" "5" "" "" "lightningd-config" -.SH NAME -lightningd-config - Lightning daemon configuration file -.SH SYNOPSIS - -\fB~/\.lightning/config\fR - -.SH DESCRIPTION - -When \fBlightningd\fR(8) starts up it usually reads a general configuration -file (default: \fB$HOME/\.lightning/config\fR) then a network-specific -configuration file (default: \fB$HOME/\.lightning/testnet/config\fR)\. This can -be changed: see \fI--conf\fR and \fI--lightning-dir\fR\. - - -General configuration files are processed first, then network-specific -ones, then command line options: later options override earlier ones -except \fIaddr\fR options and \fIlog-level\fR with subsystems, which -accumulate\. - - -\fIinclude \fR followed by a filename includes another configuration file at that -point, relative to the current configuration file\. - - -All these options are mirrored as commandline arguments to -\fBlightningd\fR(8), so \fI--foo\fR becomes simply \fIfoo\fR in the configuration -file, and \fI--foo=bar\fR becomes \fIfoo=bar\fR in the configuration file\. - - -Blank lines and lines beginning with \fI#\fR are ignored\. - -.SH DEBUGGING - -\fI--help\fR will show you the defaults for many options; they vary with -network settings so you can specify \fI--network\fR before \fI--help\fR to see -the defaults for that network\. - - -The \fBlightning-listconfigs\fR(7) command will output a valid configuration -file using the current settings\. - -.SH OPTIONS -.SH General options - - \fBallow-deprecated-apis\fR=\fIBOOL\fR -Enable deprecated options, JSONRPC commands, fields, etc\. It defaults to -\fItrue\fR, but you should set it to \fIfalse\fR when testing to ensure that an -upgrade won’t break your configuration\. - - - \fBhelp\fR -Print help and exit\. Not very useful inside a configuration file, but -fun to put in other’s config files while their computer is unattended\. - - - \fBversion\fR -Print version and exit\. Also useless inside a configuration file, but -putting this in someone’s config file may convince them to read this man -page\. - - -Bitcoin control options: - - - \fBnetwork\fR=\fINETWORK\fR -Select the network parameters (\fIbitcoin\fR, \fItestnet\fR, \fIsignet\fR, or \fIregtest\fR)\. -This is not valid within the per-network configuration file\. - - - \fBmainnet\fR -Alias for \fInetwork=bitcoin\fR\. - - - \fBtestnet\fR -Alias for \fInetwork=testnet\fR\. - - - \fBsignet\fR -Alias for \fInetwork=signet\fR\. - - - \fBbitcoin-cli\fR=\fIPATH\fR [plugin \fBbcli\fR] -The name of \fIbitcoin-cli\fR executable to run\. - - - \fBbitcoin-datadir\fR=\fIDIR\fR [plugin \fBbcli\fR] -\fI-datadir\fR argument to supply to \fBbitcoin-cli\fR(1)\. - - - \fBbitcoin-rpcuser\fR=\fIUSER\fR [plugin \fBbcli\fR] -The RPC username for talking to \fBbitcoind\fR(1)\. - - - \fBbitcoin-rpcpassword\fR=\fIPASSWORD\fR [plugin \fBbcli\fR] -The RPC password for talking to \fBbitcoind\fR(1)\. - - - \fBbitcoin-rpcconnect\fR=\fIHOST\fR [plugin \fBbcli\fR] -The \fBbitcoind\fR(1) RPC host to connect to\. - - - \fBbitcoin-rpcport\fR=\fIPORT\fR [plugin \fBbcli\fR] -The \fBbitcoind\fR(1) RPC port to connect to\. - - - \fBbitcoin-retry-timeout\fR=\fISECONDS\fR [plugin \fBbcli\fR] -Number of seconds to keep trying a \fBbitcoin-cli\fR(1) command\. If the -command keeps failing after this time, exit with a fatal error\. - - - \fBrescan\fR=\fIBLOCKS\fR -Number of blocks to rescan from the current head, or absolute -blockheight if negative\. This is only needed if something goes badly -wrong\. - -.SH Lightning daemon options - - \fBlightning-dir\fR=\fIDIR\fR -Sets the working directory\. All files (except \fI--conf\fR and -\fI--lightning-dir\fR on the command line) are relative to this\. This -is only valid on the command-line, or in a configuration file specified -by \fI--conf\fR\. - - - \fBsubdaemon\fR=\fISUBDAEMON\fR:\fIPATH\fR -Specifies an alternate subdaemon binary\. -Current subdaemons are \fIchanneld\fR, \fIclosingd\fR, -\fIconnectd\fR, \fIgossipd\fR, \fIhsmd\fR, \fIonchaind\fR, and \fIopeningd\fR\. -If the supplied path is relative the subdaemon binary is found in the -working directory\. This option may be specified multiple times\. - - - So, \fBsubdaemon=hsmd:remote_signer\fR would use a -hypothetical remote signing proxy instead of the standard \fIlightning_hsmd\fR -binary\. - - - \fBpid-file\fR=\fIPATH\fR -Specify pid file to write to\. - - - \fBlog-level\fR=\fILEVEL\fR[:\fISUBSYSTEM\fR] -What log level to print out: options are io, debug, info, unusual, -broken\. If \fISUBSYSTEM\fR is supplied, this sets the logging level -for any subsystem containing that string\. Subsystems include: - -.RS -.IP \[bu] -\fIlightningd\fR: The main lightning daemon -.IP \[bu] -\fIdatabase\fR: The database subsystem -.IP \[bu] -\fIwallet\fR: The wallet subsystem -.IP \[bu] -\fIgossipd\fR: The gossip daemon -.IP \[bu] -\fIplugin-manager\fR: The plugin subsystem -.IP \[bu] -\fIplugin-P\fR: Each plugin, P = plugin path without directory -.IP \[bu] -\fIhsmd\fR: The secret-holding daemon -.IP \[bu] -\fIconnectd\fR: The network connection daemon -.IP \[bu] -\fIjsonrpc#FD\fR: Each JSONRPC connection, FD = file descriptor number - -.RE - - The following subsystems exist for each channel, where N is an incrementing -internal integer id assigned for the lifetime of the channel: - -.RS -.IP \[bu] -\fIopeningd-chan#N\fR: Each opening / idling daemon -.IP \[bu] -\fIchanneld-chan#N\fR: Each channel management daemon -.IP \[bu] -\fIclosingd-chan#N\fR: Each closing negotiation daemon -.IP \[bu] -\fIonchaind-chan#N\fR: Each onchain close handling daemon - -.RE - - So, \fBlog-level=debug:plugin\fR would set debug level logging on all -plugins and the plugin manager\. \fBlog-level=io:chan#55\fR would set -IO logging on channel number 55 (or 550, for that matter)\. - - - \fBlog-prefix\fR=\fIPREFIX\fR -Prefix for log lines: this can be customized if you want to merge logs -with multiple daemons\. - - - \fBlog-file\fR=\fIPATH\fR -Log to this file instead of stdout\. Sending \fBlightningd\fR(8) SIGHUP will -cause it to reopen this file (useful for log rotation)\. - - - \fBlog-timestamps\fR=\fIBOOL\fR -Set this to false to turn off timestamp prefixes (they will still appear -in crash log files)\. - - - \fBrpc-file\fR=\fIPATH\fR -Set JSON-RPC socket (or /dev/tty), such as for \fBlightning-cli\fR(1)\. - - - \fBrpc-file-mode\fR=\fIMODE\fR -Set JSON-RPC socket file mode, as a 4-digit octal number\. -Default is 0600, meaning only the user that launched lightningd -can command it\. -Set to 0660 to allow users with the same group to access the RPC -as well\. - - - \fBdaemon\fR -Run in the background, suppress stdout and stderr\. Note that you need -to specify \fBlog-file\fR for this case\. - - - \fBconf\fR=\fIPATH\fR -Sets configuration file, and disable reading the normal general and network -ones\. If this is a relative path, it is relative to the starting directory, not -\fBlightning-dir\fR (unlike other paths)\. \fIPATH\fR must exist and be -readable (we allow missing files in the default case)\. Using this inside -a configuration file is invalid\. - - - \fBwallet\fR=\fIDSN\fR -Identify the location of the wallet\. This is a fully qualified data source -name, including a scheme such as \fBsqlite3\fR or \fBpostgres\fR followed by the -connection parameters\. - - -The default wallet corresponds to the following DSN: - -.nf -.RS ---wallet=sqlite3://$HOME/.lightning/bitcoin/lightningd.sqlite3 -.RE - -.fi - -The following is an example of a postgresql wallet DSN: - -.nf -.RS ---wallet=postgres://user:pass@localhost:5432/db_name -.RE - -.fi - -This will connect to a DB server running on \fBlocalhost\fR port \fB5432\fR, -authenticate with username \fBuser\fR and password \fBpass\fR, and then use the -database \fBdb_name\fR\. The database must exist, but the schema will be managed -automatically by \fBlightningd\fR\. - - - \fBencrypted-hsm\fR -If set, you will be prompted to enter a password used to encrypt the \fBhsm_secret\fR\. -Note that once you encrypt the \fBhsm_secret\fR this option will be mandatory for -\fBlightningd\fR to start\. -If there is no \fBhsm_secret\fR yet, \fBlightningd\fR will create a new encrypted secret\. -If you have an unencrypted \fBhsm_secret\fR you want to encrypt on-disk, or vice versa, -see \fBlightning-hsmtool\fR(8)\. - -.SH Lightning node customization options - - \fBalias\fR=\fINAME\fR -Up to 32 bytes of UTF-8 characters to tag your node\. Completely silly, since -anyone can call their node anything they want\. The default is an -NSA-style codename derived from your public key, but "Peter Todd" and -"VAULTERO" are good options, too\. - - - \fBrgb\fR=\fIRRGGBB\fR -Your favorite color as a hex code\. - - - \fBfee-base\fR=\fIMILLISATOSHI\fR -Default: 1000\. The base fee to charge for every payment which passes -through\. Note that millisatoshis are a very, very small unit! Changing -this value will only affect new channels and not existing ones\. If you -want to change fees for existing channels, use the RPC call -\fBlightning-setchannelfee\fR(7)\. - - - \fBfee-per-satoshi\fR=\fIMILLIONTHS\fR -Default: 10 (0\.001%)\. This is the proportional fee to charge for every -payment which passes through\. As percentages are too coarse, it’s in -millionths, so 10000 is 1%, 1000 is 0\.1%\. Changing this value will only -affect new channels and not existing ones\. If you want to change fees -for existing channels, use the RPC call \fBlightning-setchannelfee\fR(7)\. - - - \fBmin-capacity-sat\fR=\fISATOSHI\fR -Default: 10000\. This value defines the minimal effective channel -capacity in satoshi to accept for channel opening requests\. This will -reject any opening of a channel which can't pass an HTLC of least this -value\. Usually this prevents a peer opening a tiny channel, but it -can also prevent a channel you open with a reasonable amount and the peer -requesting such a large reserve that the capacity of the channel -falls below this\. - - - \fBignore-fee-limits\fR=\fIBOOL\fR -Allow nodes which establish channels to us to set any fee they want\. -This may result in a channel which cannot be closed, should fees -increase, but make channels far more reliable since we never close it -due to unreasonable fees\. - - - \fBcommit-time\fR=\fIMILLISECONDS\fR -How long to wait before sending commitment messages to the peer: in -theory increasing this would reduce load, but your node would have to be -extremely busy node for you to even notice\. - - - \fBforce-feerates\fR==\fIVALUES\fR -Networks like regtest and testnet have unreliable fee estimates: we -usually treat them as the minimum (253 sats/kw) if we can't get them\. -This allows override of one or more of our standard feerates (see -\fBlightning-feerates\fR(7))\. Up to 5 values, separated by '/' can be -provided: if fewer are provided, then the final value is used for the -remainder\. The values are in per-kw (roughly 1/4 of bitcoind's per-kb -values), and the order is "opening", "mutual_close", "unilateral_close", -"delayed_to_us", "htlc_resolution", and "penalty"\. - - -You would usually put this option in the per-chain config file, to avoid -setting it on Bitcoin mainnet! e\.g\. \fB~rusty/.lightning/regtest/config\fR\. - -.SH Lightning channel and HTLC options - - \fBlarge-channels\fR -Removes capacity limits for channel creation\. Version 1\.0 of the specification -limited channel sizes to 16777215 satoshi\. With this option (which your -node will advertize to peers), your node will accept larger incoming channels -and if the peer supports it, will open larger channels\. Note: this option -is spelled \fBlarge-channels\fR but it's pronounced \fBwumbo\fR\. - - - \fBwatchtime-blocks\fR=\fIBLOCKS\fR -How long we need to spot an outdated close attempt: on opening a channel -we tell our peer that this is how long they’ll have to wait if they -perform a unilateral close\. - - - \fBmax-locktime-blocks\fR=\fIBLOCKS\fR -The longest our funds can be delayed (ie\. the longest -\fBwatchtime-blocks\fR our peer can ask for, and also the longest HTLC -timeout we will accept)\. If our peer asks for longer, we’ll refuse to -create a channel, and if an HTLC asks for longer, we’ll refuse it\. - - - \fBfunding-confirms\fR=\fIBLOCKS\fR -Confirmations required for the funding transaction when the other side -opens a channel before the channel is usable\. - - - \fBcommit-fee\fR=\fIPERCENT\fR [plugin \fBbcli\fR] -The percentage of \fIestimatesmartfee 2/CONSERVATIVE\fR to use for the commitment -transactions: default is 100\. - - - \fBmax-concurrent-htlcs\fR=\fIINTEGER\fR -Number of HTLCs one channel can handle concurrently in each direction\. -Should be between 1 and 483 (default 30)\. - - - \fBcltv-delta\fR=\fIBLOCKS\fR -The number of blocks between incoming payments and outgoing payments: -this needs to be enough to make sure that if we have to, we can close -the outgoing payment before the incoming, or redeem the incoming once -the outgoing is redeemed\. - - - \fBcltv-final\fR=\fIBLOCKS\fR -The number of blocks to allow for payments we receive: if we have to, we -might need to redeem this on-chain, so this is the number of blocks we -have to do that\. - - -Invoice control options: - - - \fBautocleaninvoice-cycle\fR=\fISECONDS\fR [plugin \fBautoclean\fR] -Perform cleanup of expired invoices every \fISECONDS\fR seconds, or disable -if 0\. Usually unpaid expired invoices are uninteresting, and just take -up space in the database\. - - - \fBautocleaninvoice-expired-by\fR=\fISECONDS\fR [plugin \fBautoclean\fR] -Control how long invoices must have been expired before they are cleaned -(if \fIautocleaninvoice-cycle\fR is non-zero)\. - - -Payment control options: - - - \fBdisable-mpp\fR [plugin \fBpay\fR] -Disable the multi-part payment sending support in the \fBpay\fR plugin\. By default -the MPP support is enabled, but it can be desirable to disable in situations -in which each payment should result in a single HTLC being forwarded in the -network\. - -.SH Networking options - -Note that for simple setups, the implicit \fIautolisten\fR option does the -right thing: it will try to bind to port 9735 on IPv4 and IPv6, and will -announce it to peers if it seems like a public address\. - - -You can instead use \fIaddr\fR to override this (eg\. to change the port), or -precisely control where to bind and what to announce with the -\fIbind-addr\fR and \fIannounce-addr\fR options\. These will \fBdisable\fR the -\fIautolisten\fR logic, so you must specifiy exactly what you want! - - - \fBaddr\fR=\fI[IPADDRESS[:PORT]]|autotor:TORIPADDRESS[:SERVICEPORT][/torport=TORPORT]|statictor:TORIPADDRESS[:SERVICEPORT][/torport=TORPORT][/torblob=[blob]]\fR - - -Set an IP address (v4 or v6) or automatic Tor address to listen on and -(maybe) announce as our node address\. - - -An empty 'IPADDRESS' is a special value meaning bind to IPv4 and/or -IPv6 on all interfaces, '0\.0\.0\.0' means bind to all IPv4 -interfaces, '::' means 'bind to all IPv6 interfaces'\. If 'PORT' is -not specified, 9735 is used\. If we can determine a public IP -address from the resulting binding, the address is announced\. - - -If the argument begins with 'autotor:' then it is followed by the -IPv4 or IPv6 address of the Tor control port (default port 9051), -and this will be used to configure a Tor hidden service for port 9735\. -The Tor hidden service will be configured to point to the -first IPv4 or IPv6 address we bind to\. - - -If the argument begins with 'statictor:' then it is followed by the -IPv4 or IPv6 address of the Tor control port (default port 9051), -and this will be used to configure a static Tor hidden service for port 9735\. -The Tor hidden service will be configured to point to the -first IPv4 or IPv6 address we bind to and is by default unique to -your nodes id\. You can add the text '/torblob=BLOB' followed by up to -64 Bytes of text to generate from this text a v3 onion service -address text unique to the first 32 Byte of this text\. -You can also use an postfix '/torport=TORPORT' to select the external -tor binding\. The result is that over tor your node is accessible by a port -defined by you and possible different from your local node port assignment - - -This option can be used multiple times to add more addresses, and -its use disables autolisten\. If necessary, and 'always-use-proxy' -is not specified, a DNS lookup may be done to resolve 'IPADDRESS' -or 'TORIPADDRESS'\. - - - \fBbind-addr\fR=\fI[IPADDRESS[:PORT]]|SOCKETPATH\fR -Set an IP address or UNIX domain socket to listen to, but do not -announce\. A UNIX domain socket is distinguished from an IP address by -beginning with a \fI/\fR\. - - -An empty 'IPADDRESS' is a special value meaning bind to IPv4 and/or -IPv6 on all interfaces, '0\.0\.0\.0' means bind to all IPv4 -interfaces, '::' means 'bind to all IPv6 interfaces'\. 'PORT' is -not specified, 9735 is used\. - - -This option can be used multiple times to add more addresses, and -its use disables autolisten\. If necessary, and 'always-use-proxy' -is not specified, a DNS lookup may be done to resolve 'IPADDRESS'\. - - - \fBannounce-addr\fR=\fIIPADDRESS[:PORT]|TORADDRESS\.onion[:PORT]\fR -Set an IP (v4 or v6) address or Tor address to announce; a Tor address -is distinguished by ending in \fI\.onion\fR\. \fIPORT\fR defaults to 9735\. - - -Empty or wildcard IPv4 and IPv6 addresses don't make sense here\. -Also, unlike the 'addr' option, there is no checking that your -announced addresses are public (e\.g\. not localhost)\. - - -This option can be used multiple times to add more addresses, and -its use disables autolisten\. - - -If necessary, and 'always-use-proxy' is not specified, a DNS -lookup may be done to resolve 'IPADDRESS'\. - - - \fBoffline\fR -Do not bind to any ports, and do not try to reconnect to any peers\. This -can be useful for maintenance and forensics, so is usually specified on -the command line\. Overrides all \fIaddr\fR and \fIbind-addr\fR options\. - - - \fBautolisten\fR=\fIBOOL\fR -By default, we bind (and maybe announce) on IPv4 and IPv6 interfaces if -no \fIaddr\fR, \fIbind-addr\fR or \fIannounce-addr\fR options are specified\. Setting -this to \fIfalse\fR disables that\. - - - \fBproxy\fR=\fIIPADDRESS[:PORT]\fR -Set a socks proxy to use to connect to Tor nodes (or for all connections -if \fBalways-use-proxy\fR is set)\. The port defaults to 9050 if not specified\. - - - \fBalways-use-proxy\fR=\fIBOOL\fR -Always use the \fBproxy\fR, even to connect to normal IP addresses (you -can still connect to Unix domain sockets manually)\. This also disables -all DNS lookups, to avoid leaking information\. - - - \fBdisable-dns\fR -Disable the DNS bootstrapping mechanism to find a node by its node ID\. - - - \fBtor-service-password\fR=\fIPASSWORD\fR -Set a Tor control password, which may be needed for \fIautotor:\fR to -authenticate to the Tor control port\. - -.SH Lightning Plugins - -\fBlightningd\fR(8) supports plugins, which offer additional configuration -options and JSON-RPC methods, depending on the plugin\. Some are supplied -by default (usually located in \fBlibexec/c-lightning/plugins/\fR)\. If a -\fBplugins\fR directory exists under \fIlightning-dir\fR that is searched for -plugins along with any immediate subdirectories)\. You can specify -additional paths too: - - - \fBplugin\fR=\fIPATH\fR -Specify a plugin to run as part of c-lightning\. This can be specified -multiple times to add multiple plugins\. Note that unless plugins themselves -specify ordering requirements for being called on various hooks, plugins will -be ordered by commandline, then config file\. - - - \fBplugin-dir\fR=\fIDIRECTORY\fR -Specify a directory to look for plugins; all executable files not -containing punctuation (other than \fI\.\fR, \fI-\fR or \fI_) in 'DIRECTORY\fR are -loaded\. \fIDIRECTORY\fR must exist; this can be specified multiple times to -add multiple directories\. The ordering of plugins within a directory -is currently unspecified\. - - - \fBclear-plugins\fR -This option clears all \fIplugin\fR, \fIimportant-plugin\fR, and \fIplugin-dir\fR options -preceeding it, -including the default built-in plugin directory\. You can still add -\fIplugin-dir\fR, \fIplugin\fR, and \fIimportant-plugin\fR options following this -and they will have the normal effect\. - - - \fBdisable-plugin\fR=\fIPLUGIN\fR -If \fIPLUGIN\fR contains a /, plugins with the same path as \fIPLUGIN\fR will -not be loaded at startup\. Otherwise, no plugin with that base name will -be loaded at startup, whatever directory it is in\. This option is useful for -disabling a single plugin inside a directory\. You can still explicitly -load plugins which have been disabled, using \fBlightning-plugin\fR(7) \fBstart\fR\. - - - \fBimportant-plugin\fR=\fIPLUGIN\fR -Speciy a plugin to run as part of C-lightning\. -This can be specified multiple times to add multiple plugins\. -Plugins specified via this option are considered so important, that if the -plugin stops for any reason (including via \fBlightning-plugin\fR(7) \fBstop\fR), -C-lightning will also stop running\. -This way, you can monitor crashes of important plugins by simply monitoring -if C-lightning terminates\. -Built-in plugins, which are installed with \fBlightningd\fR(8), are automatically -considered important\. - -.SH Experimental Options - -Experimental options are subject to breakage between releases: they -are made available for advanced users who want to test proposed -features\. If lightningd is built configured with -\fB--enable-experimental-features\fR these are on by default\. - - - \fBexperimental-onion-messages\fR - - -Specifying this enables sending, forwarding and receiving onion messages, -which are in draft status in the BOLT specifications\. - - - \fBexperimental-offers\fR - - -Specifying this enables the \fBoffers\fR and \fBfetchinvoice\fR plugins and -corresponding functionality, which are in draft status as BOLT12\. -This usually requires \fBexperimental-onion-messages\fR as well\. See -\fBlightning-offer\fR(7) and \fBlightning-fetchinvoice\fR(7)\. - - - \fBfetchinvoice-noconnect\fR - - -Specifying this prevents \fBfetchinvoice\fR and \fBsendinvoice\fR from -trying to connect directly to the offering node as a last resort\. - - - \fBexperimental-shutdown-wrong-funding\fR - - -Specifying this allows the \fBwrong_funding\fR field in shutdown: if a -remote node has opened a channel but claims it used the incorrect txid -(and the channel hasn't been used yet at all) this allows them to -negotiate a clean shutdown with the txid they offer\. - - - \fBexperimental-dual-fund\fR - - -Specifying this enables support for the dual funding protocol, -allowing both parties to contribute funds to a channel\. The decision -about whether to add funds or not to a proposed channel is handled -automatically by a plugin that implements the appropriate logic for -your needs\. The default behavior is to not contribute funds\. - -.SH BUGS - -You should report bugs on our github issues page, and maybe submit a fix -to gain our eternal gratitude! - -.SH AUTHOR - -Rusty Russell \fI wrote this man page, and -much of the configuration language, but many others did the hard work of -actually implementing these options\. - -.SH SEE ALSO - -\fBlightning-listconfigs\fR(7) \fBlightning-setchannelfee\fR(7) \fBlightningd\fR(8) -\fBlightning-hsmtool\fR(8) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -.SH COPYING - -Note: the modules in the ccan/ directory have their own licenses, but -the rest of the code is covered by the BSD-style MIT license\. - -\" SHA256STAMP:1c392f3fee66dc6c1fc2c34200204a9be1d79e53fd5fb1720ad169fc671f71c0 diff --git a/doc/lightningd.8 b/doc/lightningd.8 deleted file mode 100644 index 3d384bf64..000000000 --- a/doc/lightningd.8 +++ /dev/null @@ -1,260 +0,0 @@ -.TH "LIGHTNINGD" "8" "" "" "lightningd" -.SH NAME -lightningd - Daemon for running a Lightning Network node -.SH SYNOPSIS -.nf -.RS -lightningd [--conf=] [OPTIONS]… -.RE - -.fi -.SH DESCRIPTION - -\fBlightningd\fR starts the C-Lightning daemon, which implements a -standards-compliant Lightning Network node\. - -.SH CONFIGURATION OPTIONS - - \fB--conf\fR=\fIFILE\fR -Specify configuration file\. If not an absolute path, will be relative -from the lightning-dir location\. Defaults to \fIconfig\fR\. - - - \fB--lightning-dir\fR=\fIDIR\fR -Set the directory for the C-Lightning daemon\. Defaults to -\fI$HOME/\.lightning\fR\. - -.SH MORE OPTIONS - -Command line options are mirrored as configuration options in the -configuration file, so \fIfoo\fR in the configuration file simply becomes -\fB--foo\fR on the command line, and \fBfoo=bar\fR becomes \fB--foo=bar\fR\. - - -See \fBlightningd-config\fR(5) for a comprehensive list of all available -options\. - -.SH LOGGING AND COMMANDING C-LIGHTNING - -By default, C-Lightning will log to the standard output\. -To log to a specific file, use \fB--log-file\fR=\fIPATH\fR\. -Sending SIGHUP will cause C-Lightning to reopen this file, -for example to do log rotation\. - - -C-Lightning will set up a Unix domain socket for receiving -commands\. -By default this will be the file \fBlightning-rpc\fR in your -specified \fBlightning-dir\fR\. -You can use \fBlightning-cli\fR(1) to send commands to C-Lightning -once \fBlightningd\fR has started; you need to match the -\fB--lightning-dir\fR and \fB--rpc-file\fR options between them\. - - -Commands for C-Lightning are described in various manpages -in section 7, with the common prefix \fBlightning-\fR\. - -.SH QUICK START - -First, decide on and create a directory for \fIlightning-dir\fR, or just use -the default \fI$HOME/\.lightning\fR\. Then create a \fIconfig\fR file in this -directory containing your configuration\. - - -Your other main preparation would be to set up a mainnet Bitcoin -fullnode, i\.e\. run a \fBbitcoind\fR(1) instance\. The rest of this quick start -guide will assume you are reckless and want to spend real funds on -Lightning\. Indicate \fInetwork=bitcoin\fR in your \fIconfig\fR file explicitly\. - - -C-Lightning needs to communicate with the Bitcoin Core RPC\. You can set -this up using \fIbitcoin-datadir\fR, \fIbitcoin-rpcconnect\fR, -\fIbitcoin-rpcport\fR, \fIbitcoin-rpcuser\fR, and \fIbitcoin-rpcpassword\fR options -in your \fIconfig\fR file\. - - -Finally, just to keep yourself sane, decide on a log file name and -indicate it using \fIlog-file=lightningd\.log\fR in your \fIconfig\fR file\. You -might be interested in viewing it periodically as you follow along on -this guide\. - - -Once the \fBbitcoind\fR instance is running, start \fBlightningd\fR(8): - -.nf -.RS -$ lightningd --lightning-dir=$HOME/.lightning --daemon - - -.RE - -.fi - -This starts \fBlightningd\fR in the background due to the \fI--daemon\fR -option\. - - -Check if things are working: - -.nf -.RS -$ lightning-cli --lightning-dir=%HOME/.lightning help -$ lightning-cli --lightning-dir=%HOME/.lightning getinfo - - -.RE - -.fi - -The \fBgetinfo\fR command in particular will return a \fIblockheight\fR field, -which indicates the block height to which \fBlightningd\fR has been -synchronized to (this is separate from the block height that your -\fBbitcoind\fR has been synchronized to, and will always lag behind -\fBbitcoind\fR)\. You will have to wait until the \fIblockheight\fR has reached -the actual blockheight of the Bitcoin network\. - - -Before you can get funds offchain, you need to have some funds onchain -owned by \fBlightningd\fR (which has a separate wallet from the -\fBbitcoind\fR it connects to)\. Get an address for \fBlightningd\fR via -\fBlightning-newaddr\fR(7) command as below (\fI--lightning-dir\fR option has been -elided, specify it if you selected your own \fIlightning-dir\fR): - -.nf -.RS -$ lightning-cli newaddr - - -.RE - -.fi - -This will provide a native SegWit bech32 address\. In case all your money -is in services that do not support native SegWit and have to use -P2SH-wrapped addresses, instead use: - -.nf -.RS -$ lightning-cli newaddr p2sh-segwit - - -.RE - -.fi - -Transfer a small amount of onchain funds to the given address\. Check the -status of all your funds (onchain and on-Lightning) via -\fBlightning-listfunds\fR(7): - -.nf -.RS -$ lightning-cli listfunds - - -.RE - -.fi - -Now you need to look for an arbitrary Lightning node to connect to, -which you can do by using \fBdig\fR(1) and querying \fIlseed\.bitcoinstats\.com\fR: - -.nf -.RS -$ dig lseed.bitcoinstats.com A - - -.RE - -.fi - -This will give 25 IPv4 addresses, you can select any one of those\. You -will also need to learn the corresponding public key, which you can -determine by searching the IP addrss on \fIhttps://1ml.com/\fR \. The public -key is a long hex string, like so: -\fI024772ee4fa461febcef09d5869e1238f932861f57be7a6633048514e3f56644a1\fR\. -(this example public key is not used as of this writing) - - -After determining a public key, use \fBlightning-connect\fR(7) to connect to -that public key at that IP: - -.nf -.RS -$ lightning-cli connect $PUBLICKEY $IP - - -.RE - -.fi - -Then open a channel to that node using \fBlightning-fundchannel\fR(7): - -.nf -.RS -$ lightning-cli fundchannel $PUBLICKEY $SATOSHI - - -.RE - -.fi - -This will require that the funding transaction be confirmed before you -can send funds over Lightning\. To track this, use \fBlightning-listpeers\fR(7) -and look at the \fIstate\fR of the channel: - -.nf -.RS -$ lightning-cli listpeers $PUBLICKEY - - -.RE - -.fi - -The channel will initially start with a \fIstate\fR of -\fICHANNELD_AWAITING_LOCKIN\fR\. You need to wait for the channel \fIstate\fR -to become \fICHANNELD_NORMAL\fR, meaning the funding transaction has been -confirmed deeply\. - - -Once the channel \fIstate\fR is \fICHANNELD_NORMAL\fR, you can start paying -merchants over Lightning\. Acquire a Lightning invoice from your favorite -merchant, and use \fBlightning-pay\fR(7) to pay it: - -.nf -.RS -$ lightning-cli pay $INVOICE - - -.RE - -.fi -.SH BUGS - -You should report bugs on our github issues page, and maybe submit a fix -to gain our eternal gratitude! - -.SH AUTHOR - -ZmnSCPxj \fI wrote the initial version of -this man page, but many others did the hard work of actually -implementing a standards-compliant Lightning Network node -implementation\. - -.SH SEE ALSO - -\fBlightning-listconfigs\fR(7), \fBlightningd-config\fR(5), \fBlightning-cli\fR(1), -\fBlightning-newaddr\fR(7), \fBlightning-listfunds\fR(7), \fBlightning-connect\fR(7), -\fBlightning-fundchannel\fR(7), \fBlightning-listpeers\fR(7), \fBlightning-pay\fR(7), -\fBlightning-hsmtool\fR(8) - -.SH RESOURCES - -Main web site: \fIhttps://github.com/ElementsProject/lightning\fR - -.SH COPYING - -Note: the modules in the ccan/ directory have their own licenses, but -the rest of the code is covered by the BSD-style MIT license\. - -\" SHA256STAMP:a49556f0889c48480cd4160d57b0f5f939346d47fa893f7095135450fcc1d33c diff --git a/gossipd/gossip_store_wiregen.c b/gossipd/gossip_store_wiregen.c deleted file mode 100644 index 4ed03e25b..000000000 --- a/gossipd/gossip_store_wiregen.c +++ /dev/null @@ -1,213 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - -/* gossip_store messages: messages persisted in the gossip_store */ -/* We store raw messages here */ -/* 256/257/258. */ - -const char *gossip_store_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum gossip_store_wire)e) { - case WIRE_GOSSIP_STORE_CHANNEL_AMOUNT: return "WIRE_GOSSIP_STORE_CHANNEL_AMOUNT"; - case WIRE_GOSSIP_STORE_PRIVATE_CHANNEL: return "WIRE_GOSSIP_STORE_PRIVATE_CHANNEL"; - case WIRE_GOSSIP_STORE_PRIVATE_UPDATE: return "WIRE_GOSSIP_STORE_PRIVATE_UPDATE"; - case WIRE_GOSSIP_STORE_DELETE_CHAN: return "WIRE_GOSSIP_STORE_DELETE_CHAN"; - case WIRE_GOSSIP_STORE_ENDED: return "WIRE_GOSSIP_STORE_ENDED"; - case WIRE_GOSSIPD_LOCAL_ADD_CHANNEL_OBS: return "WIRE_GOSSIPD_LOCAL_ADD_CHANNEL_OBS"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool gossip_store_wire_is_defined(u16 type) -{ - switch ((enum gossip_store_wire)type) { - case WIRE_GOSSIP_STORE_CHANNEL_AMOUNT:; - case WIRE_GOSSIP_STORE_PRIVATE_CHANNEL:; - case WIRE_GOSSIP_STORE_PRIVATE_UPDATE:; - case WIRE_GOSSIP_STORE_DELETE_CHAN:; - case WIRE_GOSSIP_STORE_ENDED:; - case WIRE_GOSSIPD_LOCAL_ADD_CHANNEL_OBS:; - return true; - } - return false; -} - - - - - -/* WIRE: GOSSIP_STORE_CHANNEL_AMOUNT */ -/* This always follows the channel_announce / private_announce */ -u8 *towire_gossip_store_channel_amount(const tal_t *ctx, struct amount_sat satoshis) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIP_STORE_CHANNEL_AMOUNT); - towire_amount_sat(&p, satoshis); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossip_store_channel_amount(const void *p, struct amount_sat *satoshis) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_STORE_CHANNEL_AMOUNT) - return false; - *satoshis = fromwire_amount_sat(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIP_STORE_PRIVATE_CHANNEL */ -/* Mimics a channel_announce */ -u8 *towire_gossip_store_private_channel(const tal_t *ctx, struct amount_sat satoshis, const u8 *announcement) -{ - u16 len = tal_count(announcement); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIP_STORE_PRIVATE_CHANNEL); - towire_amount_sat(&p, satoshis); - towire_u16(&p, len); - towire_u8_array(&p, announcement, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossip_store_private_channel(const tal_t *ctx, const void *p, struct amount_sat *satoshis, u8 **announcement) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_STORE_PRIVATE_CHANNEL) - return false; - *satoshis = fromwire_amount_sat(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case announcement - *announcement = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *announcement, len); - return cursor != NULL; -} - -/* WIRE: GOSSIP_STORE_PRIVATE_UPDATE */ -u8 *towire_gossip_store_private_update(const tal_t *ctx, const u8 *update) -{ - u16 len = tal_count(update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIP_STORE_PRIVATE_UPDATE); - towire_u16(&p, len); - towire_u8_array(&p, update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossip_store_private_update(const tal_t *ctx, const void *p, u8 **update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_STORE_PRIVATE_UPDATE) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case update - *update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *update, len); - return cursor != NULL; -} - -/* WIRE: GOSSIP_STORE_DELETE_CHAN */ -u8 *towire_gossip_store_delete_chan(const tal_t *ctx, const struct short_channel_id *scid) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIP_STORE_DELETE_CHAN); - towire_short_channel_id(&p, scid); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossip_store_delete_chan(const void *p, struct short_channel_id *scid) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_STORE_DELETE_CHAN) - return false; - fromwire_short_channel_id(&cursor, &plen, scid); - return cursor != NULL; -} - -/* WIRE: GOSSIP_STORE_ENDED */ -u8 *towire_gossip_store_ended(const tal_t *ctx, u64 equivalent_offset) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIP_STORE_ENDED); - towire_u64(&p, equivalent_offset); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossip_store_ended(const void *p, u64 *equivalent_offset) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_STORE_ENDED) - return false; - *equivalent_offset = fromwire_u64(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_LOCAL_ADD_CHANNEL_OBS */ -/* FIXME: Here for COMPAT with v0.9.0 and before only. */ -u8 *towire_gossipd_local_add_channel_obs(const tal_t *ctx, const struct short_channel_id *short_channel_id, const struct node_id *remote_node_id, struct amount_sat satoshis, const u8 *features) -{ - u16 flen = tal_count(features); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_LOCAL_ADD_CHANNEL_OBS); - towire_short_channel_id(&p, short_channel_id); - towire_node_id(&p, remote_node_id); - towire_amount_sat(&p, satoshis); - towire_u16(&p, flen); - towire_u8_array(&p, features, flen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, struct short_channel_id *short_channel_id, struct node_id *remote_node_id, struct amount_sat *satoshis, u8 **features) -{ - u16 flen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_LOCAL_ADD_CHANNEL_OBS) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - fromwire_node_id(&cursor, &plen, remote_node_id); - *satoshis = fromwire_amount_sat(&cursor, &plen); - flen = fromwire_u16(&cursor, &plen); - // 2nd case features - *features = flen ? tal_arr(ctx, u8, flen) : NULL; - fromwire_u8_array(&cursor, &plen, *features, flen); - return cursor != NULL; -} -// SHA256STAMP:15e0760c876736aaf08229c33e7615b20e6a35790fb8d72d09ecc31a472bf783 diff --git a/gossipd/gossip_store_wiregen.h b/gossipd/gossip_store_wiregen.h deleted file mode 100644 index a1ba9f5d6..000000000 --- a/gossipd/gossip_store_wiregen.h +++ /dev/null @@ -1,66 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H -#define LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H -#include -#include -#include -#include -#include - -enum gossip_store_wire { - /* This always follows the channel_announce / private_announce */ - WIRE_GOSSIP_STORE_CHANNEL_AMOUNT = 4101, - /* Mimics a channel_announce */ - WIRE_GOSSIP_STORE_PRIVATE_CHANNEL = 4104, - WIRE_GOSSIP_STORE_PRIVATE_UPDATE = 4102, - WIRE_GOSSIP_STORE_DELETE_CHAN = 4103, - WIRE_GOSSIP_STORE_ENDED = 4105, - /* FIXME: Here for COMPAT with v0.9.0 and before only. */ - WIRE_GOSSIPD_LOCAL_ADD_CHANNEL_OBS = 3503, -}; - -const char *gossip_store_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool gossip_store_wire_is_defined(u16 type); - - -/* WIRE: GOSSIP_STORE_CHANNEL_AMOUNT */ -/* This always follows the channel_announce / private_announce */ -u8 *towire_gossip_store_channel_amount(const tal_t *ctx, struct amount_sat satoshis); -bool fromwire_gossip_store_channel_amount(const void *p, struct amount_sat *satoshis); - -/* WIRE: GOSSIP_STORE_PRIVATE_CHANNEL */ -/* Mimics a channel_announce */ -u8 *towire_gossip_store_private_channel(const tal_t *ctx, struct amount_sat satoshis, const u8 *announcement); -bool fromwire_gossip_store_private_channel(const tal_t *ctx, const void *p, struct amount_sat *satoshis, u8 **announcement); - -/* WIRE: GOSSIP_STORE_PRIVATE_UPDATE */ -u8 *towire_gossip_store_private_update(const tal_t *ctx, const u8 *update); -bool fromwire_gossip_store_private_update(const tal_t *ctx, const void *p, u8 **update); - -/* WIRE: GOSSIP_STORE_DELETE_CHAN */ -u8 *towire_gossip_store_delete_chan(const tal_t *ctx, const struct short_channel_id *scid); -bool fromwire_gossip_store_delete_chan(const void *p, struct short_channel_id *scid); - -/* WIRE: GOSSIP_STORE_ENDED */ -u8 *towire_gossip_store_ended(const tal_t *ctx, u64 equivalent_offset); -bool fromwire_gossip_store_ended(const void *p, u64 *equivalent_offset); - -/* WIRE: GOSSIPD_LOCAL_ADD_CHANNEL_OBS */ -/* FIXME: Here for COMPAT with v0.9.0 and before only. */ -u8 *towire_gossipd_local_add_channel_obs(const tal_t *ctx, const struct short_channel_id *short_channel_id, const struct node_id *remote_node_id, struct amount_sat satoshis, const u8 *features); -bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, struct short_channel_id *short_channel_id, struct node_id *remote_node_id, struct amount_sat *satoshis, u8 **features); - - -#endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H */ -// SHA256STAMP:15e0760c876736aaf08229c33e7615b20e6a35790fb8d72d09ecc31a472bf783 diff --git a/gossipd/gossipd_peerd_wiregen.c b/gossipd/gossipd_peerd_wiregen.c deleted file mode 100644 index cc7cd501d..000000000 --- a/gossipd/gossipd_peerd_wiregen.c +++ /dev/null @@ -1,164 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - -/* These must be distinct from WIRE_CHANNEL_ANNOUNCEMENT etc. gossip msgs! */ - -const char *gossipd_peerd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum gossipd_peerd_wire)e) { - case WIRE_GOSSIPD_GET_UPDATE: return "WIRE_GOSSIPD_GET_UPDATE"; - case WIRE_GOSSIPD_GET_UPDATE_REPLY: return "WIRE_GOSSIPD_GET_UPDATE_REPLY"; - case WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE: return "WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE"; - case WIRE_GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT: return "WIRE_GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool gossipd_peerd_wire_is_defined(u16 type) -{ - switch ((enum gossipd_peerd_wire)type) { - case WIRE_GOSSIPD_GET_UPDATE:; - case WIRE_GOSSIPD_GET_UPDATE_REPLY:; - case WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE:; - case WIRE_GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT:; - return true; - } - return false; -} - - - - - -/* WIRE: GOSSIPD_GET_UPDATE */ -/* Channel daemon can ask for updates for a specific channel */ -/* errors. */ -u8 *towire_gossipd_get_update(const tal_t *ctx, const struct short_channel_id *short_channel_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_UPDATE); - towire_short_channel_id(&p, short_channel_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_update(const void *p, struct short_channel_id *short_channel_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_UPDATE) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_UPDATE_REPLY */ -/* If channel isn't known */ -u8 *towire_gossipd_get_update_reply(const tal_t *ctx, const u8 *update) -{ - u16 len = tal_count(update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_UPDATE_REPLY); - towire_u16(&p, len); - towire_u8_array(&p, update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_update_reply(const tal_t *ctx, const void *p, u8 **update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_UPDATE_REPLY) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case update - *update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *update, len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_LOCAL_CHANNEL_UPDATE */ -/* Send this channel_update. */ -u8 *towire_gossipd_local_channel_update(const tal_t *ctx, const struct short_channel_id *short_channel_id, bool disable, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths, struct amount_msat htlc_maximum_msat) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE); - towire_short_channel_id(&p, short_channel_id); - towire_bool(&p, disable); - towire_u16(&p, cltv_expiry_delta); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, fee_base_msat); - towire_u32(&p, fee_proportional_millionths); - towire_amount_msat(&p, htlc_maximum_msat); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_local_channel_update(const void *p, struct short_channel_id *short_channel_id, bool *disable, u16 *cltv_expiry_delta, struct amount_msat *htlc_minimum_msat, u32 *fee_base_msat, u32 *fee_proportional_millionths, struct amount_msat *htlc_maximum_msat) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - *disable = fromwire_bool(&cursor, &plen); - *cltv_expiry_delta = fromwire_u16(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *fee_base_msat = fromwire_u32(&cursor, &plen); - *fee_proportional_millionths = fromwire_u32(&cursor, &plen); - *htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT */ -/* Send this channel_announcement */ -u8 *towire_gossipd_local_channel_announcement(const tal_t *ctx, const u8 *cannount) -{ - u16 len = tal_count(cannount); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT); - towire_u16(&p, len); - towire_u8_array(&p, cannount, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p, u8 **cannount) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case cannount - *cannount = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *cannount, len); - return cursor != NULL; -} -// SHA256STAMP:01c31e7629455bd51aa1e3b5180ac28a195700762dd1854f17785894ad330c17 diff --git a/gossipd/gossipd_peerd_wiregen.h b/gossipd/gossipd_peerd_wiregen.h deleted file mode 100644 index 40386e761..000000000 --- a/gossipd/gossipd_peerd_wiregen.h +++ /dev/null @@ -1,60 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H -#define LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H -#include -#include -#include -#include -#include - -enum gossipd_peerd_wire { - /* Channel daemon can ask for updates for a specific channel */ - /* errors. */ - WIRE_GOSSIPD_GET_UPDATE = 3501, - /* If channel isn't known */ - WIRE_GOSSIPD_GET_UPDATE_REPLY = 3601, - /* Send this channel_update. */ - WIRE_GOSSIPD_LOCAL_CHANNEL_UPDATE = 3504, - /* Send this channel_announcement */ - WIRE_GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT = 3506, -}; - -const char *gossipd_peerd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool gossipd_peerd_wire_is_defined(u16 type); - - -/* WIRE: GOSSIPD_GET_UPDATE */ -/* Channel daemon can ask for updates for a specific channel */ -/* errors. */ -u8 *towire_gossipd_get_update(const tal_t *ctx, const struct short_channel_id *short_channel_id); -bool fromwire_gossipd_get_update(const void *p, struct short_channel_id *short_channel_id); - -/* WIRE: GOSSIPD_GET_UPDATE_REPLY */ -/* If channel isn't known */ -u8 *towire_gossipd_get_update_reply(const tal_t *ctx, const u8 *update); -bool fromwire_gossipd_get_update_reply(const tal_t *ctx, const void *p, u8 **update); - -/* WIRE: GOSSIPD_LOCAL_CHANNEL_UPDATE */ -/* Send this channel_update. */ -u8 *towire_gossipd_local_channel_update(const tal_t *ctx, const struct short_channel_id *short_channel_id, bool disable, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths, struct amount_msat htlc_maximum_msat); -bool fromwire_gossipd_local_channel_update(const void *p, struct short_channel_id *short_channel_id, bool *disable, u16 *cltv_expiry_delta, struct amount_msat *htlc_minimum_msat, u32 *fee_base_msat, u32 *fee_proportional_millionths, struct amount_msat *htlc_maximum_msat); - -/* WIRE: GOSSIPD_LOCAL_CHANNEL_ANNOUNCEMENT */ -/* Send this channel_announcement */ -u8 *towire_gossipd_local_channel_announcement(const tal_t *ctx, const u8 *cannount); -bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p, u8 **cannount); - - -#endif /* LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H */ -// SHA256STAMP:01c31e7629455bd51aa1e3b5180ac28a195700762dd1854f17785894ad330c17 diff --git a/gossipd/gossipd_wiregen.c b/gossipd/gossipd_wiregen.c deleted file mode 100644 index e1e3271a0..000000000 --- a/gossipd/gossipd_wiregen.c +++ /dev/null @@ -1,880 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *gossipd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum gossipd_wire)e) { - case WIRE_GOSSIPD_INIT: return "WIRE_GOSSIPD_INIT"; - case WIRE_GOSSIPD_INIT_REPLY: return "WIRE_GOSSIPD_INIT_REPLY"; - case WIRE_GOSSIPD_DEV_SET_TIME: return "WIRE_GOSSIPD_DEV_SET_TIME"; - case WIRE_GOSSIPD_PING: return "WIRE_GOSSIPD_PING"; - case WIRE_GOSSIPD_PING_REPLY: return "WIRE_GOSSIPD_PING_REPLY"; - case WIRE_GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE: return "WIRE_GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE"; - case WIRE_GOSSIPD_GET_STRIPPED_CUPDATE: return "WIRE_GOSSIPD_GET_STRIPPED_CUPDATE"; - case WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY: return "WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY"; - case WIRE_GOSSIPD_LOCAL_CHANNEL_CLOSE: return "WIRE_GOSSIPD_LOCAL_CHANNEL_CLOSE"; - case WIRE_GOSSIPD_GET_TXOUT: return "WIRE_GOSSIPD_GET_TXOUT"; - case WIRE_GOSSIPD_GET_TXOUT_REPLY: return "WIRE_GOSSIPD_GET_TXOUT_REPLY"; - case WIRE_GOSSIPD_OUTPOINT_SPENT: return "WIRE_GOSSIPD_OUTPOINT_SPENT"; - case WIRE_GOSSIPD_DEV_SUPPRESS: return "WIRE_GOSSIPD_DEV_SUPPRESS"; - case WIRE_GOSSIPD_DEV_MEMLEAK: return "WIRE_GOSSIPD_DEV_MEMLEAK"; - case WIRE_GOSSIPD_DEV_MEMLEAK_REPLY: return "WIRE_GOSSIPD_DEV_MEMLEAK_REPLY"; - case WIRE_GOSSIPD_DEV_COMPACT_STORE: return "WIRE_GOSSIPD_DEV_COMPACT_STORE"; - case WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY: return "WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY"; - case WIRE_GOSSIPD_NEW_BLOCKHEIGHT: return "WIRE_GOSSIPD_NEW_BLOCKHEIGHT"; - case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US: return "WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US"; - case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD: return "WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD"; - case WIRE_GOSSIPD_GOT_ONIONMSG_TO_US: return "WIRE_GOSSIPD_GOT_ONIONMSG_TO_US"; - case WIRE_GOSSIPD_SEND_OBS_ONIONMSG: return "WIRE_GOSSIPD_SEND_OBS_ONIONMSG"; - case WIRE_GOSSIPD_SEND_ONIONMSG: return "WIRE_GOSSIPD_SEND_ONIONMSG"; - case WIRE_GOSSIPD_ADDGOSSIP: return "WIRE_GOSSIPD_ADDGOSSIP"; - case WIRE_GOSSIPD_ADDGOSSIP_REPLY: return "WIRE_GOSSIPD_ADDGOSSIP_REPLY"; - case WIRE_GOSSIPD_NEW_LEASE_RATES: return "WIRE_GOSSIPD_NEW_LEASE_RATES"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool gossipd_wire_is_defined(u16 type) -{ - switch ((enum gossipd_wire)type) { - case WIRE_GOSSIPD_INIT:; - case WIRE_GOSSIPD_INIT_REPLY:; - case WIRE_GOSSIPD_DEV_SET_TIME:; - case WIRE_GOSSIPD_PING:; - case WIRE_GOSSIPD_PING_REPLY:; - case WIRE_GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE:; - case WIRE_GOSSIPD_GET_STRIPPED_CUPDATE:; - case WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY:; - case WIRE_GOSSIPD_LOCAL_CHANNEL_CLOSE:; - case WIRE_GOSSIPD_GET_TXOUT:; - case WIRE_GOSSIPD_GET_TXOUT_REPLY:; - case WIRE_GOSSIPD_OUTPOINT_SPENT:; - case WIRE_GOSSIPD_DEV_SUPPRESS:; - case WIRE_GOSSIPD_DEV_MEMLEAK:; - case WIRE_GOSSIPD_DEV_MEMLEAK_REPLY:; - case WIRE_GOSSIPD_DEV_COMPACT_STORE:; - case WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY:; - case WIRE_GOSSIPD_NEW_BLOCKHEIGHT:; - case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US:; - case WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD:; - case WIRE_GOSSIPD_GOT_ONIONMSG_TO_US:; - case WIRE_GOSSIPD_SEND_OBS_ONIONMSG:; - case WIRE_GOSSIPD_SEND_ONIONMSG:; - case WIRE_GOSSIPD_ADDGOSSIP:; - case WIRE_GOSSIPD_ADDGOSSIP_REPLY:; - case WIRE_GOSSIPD_NEW_LEASE_RATES:; - return true; - } - return false; -} - - - - - -/* WIRE: GOSSIPD_INIT */ -/* Initialize the gossip daemon. */ -u8 *towire_gossipd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct node_id *id, const u8 rgb[3], const u8 alias[32], const struct wireaddr *announcable, u32 *dev_gossip_time, bool dev_fast_gossip, bool dev_fast_gossip_prune) -{ - u16 num_announcable = tal_count(announcable); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_INIT); - towire_chainparams(&p, chainparams); - towire_feature_set(&p, our_features); - towire_node_id(&p, id); - towire_u8_array(&p, rgb, 3); - towire_u8_array(&p, alias, 32); - towire_u16(&p, num_announcable); - for (size_t i = 0; i < num_announcable; i++) - towire_wireaddr(&p, announcable + i); - if (!dev_gossip_time) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_u32(&p, *dev_gossip_time); - } - towire_bool(&p, dev_fast_gossip); - towire_bool(&p, dev_fast_gossip_prune); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct node_id *id, u8 rgb[3], u8 alias[32], struct wireaddr **announcable, u32 **dev_gossip_time, bool *dev_fast_gossip, bool *dev_fast_gossip_prune) -{ - u16 num_announcable; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_INIT) - return false; - fromwire_chainparams(&cursor, &plen, chainparams); - *our_features = fromwire_feature_set(ctx, &cursor, &plen); - fromwire_node_id(&cursor, &plen, id); - fromwire_u8_array(&cursor, &plen, rgb, 3); - fromwire_u8_array(&cursor, &plen, alias, 32); - num_announcable = fromwire_u16(&cursor, &plen); - // 2nd case announcable - *announcable = num_announcable ? tal_arr(ctx, struct wireaddr, num_announcable) : NULL; - for (size_t i = 0; i < num_announcable; i++) - fromwire_wireaddr(&cursor, &plen, *announcable + i); - if (!fromwire_bool(&cursor, &plen)) - *dev_gossip_time = NULL; - else { - *dev_gossip_time = tal(ctx, u32); - **dev_gossip_time = fromwire_u32(&cursor, &plen); - } - *dev_fast_gossip = fromwire_bool(&cursor, &plen); - *dev_fast_gossip_prune = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_INIT_REPLY */ -u8 *towire_gossipd_init_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_INIT_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_init_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_INIT_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_SET_TIME */ -/* In developer mode */ -u8 *towire_gossipd_dev_set_time(const tal_t *ctx, u32 dev_gossip_time) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_SET_TIME); - towire_u32(&p, dev_gossip_time); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_set_time(const void *p, u32 *dev_gossip_time) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_SET_TIME) - return false; - *dev_gossip_time = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_PING */ -/* Ping/pong test. Waits for a reply if it expects one. */ -u8 *towire_gossipd_ping(const tal_t *ctx, const struct node_id *id, u16 num_pong_bytes, u16 len) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_PING); - towire_node_id(&p, id); - towire_u16(&p, num_pong_bytes); - towire_u16(&p, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_ping(const void *p, struct node_id *id, u16 *num_pong_bytes, u16 *len) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_PING) - return false; - fromwire_node_id(&cursor, &plen, id); - *num_pong_bytes = fromwire_u16(&cursor, &plen); - *len = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_PING_REPLY */ -u8 *towire_gossipd_ping_reply(const tal_t *ctx, const struct node_id *id, bool sent, u16 totlen) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_PING_REPLY); - towire_node_id(&p, id); - /* False if id in gossip_ping was unknown. */ - towire_bool(&p, sent); - /* 0 == no pong expected */ - towire_u16(&p, totlen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_ping_reply(const void *p, struct node_id *id, bool *sent, u16 *totlen) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_PING_REPLY) - return false; - fromwire_node_id(&cursor, &plen, id); - /* False if id in gossip_ping was unknown. */ - *sent = fromwire_bool(&cursor, &plen); - /* 0 == no pong expected */ - *totlen = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE */ -/* Set artificial maximum reply_channel_range size. Master->gossipd */ -u8 *towire_gossipd_dev_set_max_scids_encode_size(const tal_t *ctx, u32 max) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE); - towire_u32(&p, max); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p, u32 *max) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE) - return false; - *max = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_STRIPPED_CUPDATE */ -/* Given a short_channel_id */ -u8 *towire_gossipd_get_stripped_cupdate(const tal_t *ctx, const struct short_channel_id *channel_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_STRIPPED_CUPDATE); - towire_short_channel_id(&p, channel_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_stripped_cupdate(const void *p, struct short_channel_id *channel_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_STRIPPED_CUPDATE) - return false; - fromwire_short_channel_id(&cursor, &plen, channel_id); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_STRIPPED_CUPDATE_REPLY */ -u8 *towire_gossipd_get_stripped_cupdate_reply(const tal_t *ctx, const u8 *stripped_update) -{ - u16 stripped_update_len = tal_count(stripped_update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY); - towire_u16(&p, stripped_update_len); - towire_u8_array(&p, stripped_update, stripped_update_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_stripped_cupdate_reply(const tal_t *ctx, const void *p, u8 **stripped_update) -{ - u16 stripped_update_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY) - return false; - stripped_update_len = fromwire_u16(&cursor, &plen); - // 2nd case stripped_update - *stripped_update = stripped_update_len ? tal_arr(ctx, u8, stripped_update_len) : NULL; - fromwire_u8_array(&cursor, &plen, *stripped_update, stripped_update_len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_LOCAL_CHANNEL_CLOSE */ -/* gossipd->master: we're closing this channel. */ -u8 *towire_gossipd_local_channel_close(const tal_t *ctx, const struct short_channel_id *short_channel_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_LOCAL_CHANNEL_CLOSE); - towire_short_channel_id(&p, short_channel_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_local_channel_close(const void *p, struct short_channel_id *short_channel_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_LOCAL_CHANNEL_CLOSE) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_TXOUT */ -/* Gossipd->master get this tx output please. */ -u8 *towire_gossipd_get_txout(const tal_t *ctx, const struct short_channel_id *short_channel_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_TXOUT); - towire_short_channel_id(&p, short_channel_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_txout(const void *p, struct short_channel_id *short_channel_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_TXOUT) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GET_TXOUT_REPLY */ -/* master->gossipd here is the output */ -u8 *towire_gossipd_get_txout_reply(const tal_t *ctx, const struct short_channel_id *short_channel_id, struct amount_sat satoshis, const u8 *outscript) -{ - u16 len = tal_count(outscript); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GET_TXOUT_REPLY); - towire_short_channel_id(&p, short_channel_id); - towire_amount_sat(&p, satoshis); - towire_u16(&p, len); - towire_u8_array(&p, outscript, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_get_txout_reply(const tal_t *ctx, const void *p, struct short_channel_id *short_channel_id, struct amount_sat *satoshis, u8 **outscript) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GET_TXOUT_REPLY) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - *satoshis = fromwire_amount_sat(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case outscript - *outscript = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *outscript, len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_OUTPOINT_SPENT */ -/* master -> gossipd: a potential funding outpoint was spent */ -u8 *towire_gossipd_outpoint_spent(const tal_t *ctx, const struct short_channel_id *short_channel_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_OUTPOINT_SPENT); - towire_short_channel_id(&p, short_channel_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_outpoint_spent(const void *p, struct short_channel_id *short_channel_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_OUTPOINT_SPENT) - return false; - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_SUPPRESS */ -/* master -> gossipd: stop gossip timers. */ -u8 *towire_gossipd_dev_suppress(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_SUPPRESS); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_suppress(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_SUPPRESS) - return false; - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_MEMLEAK */ -/* master -> gossipd: do you have a memleak? */ -u8 *towire_gossipd_dev_memleak(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_MEMLEAK); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_memleak(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_MEMLEAK) - return false; - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_MEMLEAK_REPLY */ -u8 *towire_gossipd_dev_memleak_reply(const tal_t *ctx, bool leak) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_MEMLEAK_REPLY); - towire_bool(&p, leak); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_memleak_reply(const void *p, bool *leak) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_MEMLEAK_REPLY) - return false; - *leak = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_COMPACT_STORE */ -/* master -> gossipd: please rewrite the gossip_store */ -u8 *towire_gossipd_dev_compact_store(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_COMPACT_STORE); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_compact_store(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_COMPACT_STORE) - return false; - return cursor != NULL; -} - -/* WIRE: GOSSIPD_DEV_COMPACT_STORE_REPLY */ -/* gossipd -> master: ok */ -u8 *towire_gossipd_dev_compact_store_reply(const tal_t *ctx, bool success) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY); - towire_bool(&p, success); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_dev_compact_store_reply(const void *p, bool *success) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY) - return false; - *success = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_NEW_BLOCKHEIGHT */ -/* master -> gossipd: blockheight increased. */ -u8 *towire_gossipd_new_blockheight(const tal_t *ctx, u32 blockheight) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_NEW_BLOCKHEIGHT); - towire_u32(&p, blockheight); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_NEW_BLOCKHEIGHT) - return false; - *blockheight = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GOT_OBS_ONIONMSG_TO_US */ -/* Tell lightningd we got an obsolete onion message (for us */ -u8 *towire_gossipd_got_obs_onionmsg_to_us(const tal_t *ctx, const struct pubkey *blinding_in, const struct pubkey *reply_blinding, const struct onionmsg_path **reply_path, const u8 *rawmsg) -{ - u16 reply_path_len = tal_count(reply_path); - u16 rawmsg_len = tal_count(rawmsg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US); - if (!blinding_in) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, blinding_in); - } - if (!reply_blinding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, reply_blinding); - } - towire_u16(&p, reply_path_len); - for (size_t i = 0; i < reply_path_len; i++) - towire_onionmsg_path(&p, reply_path[i]); - towire_u16(&p, rawmsg_len); - towire_u8_array(&p, rawmsg, rawmsg_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_got_obs_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey **blinding_in, struct pubkey **reply_blinding, struct onionmsg_path ***reply_path, u8 **rawmsg) -{ - u16 reply_path_len; - u16 rawmsg_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US) - return false; - if (!fromwire_bool(&cursor, &plen)) - *blinding_in = NULL; - else { - *blinding_in = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *blinding_in); - } - if (!fromwire_bool(&cursor, &plen)) - *reply_blinding = NULL; - else { - *reply_blinding = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *reply_blinding); - } - reply_path_len = fromwire_u16(&cursor, &plen); - // 2nd case reply_path - *reply_path = reply_path_len ? tal_arr(ctx, struct onionmsg_path *, reply_path_len) : NULL; - for (size_t i = 0; i < reply_path_len; i++) - (*reply_path)[i] = fromwire_onionmsg_path(*reply_path, &cursor, &plen); - rawmsg_len = fromwire_u16(&cursor, &plen); - // 2nd case rawmsg - *rawmsg = rawmsg_len ? tal_arr(ctx, u8, rawmsg_len) : NULL; - fromwire_u8_array(&cursor, &plen, *rawmsg, rawmsg_len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GOT_OBS_ONIONMSG_FORWARD */ -u8 *towire_gossipd_got_obs_onionmsg_forward(const tal_t *ctx, const struct short_channel_id *next_scid, const struct node_id *next_node_id, const struct pubkey *next_blinding, const u8 *next_onion) -{ - u16 next_onion_len = tal_count(next_onion); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD); - if (!next_scid) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_short_channel_id(&p, next_scid); - } - if (!next_node_id) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_node_id(&p, next_node_id); - } - if (!next_blinding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, next_blinding); - } - towire_u16(&p, next_onion_len); - towire_u8_array(&p, next_onion, next_onion_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_got_obs_onionmsg_forward(const tal_t *ctx, const void *p, struct short_channel_id **next_scid, struct node_id **next_node_id, struct pubkey **next_blinding, u8 **next_onion) -{ - u16 next_onion_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD) - return false; - if (!fromwire_bool(&cursor, &plen)) - *next_scid = NULL; - else { - *next_scid = tal(ctx, struct short_channel_id); - fromwire_short_channel_id(&cursor, &plen, *next_scid); - } - if (!fromwire_bool(&cursor, &plen)) - *next_node_id = NULL; - else { - *next_node_id = tal(ctx, struct node_id); - fromwire_node_id(&cursor, &plen, *next_node_id); - } - if (!fromwire_bool(&cursor, &plen)) - *next_blinding = NULL; - else { - *next_blinding = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *next_blinding); - } - next_onion_len = fromwire_u16(&cursor, &plen); - // 2nd case next_onion - *next_onion = next_onion_len ? tal_arr(ctx, u8, next_onion_len) : NULL; - fromwire_u8_array(&cursor, &plen, *next_onion, next_onion_len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_GOT_ONIONMSG_TO_US */ -u8 *towire_gossipd_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *blinding_in, const struct pubkey *reply_blinding, const struct pubkey *reply_first_node, const struct onionmsg_path **reply_path, const u8 *rawmsg) -{ - u16 reply_path_len = tal_count(reply_path); - u16 rawmsg_len = tal_count(rawmsg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_GOT_ONIONMSG_TO_US); - towire_pubkey(&p, blinding_in); - if (!reply_blinding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, reply_blinding); - } - if (!reply_first_node) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, reply_first_node); - } - towire_u16(&p, reply_path_len); - for (size_t i = 0; i < reply_path_len; i++) - towire_onionmsg_path(&p, reply_path[i]); - towire_u16(&p, rawmsg_len); - towire_u8_array(&p, rawmsg, rawmsg_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey *blinding_in, struct pubkey **reply_blinding, struct pubkey **reply_first_node, struct onionmsg_path ***reply_path, u8 **rawmsg) -{ - u16 reply_path_len; - u16 rawmsg_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_GOT_ONIONMSG_TO_US) - return false; - fromwire_pubkey(&cursor, &plen, blinding_in); - if (!fromwire_bool(&cursor, &plen)) - *reply_blinding = NULL; - else { - *reply_blinding = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *reply_blinding); - } - if (!fromwire_bool(&cursor, &plen)) - *reply_first_node = NULL; - else { - *reply_first_node = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *reply_first_node); - } - reply_path_len = fromwire_u16(&cursor, &plen); - // 2nd case reply_path - *reply_path = reply_path_len ? tal_arr(ctx, struct onionmsg_path *, reply_path_len) : NULL; - for (size_t i = 0; i < reply_path_len; i++) - (*reply_path)[i] = fromwire_onionmsg_path(*reply_path, &cursor, &plen); - rawmsg_len = fromwire_u16(&cursor, &plen); - // 2nd case rawmsg - *rawmsg = rawmsg_len ? tal_arr(ctx, u8, rawmsg_len) : NULL; - fromwire_u8_array(&cursor, &plen, *rawmsg, rawmsg_len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_SEND_OBS_ONIONMSG */ -/* Lightningd tells us to send a onion message. */ -u8 *towire_gossipd_send_obs_onionmsg(const tal_t *ctx, const struct node_id *id, const u8 *onion, const struct pubkey *blinding) -{ - u16 onion_len = tal_count(onion); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_SEND_OBS_ONIONMSG); - towire_node_id(&p, id); - towire_u16(&p, onion_len); - towire_u8_array(&p, onion, onion_len); - if (!blinding) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, blinding); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_send_obs_onionmsg(const tal_t *ctx, const void *p, struct node_id *id, u8 **onion, struct pubkey **blinding) -{ - u16 onion_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_SEND_OBS_ONIONMSG) - return false; - fromwire_node_id(&cursor, &plen, id); - onion_len = fromwire_u16(&cursor, &plen); - // 2nd case onion - *onion = onion_len ? tal_arr(ctx, u8, onion_len) : NULL; - fromwire_u8_array(&cursor, &plen, *onion, onion_len); - if (!fromwire_bool(&cursor, &plen)) - *blinding = NULL; - else { - *blinding = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *blinding); - } - return cursor != NULL; -} - -/* WIRE: GOSSIPD_SEND_ONIONMSG */ -u8 *towire_gossipd_send_onionmsg(const tal_t *ctx, const struct node_id *id, const u8 *onion, const struct pubkey *blinding) -{ - u16 onion_len = tal_count(onion); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_SEND_ONIONMSG); - towire_node_id(&p, id); - towire_u16(&p, onion_len); - towire_u8_array(&p, onion, onion_len); - towire_pubkey(&p, blinding); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_send_onionmsg(const tal_t *ctx, const void *p, struct node_id *id, u8 **onion, struct pubkey *blinding) -{ - u16 onion_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_SEND_ONIONMSG) - return false; - fromwire_node_id(&cursor, &plen, id); - onion_len = fromwire_u16(&cursor, &plen); - // 2nd case onion - *onion = onion_len ? tal_arr(ctx, u8, onion_len) : NULL; - fromwire_u8_array(&cursor, &plen, *onion, onion_len); - fromwire_pubkey(&cursor, &plen, blinding); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_ADDGOSSIP */ -/* Lightningd tells us to inject a gossip message (for addgossip RPC) */ -u8 *towire_gossipd_addgossip(const tal_t *ctx, const u8 *msg) -{ - u16 len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_ADDGOSSIP); - towire_u16(&p, len); - towire_u8_array(&p, msg, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_addgossip(const tal_t *ctx, const void *p, u8 **msg) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_ADDGOSSIP) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_ADDGOSSIP_REPLY */ -/* Empty string means no problem. */ -u8 *towire_gossipd_addgossip_reply(const tal_t *ctx, const wirestring *err) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_ADDGOSSIP_REPLY); - towire_wirestring(&p, err); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_addgossip_reply(const tal_t *ctx, const void *p, wirestring **err) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_ADDGOSSIP_REPLY) - return false; - *err = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: GOSSIPD_NEW_LEASE_RATES */ -/* Updated lease rates available */ -u8 *towire_gossipd_new_lease_rates(const tal_t *ctx, const struct lease_rates *rates) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIPD_NEW_LEASE_RATES); - towire_lease_rates(&p, rates); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossipd_new_lease_rates(const void *p, struct lease_rates *rates) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIPD_NEW_LEASE_RATES) - return false; - fromwire_lease_rates(&cursor, &plen, rates); - return cursor != NULL; -} -// SHA256STAMP:aacb7a093fb63386eb9fa20a51d07c995ae363283a4b76d94ba3cd09ec298df2 diff --git a/gossipd/gossipd_wiregen.h b/gossipd/gossipd_wiregen.h deleted file mode 100644 index 95e5476ee..000000000 --- a/gossipd/gossipd_wiregen.h +++ /dev/null @@ -1,201 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H -#define LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include - -enum gossipd_wire { - /* Initialize the gossip daemon. */ - WIRE_GOSSIPD_INIT = 3000, - WIRE_GOSSIPD_INIT_REPLY = 3100, - /* In developer mode */ - WIRE_GOSSIPD_DEV_SET_TIME = 3001, - /* Ping/pong test. Waits for a reply if it expects one. */ - WIRE_GOSSIPD_PING = 3008, - WIRE_GOSSIPD_PING_REPLY = 3108, - /* Set artificial maximum reply_channel_range size. Master->gossipd */ - WIRE_GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE = 3030, - /* Given a short_channel_id */ - WIRE_GOSSIPD_GET_STRIPPED_CUPDATE = 3010, - WIRE_GOSSIPD_GET_STRIPPED_CUPDATE_REPLY = 3110, - /* gossipd->master: we're closing this channel. */ - WIRE_GOSSIPD_LOCAL_CHANNEL_CLOSE = 3027, - /* Gossipd->master get this tx output please. */ - WIRE_GOSSIPD_GET_TXOUT = 3018, - /* master->gossipd here is the output */ - WIRE_GOSSIPD_GET_TXOUT_REPLY = 3118, - /* master -> gossipd: a potential funding outpoint was spent */ - WIRE_GOSSIPD_OUTPOINT_SPENT = 3024, - /* master -> gossipd: stop gossip timers. */ - WIRE_GOSSIPD_DEV_SUPPRESS = 3032, - /* master -> gossipd: do you have a memleak? */ - WIRE_GOSSIPD_DEV_MEMLEAK = 3033, - WIRE_GOSSIPD_DEV_MEMLEAK_REPLY = 3133, - /* master -> gossipd: please rewrite the gossip_store */ - WIRE_GOSSIPD_DEV_COMPACT_STORE = 3034, - /* gossipd -> master: ok */ - WIRE_GOSSIPD_DEV_COMPACT_STORE_REPLY = 3134, - /* master -> gossipd: blockheight increased. */ - WIRE_GOSSIPD_NEW_BLOCKHEIGHT = 3026, - /* Tell lightningd we got an obsolete onion message (for us */ - WIRE_GOSSIPD_GOT_OBS_ONIONMSG_TO_US = 3142, - WIRE_GOSSIPD_GOT_OBS_ONIONMSG_FORWARD = 3143, - WIRE_GOSSIPD_GOT_ONIONMSG_TO_US = 3145, - /* Lightningd tells us to send a onion message. */ - WIRE_GOSSIPD_SEND_OBS_ONIONMSG = 3040, - WIRE_GOSSIPD_SEND_ONIONMSG = 3041, - /* Lightningd tells us to inject a gossip message (for addgossip RPC) */ - WIRE_GOSSIPD_ADDGOSSIP = 3044, - /* Empty string means no problem. */ - WIRE_GOSSIPD_ADDGOSSIP_REPLY = 3144, - /* Updated lease rates available */ - WIRE_GOSSIPD_NEW_LEASE_RATES = 3046, -}; - -const char *gossipd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool gossipd_wire_is_defined(u16 type); - - -/* WIRE: GOSSIPD_INIT */ -/* Initialize the gossip daemon. */ -u8 *towire_gossipd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const struct node_id *id, const u8 rgb[3], const u8 alias[32], const struct wireaddr *announcable, u32 *dev_gossip_time, bool dev_fast_gossip, bool dev_fast_gossip_prune); -bool fromwire_gossipd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, struct node_id *id, u8 rgb[3], u8 alias[32], struct wireaddr **announcable, u32 **dev_gossip_time, bool *dev_fast_gossip, bool *dev_fast_gossip_prune); - -/* WIRE: GOSSIPD_INIT_REPLY */ -u8 *towire_gossipd_init_reply(const tal_t *ctx); -bool fromwire_gossipd_init_reply(const void *p); - -/* WIRE: GOSSIPD_DEV_SET_TIME */ -/* In developer mode */ -u8 *towire_gossipd_dev_set_time(const tal_t *ctx, u32 dev_gossip_time); -bool fromwire_gossipd_dev_set_time(const void *p, u32 *dev_gossip_time); - -/* WIRE: GOSSIPD_PING */ -/* Ping/pong test. Waits for a reply if it expects one. */ -u8 *towire_gossipd_ping(const tal_t *ctx, const struct node_id *id, u16 num_pong_bytes, u16 len); -bool fromwire_gossipd_ping(const void *p, struct node_id *id, u16 *num_pong_bytes, u16 *len); - -/* WIRE: GOSSIPD_PING_REPLY */ -u8 *towire_gossipd_ping_reply(const tal_t *ctx, const struct node_id *id, bool sent, u16 totlen); -bool fromwire_gossipd_ping_reply(const void *p, struct node_id *id, bool *sent, u16 *totlen); - -/* WIRE: GOSSIPD_DEV_SET_MAX_SCIDS_ENCODE_SIZE */ -/* Set artificial maximum reply_channel_range size. Master->gossipd */ -u8 *towire_gossipd_dev_set_max_scids_encode_size(const tal_t *ctx, u32 max); -bool fromwire_gossipd_dev_set_max_scids_encode_size(const void *p, u32 *max); - -/* WIRE: GOSSIPD_GET_STRIPPED_CUPDATE */ -/* Given a short_channel_id */ -u8 *towire_gossipd_get_stripped_cupdate(const tal_t *ctx, const struct short_channel_id *channel_id); -bool fromwire_gossipd_get_stripped_cupdate(const void *p, struct short_channel_id *channel_id); - -/* WIRE: GOSSIPD_GET_STRIPPED_CUPDATE_REPLY */ -u8 *towire_gossipd_get_stripped_cupdate_reply(const tal_t *ctx, const u8 *stripped_update); -bool fromwire_gossipd_get_stripped_cupdate_reply(const tal_t *ctx, const void *p, u8 **stripped_update); - -/* WIRE: GOSSIPD_LOCAL_CHANNEL_CLOSE */ -/* gossipd->master: we're closing this channel. */ -u8 *towire_gossipd_local_channel_close(const tal_t *ctx, const struct short_channel_id *short_channel_id); -bool fromwire_gossipd_local_channel_close(const void *p, struct short_channel_id *short_channel_id); - -/* WIRE: GOSSIPD_GET_TXOUT */ -/* Gossipd->master get this tx output please. */ -u8 *towire_gossipd_get_txout(const tal_t *ctx, const struct short_channel_id *short_channel_id); -bool fromwire_gossipd_get_txout(const void *p, struct short_channel_id *short_channel_id); - -/* WIRE: GOSSIPD_GET_TXOUT_REPLY */ -/* master->gossipd here is the output */ -u8 *towire_gossipd_get_txout_reply(const tal_t *ctx, const struct short_channel_id *short_channel_id, struct amount_sat satoshis, const u8 *outscript); -bool fromwire_gossipd_get_txout_reply(const tal_t *ctx, const void *p, struct short_channel_id *short_channel_id, struct amount_sat *satoshis, u8 **outscript); - -/* WIRE: GOSSIPD_OUTPOINT_SPENT */ -/* master -> gossipd: a potential funding outpoint was spent */ -u8 *towire_gossipd_outpoint_spent(const tal_t *ctx, const struct short_channel_id *short_channel_id); -bool fromwire_gossipd_outpoint_spent(const void *p, struct short_channel_id *short_channel_id); - -/* WIRE: GOSSIPD_DEV_SUPPRESS */ -/* master -> gossipd: stop gossip timers. */ -u8 *towire_gossipd_dev_suppress(const tal_t *ctx); -bool fromwire_gossipd_dev_suppress(const void *p); - -/* WIRE: GOSSIPD_DEV_MEMLEAK */ -/* master -> gossipd: do you have a memleak? */ -u8 *towire_gossipd_dev_memleak(const tal_t *ctx); -bool fromwire_gossipd_dev_memleak(const void *p); - -/* WIRE: GOSSIPD_DEV_MEMLEAK_REPLY */ -u8 *towire_gossipd_dev_memleak_reply(const tal_t *ctx, bool leak); -bool fromwire_gossipd_dev_memleak_reply(const void *p, bool *leak); - -/* WIRE: GOSSIPD_DEV_COMPACT_STORE */ -/* master -> gossipd: please rewrite the gossip_store */ -u8 *towire_gossipd_dev_compact_store(const tal_t *ctx); -bool fromwire_gossipd_dev_compact_store(const void *p); - -/* WIRE: GOSSIPD_DEV_COMPACT_STORE_REPLY */ -/* gossipd -> master: ok */ -u8 *towire_gossipd_dev_compact_store_reply(const tal_t *ctx, bool success); -bool fromwire_gossipd_dev_compact_store_reply(const void *p, bool *success); - -/* WIRE: GOSSIPD_NEW_BLOCKHEIGHT */ -/* master -> gossipd: blockheight increased. */ -u8 *towire_gossipd_new_blockheight(const tal_t *ctx, u32 blockheight); -bool fromwire_gossipd_new_blockheight(const void *p, u32 *blockheight); - -/* WIRE: GOSSIPD_GOT_OBS_ONIONMSG_TO_US */ -/* Tell lightningd we got an obsolete onion message (for us */ -u8 *towire_gossipd_got_obs_onionmsg_to_us(const tal_t *ctx, const struct pubkey *blinding_in, const struct pubkey *reply_blinding, const struct onionmsg_path **reply_path, const u8 *rawmsg); -bool fromwire_gossipd_got_obs_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey **blinding_in, struct pubkey **reply_blinding, struct onionmsg_path ***reply_path, u8 **rawmsg); - -/* WIRE: GOSSIPD_GOT_OBS_ONIONMSG_FORWARD */ -u8 *towire_gossipd_got_obs_onionmsg_forward(const tal_t *ctx, const struct short_channel_id *next_scid, const struct node_id *next_node_id, const struct pubkey *next_blinding, const u8 *next_onion); -bool fromwire_gossipd_got_obs_onionmsg_forward(const tal_t *ctx, const void *p, struct short_channel_id **next_scid, struct node_id **next_node_id, struct pubkey **next_blinding, u8 **next_onion); - -/* WIRE: GOSSIPD_GOT_ONIONMSG_TO_US */ -u8 *towire_gossipd_got_onionmsg_to_us(const tal_t *ctx, const struct pubkey *blinding_in, const struct pubkey *reply_blinding, const struct pubkey *reply_first_node, const struct onionmsg_path **reply_path, const u8 *rawmsg); -bool fromwire_gossipd_got_onionmsg_to_us(const tal_t *ctx, const void *p, struct pubkey *blinding_in, struct pubkey **reply_blinding, struct pubkey **reply_first_node, struct onionmsg_path ***reply_path, u8 **rawmsg); - -/* WIRE: GOSSIPD_SEND_OBS_ONIONMSG */ -/* Lightningd tells us to send a onion message. */ -u8 *towire_gossipd_send_obs_onionmsg(const tal_t *ctx, const struct node_id *id, const u8 *onion, const struct pubkey *blinding); -bool fromwire_gossipd_send_obs_onionmsg(const tal_t *ctx, const void *p, struct node_id *id, u8 **onion, struct pubkey **blinding); - -/* WIRE: GOSSIPD_SEND_ONIONMSG */ -u8 *towire_gossipd_send_onionmsg(const tal_t *ctx, const struct node_id *id, const u8 *onion, const struct pubkey *blinding); -bool fromwire_gossipd_send_onionmsg(const tal_t *ctx, const void *p, struct node_id *id, u8 **onion, struct pubkey *blinding); - -/* WIRE: GOSSIPD_ADDGOSSIP */ -/* Lightningd tells us to inject a gossip message (for addgossip RPC) */ -u8 *towire_gossipd_addgossip(const tal_t *ctx, const u8 *msg); -bool fromwire_gossipd_addgossip(const tal_t *ctx, const void *p, u8 **msg); - -/* WIRE: GOSSIPD_ADDGOSSIP_REPLY */ -/* Empty string means no problem. */ -u8 *towire_gossipd_addgossip_reply(const tal_t *ctx, const wirestring *err); -bool fromwire_gossipd_addgossip_reply(const tal_t *ctx, const void *p, wirestring **err); - -/* WIRE: GOSSIPD_NEW_LEASE_RATES */ -/* Updated lease rates available */ -u8 *towire_gossipd_new_lease_rates(const tal_t *ctx, const struct lease_rates *rates); -bool fromwire_gossipd_new_lease_rates(const void *p, struct lease_rates *rates); - - -#endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:aacb7a093fb63386eb9fa20a51d07c995ae363283a4b76d94ba3cd09ec298df2 diff --git a/hsmd/hsmd_wiregen.c b/hsmd/hsmd_wiregen.c deleted file mode 100644 index 3df7ba1fa..000000000 --- a/hsmd/hsmd_wiregen.c +++ /dev/null @@ -1,1336 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - -/* Return signature for a funding tx. */ - -const char *hsmd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum hsmd_wire)e) { - case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST: return "WIRE_HSMSTATUS_CLIENT_BAD_REQUEST"; - case WIRE_HSMD_INIT: return "WIRE_HSMD_INIT"; - case WIRE_HSMD_INIT_REPLY: return "WIRE_HSMD_INIT_REPLY"; - case WIRE_HSMD_CLIENT_HSMFD: return "WIRE_HSMD_CLIENT_HSMFD"; - case WIRE_HSMD_CLIENT_HSMFD_REPLY: return "WIRE_HSMD_CLIENT_HSMFD_REPLY"; - case WIRE_HSMD_GET_CHANNEL_BASEPOINTS: return "WIRE_HSMD_GET_CHANNEL_BASEPOINTS"; - case WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY: return "WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY"; - case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ: return "WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ"; - case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY: return "WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY"; - case WIRE_HSMD_SIGN_WITHDRAWAL: return "WIRE_HSMD_SIGN_WITHDRAWAL"; - case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY: return "WIRE_HSMD_SIGN_WITHDRAWAL_REPLY"; - case WIRE_HSMD_SIGN_INVOICE: return "WIRE_HSMD_SIGN_INVOICE"; - case WIRE_HSMD_SIGN_INVOICE_REPLY: return "WIRE_HSMD_SIGN_INVOICE_REPLY"; - case WIRE_HSMD_ECDH_REQ: return "WIRE_HSMD_ECDH_REQ"; - case WIRE_HSMD_ECDH_RESP: return "WIRE_HSMD_ECDH_RESP"; - case WIRE_HSMD_CANNOUNCEMENT_SIG_REQ: return "WIRE_HSMD_CANNOUNCEMENT_SIG_REQ"; - case WIRE_HSMD_CANNOUNCEMENT_SIG_REPLY: return "WIRE_HSMD_CANNOUNCEMENT_SIG_REPLY"; - case WIRE_HSMD_CUPDATE_SIG_REQ: return "WIRE_HSMD_CUPDATE_SIG_REQ"; - case WIRE_HSMD_CUPDATE_SIG_REPLY: return "WIRE_HSMD_CUPDATE_SIG_REPLY"; - case WIRE_HSMD_SIGN_COMMITMENT_TX: return "WIRE_HSMD_SIGN_COMMITMENT_TX"; - case WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY: return "WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY"; - case WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US: return "WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US"; - case WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US: return "WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US"; - case WIRE_HSMD_SIGN_PENALTY_TO_US: return "WIRE_HSMD_SIGN_PENALTY_TO_US"; - case WIRE_HSMD_SIGN_LOCAL_HTLC_TX: return "WIRE_HSMD_SIGN_LOCAL_HTLC_TX"; - case WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX: return "WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX"; - case WIRE_HSMD_SIGN_REMOTE_HTLC_TX: return "WIRE_HSMD_SIGN_REMOTE_HTLC_TX"; - case WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX: return "WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX"; - case WIRE_HSMD_SIGN_TX_REPLY: return "WIRE_HSMD_SIGN_TX_REPLY"; - case WIRE_HSMD_GET_PER_COMMITMENT_POINT: return "WIRE_HSMD_GET_PER_COMMITMENT_POINT"; - case WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY: return "WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY"; - case WIRE_HSMD_DEV_MEMLEAK: return "WIRE_HSMD_DEV_MEMLEAK"; - case WIRE_HSMD_DEV_MEMLEAK_REPLY: return "WIRE_HSMD_DEV_MEMLEAK_REPLY"; - case WIRE_HSMD_CHECK_FUTURE_SECRET: return "WIRE_HSMD_CHECK_FUTURE_SECRET"; - case WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY: return "WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY"; - case WIRE_HSMD_SIGN_MESSAGE: return "WIRE_HSMD_SIGN_MESSAGE"; - case WIRE_HSMD_SIGN_MESSAGE_REPLY: return "WIRE_HSMD_SIGN_MESSAGE_REPLY"; - case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY: return "WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY"; - case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY: return "WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY"; - case WIRE_HSMD_SIGN_BOLT12: return "WIRE_HSMD_SIGN_BOLT12"; - case WIRE_HSMD_SIGN_BOLT12_REPLY: return "WIRE_HSMD_SIGN_BOLT12_REPLY"; - case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER: return "WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER"; - case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY: return "WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool hsmd_wire_is_defined(u16 type) -{ - switch ((enum hsmd_wire)type) { - case WIRE_HSMSTATUS_CLIENT_BAD_REQUEST:; - case WIRE_HSMD_INIT:; - case WIRE_HSMD_INIT_REPLY:; - case WIRE_HSMD_CLIENT_HSMFD:; - case WIRE_HSMD_CLIENT_HSMFD_REPLY:; - case WIRE_HSMD_GET_CHANNEL_BASEPOINTS:; - case WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY:; - case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ:; - case WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY:; - case WIRE_HSMD_SIGN_WITHDRAWAL:; - case WIRE_HSMD_SIGN_WITHDRAWAL_REPLY:; - case WIRE_HSMD_SIGN_INVOICE:; - case WIRE_HSMD_SIGN_INVOICE_REPLY:; - case WIRE_HSMD_ECDH_REQ:; - case WIRE_HSMD_ECDH_RESP:; - case WIRE_HSMD_CANNOUNCEMENT_SIG_REQ:; - case WIRE_HSMD_CANNOUNCEMENT_SIG_REPLY:; - case WIRE_HSMD_CUPDATE_SIG_REQ:; - case WIRE_HSMD_CUPDATE_SIG_REPLY:; - case WIRE_HSMD_SIGN_COMMITMENT_TX:; - case WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY:; - case WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US:; - case WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US:; - case WIRE_HSMD_SIGN_PENALTY_TO_US:; - case WIRE_HSMD_SIGN_LOCAL_HTLC_TX:; - case WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX:; - case WIRE_HSMD_SIGN_REMOTE_HTLC_TX:; - case WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX:; - case WIRE_HSMD_SIGN_TX_REPLY:; - case WIRE_HSMD_GET_PER_COMMITMENT_POINT:; - case WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY:; - case WIRE_HSMD_DEV_MEMLEAK:; - case WIRE_HSMD_DEV_MEMLEAK_REPLY:; - case WIRE_HSMD_CHECK_FUTURE_SECRET:; - case WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY:; - case WIRE_HSMD_SIGN_MESSAGE:; - case WIRE_HSMD_SIGN_MESSAGE_REPLY:; - case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY:; - case WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY:; - case WIRE_HSMD_SIGN_BOLT12:; - case WIRE_HSMD_SIGN_BOLT12_REPLY:; - case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER:; - case WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY:; - return true; - } - return false; -} - - - - - -/* WIRE: HSMSTATUS_CLIENT_BAD_REQUEST */ -/* Clients should not give a bad request but not the HSM's decision to crash. */ -u8 *towire_hsmstatus_client_bad_request(const tal_t *ctx, const struct node_id *id, const wirestring *description, const u8 *msg) -{ - u16 len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMSTATUS_CLIENT_BAD_REQUEST); - towire_node_id(&p, id); - towire_wirestring(&p, description); - towire_u16(&p, len); - towire_u8_array(&p, msg, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmstatus_client_bad_request(const tal_t *ctx, const void *p, struct node_id *id, wirestring **description, u8 **msg) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMSTATUS_CLIENT_BAD_REQUEST) - return false; - fromwire_node_id(&cursor, &plen, id); - *description = fromwire_wirestring(ctx, &cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); - return cursor != NULL; -} - -/* WIRE: HSMD_INIT */ -/* Start the HSM. */ -u8 *towire_hsmd_init(const tal_t *ctx, const struct bip32_key_version *bip32_key_version, const struct chainparams *chainparams, const struct secret *hsm_encryption_key, const struct privkey *dev_force_privkey, const struct secret *dev_force_bip32_seed, const struct secrets *dev_force_channel_secrets, const struct sha256 *dev_force_channel_secrets_shaseed) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_INIT); - towire_bip32_key_version(&p, bip32_key_version); - towire_chainparams(&p, chainparams); - if (!hsm_encryption_key) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secret(&p, hsm_encryption_key); - } - if (!dev_force_privkey) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_privkey(&p, dev_force_privkey); - } - if (!dev_force_bip32_seed) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secret(&p, dev_force_bip32_seed); - } - if (!dev_force_channel_secrets) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secrets(&p, dev_force_channel_secrets); - } - if (!dev_force_channel_secrets_shaseed) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_sha256(&p, dev_force_channel_secrets_shaseed); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_init(const tal_t *ctx, const void *p, struct bip32_key_version *bip32_key_version, const struct chainparams **chainparams, struct secret **hsm_encryption_key, struct privkey **dev_force_privkey, struct secret **dev_force_bip32_seed, struct secrets **dev_force_channel_secrets, struct sha256 **dev_force_channel_secrets_shaseed) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_INIT) - return false; - fromwire_bip32_key_version(&cursor, &plen, bip32_key_version); - fromwire_chainparams(&cursor, &plen, chainparams); - if (!fromwire_bool(&cursor, &plen)) - *hsm_encryption_key = NULL; - else { - *hsm_encryption_key = tal(ctx, struct secret); - fromwire_secret(&cursor, &plen, *hsm_encryption_key); - } - if (!fromwire_bool(&cursor, &plen)) - *dev_force_privkey = NULL; - else { - *dev_force_privkey = tal(ctx, struct privkey); - fromwire_privkey(&cursor, &plen, *dev_force_privkey); - } - if (!fromwire_bool(&cursor, &plen)) - *dev_force_bip32_seed = NULL; - else { - *dev_force_bip32_seed = tal(ctx, struct secret); - fromwire_secret(&cursor, &plen, *dev_force_bip32_seed); - } - if (!fromwire_bool(&cursor, &plen)) - *dev_force_channel_secrets = NULL; - else { - *dev_force_channel_secrets = tal(ctx, struct secrets); - fromwire_secrets(&cursor, &plen, *dev_force_channel_secrets); - } - if (!fromwire_bool(&cursor, &plen)) - *dev_force_channel_secrets_shaseed = NULL; - else { - *dev_force_channel_secrets_shaseed = tal(ctx, struct sha256); - fromwire_sha256(&cursor, &plen, *dev_force_channel_secrets_shaseed); - } - return cursor != NULL; -} - -/* WIRE: HSMD_INIT_REPLY */ -u8 *towire_hsmd_init_reply(const tal_t *ctx, const struct node_id *node_id, const struct ext_key *bip32, const struct pubkey32 *bolt12, const struct secret *onion_reply_secret) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_INIT_REPLY); - towire_node_id(&p, node_id); - towire_ext_key(&p, bip32); - towire_pubkey32(&p, bolt12); - towire_secret(&p, onion_reply_secret); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_init_reply(const void *p, struct node_id *node_id, struct ext_key *bip32, struct pubkey32 *bolt12, struct secret *onion_reply_secret) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_INIT_REPLY) - return false; - fromwire_node_id(&cursor, &plen, node_id); - fromwire_ext_key(&cursor, &plen, bip32); - fromwire_pubkey32(&cursor, &plen, bolt12); - fromwire_secret(&cursor, &plen, onion_reply_secret); - return cursor != NULL; -} - -/* WIRE: HSMD_CLIENT_HSMFD */ -/* Get a new HSM FD */ -u8 *towire_hsmd_client_hsmfd(const tal_t *ctx, const struct node_id *id, u64 dbid, u64 capabilities) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CLIENT_HSMFD); - /* Which identity to use for requests */ - towire_node_id(&p, id); - /* Database id for this client */ - towire_u64(&p, dbid); - towire_u64(&p, capabilities); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_client_hsmfd(const void *p, struct node_id *id, u64 *dbid, u64 *capabilities) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CLIENT_HSMFD) - return false; - /* Which identity to use for requests */ - fromwire_node_id(&cursor, &plen, id); - /* Database id for this client */ - *dbid = fromwire_u64(&cursor, &plen); - *capabilities = fromwire_u64(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_CLIENT_HSMFD_REPLY */ -/* No content */ -u8 *towire_hsmd_client_hsmfd_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CLIENT_HSMFD_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_client_hsmfd_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CLIENT_HSMFD_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: HSMD_GET_CHANNEL_BASEPOINTS */ -/* Get the basepoints and funding key for this specific channel. */ -u8 *towire_hsmd_get_channel_basepoints(const tal_t *ctx, const struct node_id *peerid, u64 dbid) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_GET_CHANNEL_BASEPOINTS); - towire_node_id(&p, peerid); - towire_u64(&p, dbid); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_get_channel_basepoints(const void *p, struct node_id *peerid, u64 *dbid) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_GET_CHANNEL_BASEPOINTS) - return false; - fromwire_node_id(&cursor, &plen, peerid); - *dbid = fromwire_u64(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_GET_CHANNEL_BASEPOINTS_REPLY */ -u8 *towire_hsmd_get_channel_basepoints_reply(const tal_t *ctx, const struct basepoints *basepoints, const struct pubkey *funding_pubkey) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY); - towire_basepoints(&p, basepoints); - towire_pubkey(&p, funding_pubkey); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_get_channel_basepoints_reply(const void *p, struct basepoints *basepoints, struct pubkey *funding_pubkey) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY) - return false; - fromwire_basepoints(&cursor, &plen, basepoints); - fromwire_pubkey(&cursor, &plen, funding_pubkey); - return cursor != NULL; -} - -/* WIRE: HSMD_NODE_ANNOUNCEMENT_SIG_REQ */ -/* Master asks the HSM to sign a node_announcement */ -u8 *towire_hsmd_node_announcement_sig_req(const tal_t *ctx, const u8 *announcement) -{ - u16 annlen = tal_count(announcement); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ); - towire_u16(&p, annlen); - towire_u8_array(&p, announcement, annlen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_node_announcement_sig_req(const tal_t *ctx, const void *p, u8 **announcement) -{ - u16 annlen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ) - return false; - annlen = fromwire_u16(&cursor, &plen); - // 2nd case announcement - *announcement = annlen ? tal_arr(ctx, u8, annlen) : NULL; - fromwire_u8_array(&cursor, &plen, *announcement, annlen); - return cursor != NULL; -} - -/* WIRE: HSMD_NODE_ANNOUNCEMENT_SIG_REPLY */ -u8 *towire_hsmd_node_announcement_sig_reply(const tal_t *ctx, const secp256k1_ecdsa_signature *signature) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY); - towire_secp256k1_ecdsa_signature(&p, signature); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_node_announcement_sig_reply(const void *p, secp256k1_ecdsa_signature *signature) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_WITHDRAWAL */ -/* Sign a withdrawal request */ -u8 *towire_hsmd_sign_withdrawal(const tal_t *ctx, const struct utxo **inputs, const struct wally_psbt *psbt) -{ - u16 num_inputs = tal_count(inputs); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_WITHDRAWAL); - towire_u16(&p, num_inputs); - for (size_t i = 0; i < num_inputs; i++) - towire_utxo(&p, inputs[i]); - towire_wally_psbt(&p, psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_withdrawal(const tal_t *ctx, const void *p, struct utxo ***inputs, struct wally_psbt **psbt) -{ - u16 num_inputs; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_WITHDRAWAL) - return false; - num_inputs = fromwire_u16(&cursor, &plen); - // 2nd case inputs - *inputs = num_inputs ? tal_arr(ctx, struct utxo *, num_inputs) : NULL; - for (size_t i = 0; i < num_inputs; i++) - (*inputs)[i] = fromwire_utxo(*inputs, &cursor, &plen); - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_WITHDRAWAL_REPLY */ -u8 *towire_hsmd_sign_withdrawal_reply(const tal_t *ctx, const struct wally_psbt *psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_WITHDRAWAL_REPLY); - towire_wally_psbt(&p, psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_withdrawal_reply(const tal_t *ctx, const void *p, struct wally_psbt **psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_WITHDRAWAL_REPLY) - return false; - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_INVOICE */ -/* Sign an invoice */ -u8 *towire_hsmd_sign_invoice(const tal_t *ctx, const u8 *u5bytes, const u8 *hrp) -{ - u16 len = tal_count(u5bytes); - u16 hrplen = tal_count(hrp); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_INVOICE); - towire_u16(&p, len); - towire_u8_array(&p, u5bytes, len); - towire_u16(&p, hrplen); - towire_u8_array(&p, hrp, hrplen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_invoice(const tal_t *ctx, const void *p, u8 **u5bytes, u8 **hrp) -{ - u16 len; - u16 hrplen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_INVOICE) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case u5bytes - *u5bytes = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *u5bytes, len); - hrplen = fromwire_u16(&cursor, &plen); - // 2nd case hrp - *hrp = hrplen ? tal_arr(ctx, u8, hrplen) : NULL; - fromwire_u8_array(&cursor, &plen, *hrp, hrplen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_INVOICE_REPLY */ -u8 *towire_hsmd_sign_invoice_reply(const tal_t *ctx, const secp256k1_ecdsa_recoverable_signature *sig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_INVOICE_REPLY); - towire_secp256k1_ecdsa_recoverable_signature(&p, sig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_invoice_reply(const void *p, secp256k1_ecdsa_recoverable_signature *sig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_INVOICE_REPLY) - return false; - fromwire_secp256k1_ecdsa_recoverable_signature(&cursor, &plen, sig); - return cursor != NULL; -} - -/* WIRE: HSMD_ECDH_REQ */ -/* Give me ECDH(node-id-secret */ -u8 *towire_hsmd_ecdh_req(const tal_t *ctx, const struct pubkey *point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_ECDH_REQ); - towire_pubkey(&p, point); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_ecdh_req(const void *p, struct pubkey *point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_ECDH_REQ) - return false; - fromwire_pubkey(&cursor, &plen, point); - return cursor != NULL; -} - -/* WIRE: HSMD_ECDH_RESP */ -u8 *towire_hsmd_ecdh_resp(const tal_t *ctx, const struct secret *ss) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_ECDH_RESP); - towire_secret(&p, ss); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_ecdh_resp(const void *p, struct secret *ss) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_ECDH_RESP) - return false; - fromwire_secret(&cursor, &plen, ss); - return cursor != NULL; -} - -/* WIRE: HSMD_CANNOUNCEMENT_SIG_REQ */ -u8 *towire_hsmd_cannouncement_sig_req(const tal_t *ctx, const u8 *ca) -{ - u16 calen = tal_count(ca); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CANNOUNCEMENT_SIG_REQ); - towire_u16(&p, calen); - towire_u8_array(&p, ca, calen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_cannouncement_sig_req(const tal_t *ctx, const void *p, u8 **ca) -{ - u16 calen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CANNOUNCEMENT_SIG_REQ) - return false; - calen = fromwire_u16(&cursor, &plen); - // 2nd case ca - *ca = calen ? tal_arr(ctx, u8, calen) : NULL; - fromwire_u8_array(&cursor, &plen, *ca, calen); - return cursor != NULL; -} - -/* WIRE: HSMD_CANNOUNCEMENT_SIG_REPLY */ -u8 *towire_hsmd_cannouncement_sig_reply(const tal_t *ctx, const secp256k1_ecdsa_signature *node_signature, const secp256k1_ecdsa_signature *bitcoin_signature) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CANNOUNCEMENT_SIG_REPLY); - towire_secp256k1_ecdsa_signature(&p, node_signature); - towire_secp256k1_ecdsa_signature(&p, bitcoin_signature); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_cannouncement_sig_reply(const void *p, secp256k1_ecdsa_signature *node_signature, secp256k1_ecdsa_signature *bitcoin_signature) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CANNOUNCEMENT_SIG_REPLY) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, node_signature); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, bitcoin_signature); - return cursor != NULL; -} - -/* WIRE: HSMD_CUPDATE_SIG_REQ */ -u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx, const u8 *cu) -{ - u16 culen = tal_count(cu); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CUPDATE_SIG_REQ); - towire_u16(&p, culen); - towire_u8_array(&p, cu, culen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_cupdate_sig_req(const tal_t *ctx, const void *p, u8 **cu) -{ - u16 culen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CUPDATE_SIG_REQ) - return false; - culen = fromwire_u16(&cursor, &plen); - // 2nd case cu - *cu = culen ? tal_arr(ctx, u8, culen) : NULL; - fromwire_u8_array(&cursor, &plen, *cu, culen); - return cursor != NULL; -} - -/* WIRE: HSMD_CUPDATE_SIG_REPLY */ -u8 *towire_hsmd_cupdate_sig_reply(const tal_t *ctx, const u8 *cu) -{ - u16 culen = tal_count(cu); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CUPDATE_SIG_REPLY); - towire_u16(&p, culen); - towire_u8_array(&p, cu, culen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_cupdate_sig_reply(const tal_t *ctx, const void *p, u8 **cu) -{ - u16 culen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CUPDATE_SIG_REPLY) - return false; - culen = fromwire_u16(&cursor, &plen); - // 2nd case cu - *cu = culen ? tal_arr(ctx, u8, culen) : NULL; - fromwire_u8_array(&cursor, &plen, *cu, culen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_COMMITMENT_TX */ -/* Master asks HSM to sign a commitment transaction. */ -u8 *towire_hsmd_sign_commitment_tx(const tal_t *ctx, const struct node_id *peer_id, u64 channel_dbid, const struct bitcoin_tx *tx, const struct pubkey *remote_funding_key) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_COMMITMENT_TX); - towire_node_id(&p, peer_id); - towire_u64(&p, channel_dbid); - towire_bitcoin_tx(&p, tx); - towire_pubkey(&p, remote_funding_key); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_commitment_tx(const tal_t *ctx, const void *p, struct node_id *peer_id, u64 *channel_dbid, struct bitcoin_tx **tx, struct pubkey *remote_funding_key) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_COMMITMENT_TX) - return false; - fromwire_node_id(&cursor, &plen, peer_id); - *channel_dbid = fromwire_u64(&cursor, &plen); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, remote_funding_key); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_COMMITMENT_TX_REPLY */ -u8 *towire_hsmd_sign_commitment_tx_reply(const tal_t *ctx, const struct bitcoin_signature *sig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY); - towire_bitcoin_signature(&p, sig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_commitment_tx_reply(const void *p, struct bitcoin_signature *sig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY) - return false; - fromwire_bitcoin_signature(&cursor, &plen, sig); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_DELAYED_PAYMENT_TO_US */ -/* Onchaind asks HSM to sign a spend to-us. Four variants */ -/* of keys is derived differently... */ -/* FIXME: Have master tell hsmd the keyindex */ -u8 *towire_hsmd_sign_delayed_payment_to_us(const tal_t *ctx, u64 commit_num, const struct bitcoin_tx *tx, const u8 *wscript) -{ - u16 wscript_len = tal_count(wscript); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US); - towire_u64(&p, commit_num); - towire_bitcoin_tx(&p, tx); - towire_u16(&p, wscript_len); - towire_u8_array(&p, wscript, wscript_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_delayed_payment_to_us(const tal_t *ctx, const void *p, u64 *commit_num, struct bitcoin_tx **tx, u8 **wscript) -{ - u16 wscript_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US) - return false; - *commit_num = fromwire_u64(&cursor, &plen); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - wscript_len = fromwire_u16(&cursor, &plen); - // 2nd case wscript - *wscript = wscript_len ? tal_arr(ctx, u8, wscript_len) : NULL; - fromwire_u8_array(&cursor, &plen, *wscript, wscript_len); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_REMOTE_HTLC_TO_US */ -u8 *towire_hsmd_sign_remote_htlc_to_us(const tal_t *ctx, const struct pubkey *remote_per_commitment_point, const struct bitcoin_tx *tx, const u8 *wscript, bool option_anchor_outputs) -{ - u16 wscript_len = tal_count(wscript); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US); - towire_pubkey(&p, remote_per_commitment_point); - towire_bitcoin_tx(&p, tx); - towire_u16(&p, wscript_len); - towire_u8_array(&p, wscript, wscript_len); - towire_bool(&p, option_anchor_outputs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_remote_htlc_to_us(const tal_t *ctx, const void *p, struct pubkey *remote_per_commitment_point, struct bitcoin_tx **tx, u8 **wscript, bool *option_anchor_outputs) -{ - u16 wscript_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US) - return false; - fromwire_pubkey(&cursor, &plen, remote_per_commitment_point); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - wscript_len = fromwire_u16(&cursor, &plen); - // 2nd case wscript - *wscript = wscript_len ? tal_arr(ctx, u8, wscript_len) : NULL; - fromwire_u8_array(&cursor, &plen, *wscript, wscript_len); - *option_anchor_outputs = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_PENALTY_TO_US */ -u8 *towire_hsmd_sign_penalty_to_us(const tal_t *ctx, const struct secret *revocation_secret, const struct bitcoin_tx *tx, const u8 *wscript) -{ - u16 wscript_len = tal_count(wscript); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_PENALTY_TO_US); - towire_secret(&p, revocation_secret); - towire_bitcoin_tx(&p, tx); - towire_u16(&p, wscript_len); - towire_u8_array(&p, wscript, wscript_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_penalty_to_us(const tal_t *ctx, const void *p, struct secret *revocation_secret, struct bitcoin_tx **tx, u8 **wscript) -{ - u16 wscript_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_PENALTY_TO_US) - return false; - fromwire_secret(&cursor, &plen, revocation_secret); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - wscript_len = fromwire_u16(&cursor, &plen); - // 2nd case wscript - *wscript = wscript_len ? tal_arr(ctx, u8, wscript_len) : NULL; - fromwire_u8_array(&cursor, &plen, *wscript, wscript_len); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_LOCAL_HTLC_TX */ -/* Onchaind asks HSM to sign a local HTLC success or HTLC timeout tx. */ -u8 *towire_hsmd_sign_local_htlc_tx(const tal_t *ctx, u64 commit_num, const struct bitcoin_tx *tx, const u8 *wscript, bool option_anchor_outputs) -{ - u16 wscript_len = tal_count(wscript); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_LOCAL_HTLC_TX); - towire_u64(&p, commit_num); - towire_bitcoin_tx(&p, tx); - towire_u16(&p, wscript_len); - towire_u8_array(&p, wscript, wscript_len); - towire_bool(&p, option_anchor_outputs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_local_htlc_tx(const tal_t *ctx, const void *p, u64 *commit_num, struct bitcoin_tx **tx, u8 **wscript, bool *option_anchor_outputs) -{ - u16 wscript_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_LOCAL_HTLC_TX) - return false; - *commit_num = fromwire_u64(&cursor, &plen); - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - wscript_len = fromwire_u16(&cursor, &plen); - // 2nd case wscript - *wscript = wscript_len ? tal_arr(ctx, u8, wscript_len) : NULL; - fromwire_u8_array(&cursor, &plen, *wscript, wscript_len); - *option_anchor_outputs = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_REMOTE_COMMITMENT_TX */ -/* Openingd/channeld asks HSM to sign the other sides' commitment tx. */ -u8 *towire_hsmd_sign_remote_commitment_tx(const tal_t *ctx, const struct bitcoin_tx *tx, const struct pubkey *remote_funding_key, const struct pubkey *remote_per_commit, bool option_static_remotekey) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX); - towire_bitcoin_tx(&p, tx); - towire_pubkey(&p, remote_funding_key); - towire_pubkey(&p, remote_per_commit); - towire_bool(&p, option_static_remotekey); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_remote_commitment_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, struct pubkey *remote_funding_key, struct pubkey *remote_per_commit, bool *option_static_remotekey) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX) - return false; - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, remote_funding_key); - fromwire_pubkey(&cursor, &plen, remote_per_commit); - *option_static_remotekey = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_REMOTE_HTLC_TX */ -/* channeld asks HSM to sign remote HTLC tx. */ -u8 *towire_hsmd_sign_remote_htlc_tx(const tal_t *ctx, const struct bitcoin_tx *tx, const u8 *wscript, const struct pubkey *remote_per_commit_point, bool option_anchor_outputs) -{ - u16 len = tal_count(wscript); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_REMOTE_HTLC_TX); - towire_bitcoin_tx(&p, tx); - towire_u16(&p, len); - towire_u8_array(&p, wscript, len); - towire_pubkey(&p, remote_per_commit_point); - towire_bool(&p, option_anchor_outputs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_remote_htlc_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, u8 **wscript, struct pubkey *remote_per_commit_point, bool *option_anchor_outputs) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_REMOTE_HTLC_TX) - return false; - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case wscript - *wscript = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *wscript, len); - fromwire_pubkey(&cursor, &plen, remote_per_commit_point); - *option_anchor_outputs = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_MUTUAL_CLOSE_TX */ -/* closingd asks HSM to sign mutual close tx. */ -u8 *towire_hsmd_sign_mutual_close_tx(const tal_t *ctx, const struct bitcoin_tx *tx, const struct pubkey *remote_funding_key) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX); - towire_bitcoin_tx(&p, tx); - towire_pubkey(&p, remote_funding_key); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_mutual_close_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, struct pubkey *remote_funding_key) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX) - return false; - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, remote_funding_key); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_TX_REPLY */ -/* Reply for all the above requests. */ -u8 *towire_hsmd_sign_tx_reply(const tal_t *ctx, const struct bitcoin_signature *sig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_TX_REPLY); - towire_bitcoin_signature(&p, sig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_tx_reply(const void *p, struct bitcoin_signature *sig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_TX_REPLY) - return false; - fromwire_bitcoin_signature(&cursor, &plen, sig); - return cursor != NULL; -} - -/* WIRE: HSMD_GET_PER_COMMITMENT_POINT */ -/* Openingd/channeld/onchaind asks for Nth per_commitment_point */ -u8 *towire_hsmd_get_per_commitment_point(const tal_t *ctx, u64 n) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_GET_PER_COMMITMENT_POINT); - towire_u64(&p, n); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_get_per_commitment_point(const void *p, u64 *n) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_GET_PER_COMMITMENT_POINT) - return false; - *n = fromwire_u64(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_GET_PER_COMMITMENT_POINT_REPLY */ -u8 *towire_hsmd_get_per_commitment_point_reply(const tal_t *ctx, const struct pubkey *per_commitment_point, const struct secret *old_commitment_secret) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY); - towire_pubkey(&p, per_commitment_point); - if (!old_commitment_secret) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secret(&p, old_commitment_secret); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_get_per_commitment_point_reply(const tal_t *ctx, const void *p, struct pubkey *per_commitment_point, struct secret **old_commitment_secret) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY) - return false; - fromwire_pubkey(&cursor, &plen, per_commitment_point); - if (!fromwire_bool(&cursor, &plen)) - *old_commitment_secret = NULL; - else { - *old_commitment_secret = tal(ctx, struct secret); - fromwire_secret(&cursor, &plen, *old_commitment_secret); - } - return cursor != NULL; -} - -/* WIRE: HSMD_DEV_MEMLEAK */ -/* master -> hsmd: do you have a memleak? */ -u8 *towire_hsmd_dev_memleak(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_DEV_MEMLEAK); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_dev_memleak(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_DEV_MEMLEAK) - return false; - return cursor != NULL; -} - -/* WIRE: HSMD_DEV_MEMLEAK_REPLY */ -u8 *towire_hsmd_dev_memleak_reply(const tal_t *ctx, bool leak) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_DEV_MEMLEAK_REPLY); - towire_bool(&p, leak); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_dev_memleak_reply(const void *p, bool *leak) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_DEV_MEMLEAK_REPLY) - return false; - *leak = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_CHECK_FUTURE_SECRET */ -/* channeld asks to check if claimed future commitment_secret is correct. */ -u8 *towire_hsmd_check_future_secret(const tal_t *ctx, u64 n, const struct secret *commitment_secret) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CHECK_FUTURE_SECRET); - towire_u64(&p, n); - towire_secret(&p, commitment_secret); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_check_future_secret(const void *p, u64 *n, struct secret *commitment_secret) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CHECK_FUTURE_SECRET) - return false; - *n = fromwire_u64(&cursor, &plen); - fromwire_secret(&cursor, &plen, commitment_secret); - return cursor != NULL; -} - -/* WIRE: HSMD_CHECK_FUTURE_SECRET_REPLY */ -u8 *towire_hsmd_check_future_secret_reply(const tal_t *ctx, bool correct) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY); - towire_bool(&p, correct); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_check_future_secret_reply(const void *p, bool *correct) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY) - return false; - *correct = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_MESSAGE */ -/* lightningd asks us to sign a string. */ -u8 *towire_hsmd_sign_message(const tal_t *ctx, const u8 *msg) -{ - u16 len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_MESSAGE); - towire_u16(&p, len); - towire_u8_array(&p, msg, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_message(const tal_t *ctx, const void *p, u8 **msg) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_MESSAGE) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_MESSAGE_REPLY */ -u8 *towire_hsmd_sign_message_reply(const tal_t *ctx, const secp256k1_ecdsa_recoverable_signature *sig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_MESSAGE_REPLY); - towire_secp256k1_ecdsa_recoverable_signature(&p, sig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_message_reply(const void *p, secp256k1_ecdsa_recoverable_signature *sig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_MESSAGE_REPLY) - return false; - fromwire_secp256k1_ecdsa_recoverable_signature(&cursor, &plen, sig); - return cursor != NULL; -} - -/* WIRE: HSMD_GET_OUTPUT_SCRIPTPUBKEY */ -/* lightningd needs to get a scriptPubkey for a utxo with closeinfo */ -u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx, u64 channel_id, const struct node_id *peer_id, const struct pubkey *commitment_point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY); - towire_u64(&p, channel_id); - towire_node_id(&p, peer_id); - if (!commitment_point) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, commitment_point); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_get_output_scriptpubkey(const tal_t *ctx, const void *p, u64 *channel_id, struct node_id *peer_id, struct pubkey **commitment_point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY) - return false; - *channel_id = fromwire_u64(&cursor, &plen); - fromwire_node_id(&cursor, &plen, peer_id); - if (!fromwire_bool(&cursor, &plen)) - *commitment_point = NULL; - else { - *commitment_point = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *commitment_point); - } - return cursor != NULL; -} - -/* WIRE: HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY */ -u8 *towire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx, const u8 *script) -{ - u16 script_len = tal_count(script); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY); - towire_u16(&p, script_len); - towire_u8_array(&p, script, script_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx, const void *p, u8 **script) -{ - u16 script_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY) - return false; - script_len = fromwire_u16(&cursor, &plen); - // 2nd case script - *script = script_len ? tal_arr(ctx, u8, script_len) : NULL; - fromwire_u8_array(&cursor, &plen, *script, script_len); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_BOLT12 */ -/* Sign a bolt12-style merkle hash */ -u8 *towire_hsmd_sign_bolt12(const tal_t *ctx, const wirestring *messagename, const wirestring *fieldname, const struct sha256 *merkleroot, const u8 *publictweak) -{ - u16 publictweaklen = tal_count(publictweak); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_BOLT12); - towire_wirestring(&p, messagename); - towire_wirestring(&p, fieldname); - towire_sha256(&p, merkleroot); - /* This is for invreq payer_id (temporary keys) */ - towire_u16(&p, publictweaklen); - towire_u8_array(&p, publictweak, publictweaklen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_bolt12(const tal_t *ctx, const void *p, wirestring **messagename, wirestring **fieldname, struct sha256 *merkleroot, u8 **publictweak) -{ - u16 publictweaklen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_BOLT12) - return false; - *messagename = fromwire_wirestring(ctx, &cursor, &plen); - *fieldname = fromwire_wirestring(ctx, &cursor, &plen); - fromwire_sha256(&cursor, &plen, merkleroot); - /* This is for invreq payer_id (temporary keys) */ - publictweaklen = fromwire_u16(&cursor, &plen); - // 2nd case publictweak - *publictweak = publictweaklen ? tal_arr(ctx, u8, publictweaklen) : NULL; - fromwire_u8_array(&cursor, &plen, *publictweak, publictweaklen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_BOLT12_REPLY */ -u8 *towire_hsmd_sign_bolt12_reply(const tal_t *ctx, const struct bip340sig *sig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_BOLT12_REPLY); - towire_bip340sig(&p, sig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_bolt12_reply(const void *p, struct bip340sig *sig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_BOLT12_REPLY) - return false; - fromwire_bip340sig(&cursor, &plen, sig); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_OPTION_WILL_FUND_OFFER */ -/* Sign an option_will_fund offer hash */ -u8 *towire_hsmd_sign_option_will_fund_offer(const tal_t *ctx, const struct pubkey *funding_pubkey, u32 blockheight, u32 channel_fee_base_max_msat, u16 channel_fee_proportional_basis_max) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER); - towire_pubkey(&p, funding_pubkey); - towire_u32(&p, blockheight); - towire_u32(&p, channel_fee_base_max_msat); - towire_u16(&p, channel_fee_proportional_basis_max); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_option_will_fund_offer(const void *p, struct pubkey *funding_pubkey, u32 *blockheight, u32 *channel_fee_base_max_msat, u16 *channel_fee_proportional_basis_max) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER) - return false; - fromwire_pubkey(&cursor, &plen, funding_pubkey); - *blockheight = fromwire_u32(&cursor, &plen); - *channel_fee_base_max_msat = fromwire_u32(&cursor, &plen); - *channel_fee_proportional_basis_max = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY */ -u8 *towire_hsmd_sign_option_will_fund_offer_reply(const tal_t *ctx, const secp256k1_ecdsa_signature *rsig) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY); - towire_secp256k1_ecdsa_signature(&p, rsig); - - return memcheck(p, tal_count(p)); -} -bool fromwire_hsmd_sign_option_will_fund_offer_reply(const void *p, secp256k1_ecdsa_signature *rsig) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, rsig); - return cursor != NULL; -} -// SHA256STAMP:34afee076f2df0aca89c651f73043e5fbf11817a1ae482d70530212b25a82918 diff --git a/hsmd/hsmd_wiregen.h b/hsmd/hsmd_wiregen.h deleted file mode 100644 index 4a9976305..000000000 --- a/hsmd/hsmd_wiregen.h +++ /dev/null @@ -1,298 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_HSMD_HSMD_WIREGEN_H -#define LIGHTNING_HSMD_HSMD_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include - -enum hsmd_wire { - /* Clients should not give a bad request but not the HSM's decision to crash. */ - WIRE_HSMSTATUS_CLIENT_BAD_REQUEST = 1000, - /* Start the HSM. */ - WIRE_HSMD_INIT = 11, - WIRE_HSMD_INIT_REPLY = 111, - /* Get a new HSM FD */ - WIRE_HSMD_CLIENT_HSMFD = 9, - /* No content */ - WIRE_HSMD_CLIENT_HSMFD_REPLY = 109, - /* Get the basepoints and funding key for this specific channel. */ - WIRE_HSMD_GET_CHANNEL_BASEPOINTS = 10, - WIRE_HSMD_GET_CHANNEL_BASEPOINTS_REPLY = 110, - /* Master asks the HSM to sign a node_announcement */ - WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REQ = 6, - WIRE_HSMD_NODE_ANNOUNCEMENT_SIG_REPLY = 106, - /* Sign a withdrawal request */ - WIRE_HSMD_SIGN_WITHDRAWAL = 7, - WIRE_HSMD_SIGN_WITHDRAWAL_REPLY = 107, - /* Sign an invoice */ - WIRE_HSMD_SIGN_INVOICE = 8, - WIRE_HSMD_SIGN_INVOICE_REPLY = 108, - /* Give me ECDH(node-id-secret */ - WIRE_HSMD_ECDH_REQ = 1, - WIRE_HSMD_ECDH_RESP = 100, - WIRE_HSMD_CANNOUNCEMENT_SIG_REQ = 2, - WIRE_HSMD_CANNOUNCEMENT_SIG_REPLY = 102, - WIRE_HSMD_CUPDATE_SIG_REQ = 3, - WIRE_HSMD_CUPDATE_SIG_REPLY = 103, - /* Master asks HSM to sign a commitment transaction. */ - WIRE_HSMD_SIGN_COMMITMENT_TX = 5, - WIRE_HSMD_SIGN_COMMITMENT_TX_REPLY = 105, - /* Onchaind asks HSM to sign a spend to-us. Four variants */ - /* of keys is derived differently... */ - /* FIXME: Have master tell hsmd the keyindex */ - WIRE_HSMD_SIGN_DELAYED_PAYMENT_TO_US = 12, - WIRE_HSMD_SIGN_REMOTE_HTLC_TO_US = 13, - WIRE_HSMD_SIGN_PENALTY_TO_US = 14, - /* Onchaind asks HSM to sign a local HTLC success or HTLC timeout tx. */ - WIRE_HSMD_SIGN_LOCAL_HTLC_TX = 16, - /* Openingd/channeld asks HSM to sign the other sides' commitment tx. */ - WIRE_HSMD_SIGN_REMOTE_COMMITMENT_TX = 19, - /* channeld asks HSM to sign remote HTLC tx. */ - WIRE_HSMD_SIGN_REMOTE_HTLC_TX = 20, - /* closingd asks HSM to sign mutual close tx. */ - WIRE_HSMD_SIGN_MUTUAL_CLOSE_TX = 21, - /* Reply for all the above requests. */ - WIRE_HSMD_SIGN_TX_REPLY = 112, - /* Openingd/channeld/onchaind asks for Nth per_commitment_point */ - WIRE_HSMD_GET_PER_COMMITMENT_POINT = 18, - WIRE_HSMD_GET_PER_COMMITMENT_POINT_REPLY = 118, - /* master -> hsmd: do you have a memleak? */ - WIRE_HSMD_DEV_MEMLEAK = 33, - WIRE_HSMD_DEV_MEMLEAK_REPLY = 133, - /* channeld asks to check if claimed future commitment_secret is correct. */ - WIRE_HSMD_CHECK_FUTURE_SECRET = 22, - WIRE_HSMD_CHECK_FUTURE_SECRET_REPLY = 122, - /* lightningd asks us to sign a string. */ - WIRE_HSMD_SIGN_MESSAGE = 23, - WIRE_HSMD_SIGN_MESSAGE_REPLY = 123, - /* lightningd needs to get a scriptPubkey for a utxo with closeinfo */ - WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY = 24, - WIRE_HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY = 124, - /* Sign a bolt12-style merkle hash */ - WIRE_HSMD_SIGN_BOLT12 = 25, - WIRE_HSMD_SIGN_BOLT12_REPLY = 125, - /* Sign an option_will_fund offer hash */ - WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER = 26, - WIRE_HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY = 126, -}; - -const char *hsmd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool hsmd_wire_is_defined(u16 type); - - -/* WIRE: HSMSTATUS_CLIENT_BAD_REQUEST */ -/* Clients should not give a bad request but not the HSM's decision to crash. */ -u8 *towire_hsmstatus_client_bad_request(const tal_t *ctx, const struct node_id *id, const wirestring *description, const u8 *msg); -bool fromwire_hsmstatus_client_bad_request(const tal_t *ctx, const void *p, struct node_id *id, wirestring **description, u8 **msg); - -/* WIRE: HSMD_INIT */ -/* Start the HSM. */ -u8 *towire_hsmd_init(const tal_t *ctx, const struct bip32_key_version *bip32_key_version, const struct chainparams *chainparams, const struct secret *hsm_encryption_key, const struct privkey *dev_force_privkey, const struct secret *dev_force_bip32_seed, const struct secrets *dev_force_channel_secrets, const struct sha256 *dev_force_channel_secrets_shaseed); -bool fromwire_hsmd_init(const tal_t *ctx, const void *p, struct bip32_key_version *bip32_key_version, const struct chainparams **chainparams, struct secret **hsm_encryption_key, struct privkey **dev_force_privkey, struct secret **dev_force_bip32_seed, struct secrets **dev_force_channel_secrets, struct sha256 **dev_force_channel_secrets_shaseed); - -/* WIRE: HSMD_INIT_REPLY */ -u8 *towire_hsmd_init_reply(const tal_t *ctx, const struct node_id *node_id, const struct ext_key *bip32, const struct pubkey32 *bolt12, const struct secret *onion_reply_secret); -bool fromwire_hsmd_init_reply(const void *p, struct node_id *node_id, struct ext_key *bip32, struct pubkey32 *bolt12, struct secret *onion_reply_secret); - -/* WIRE: HSMD_CLIENT_HSMFD */ -/* Get a new HSM FD */ -u8 *towire_hsmd_client_hsmfd(const tal_t *ctx, const struct node_id *id, u64 dbid, u64 capabilities); -bool fromwire_hsmd_client_hsmfd(const void *p, struct node_id *id, u64 *dbid, u64 *capabilities); - -/* WIRE: HSMD_CLIENT_HSMFD_REPLY */ -/* No content */ -u8 *towire_hsmd_client_hsmfd_reply(const tal_t *ctx); -bool fromwire_hsmd_client_hsmfd_reply(const void *p); - -/* WIRE: HSMD_GET_CHANNEL_BASEPOINTS */ -/* Get the basepoints and funding key for this specific channel. */ -u8 *towire_hsmd_get_channel_basepoints(const tal_t *ctx, const struct node_id *peerid, u64 dbid); -bool fromwire_hsmd_get_channel_basepoints(const void *p, struct node_id *peerid, u64 *dbid); - -/* WIRE: HSMD_GET_CHANNEL_BASEPOINTS_REPLY */ -u8 *towire_hsmd_get_channel_basepoints_reply(const tal_t *ctx, const struct basepoints *basepoints, const struct pubkey *funding_pubkey); -bool fromwire_hsmd_get_channel_basepoints_reply(const void *p, struct basepoints *basepoints, struct pubkey *funding_pubkey); - -/* WIRE: HSMD_NODE_ANNOUNCEMENT_SIG_REQ */ -/* Master asks the HSM to sign a node_announcement */ -u8 *towire_hsmd_node_announcement_sig_req(const tal_t *ctx, const u8 *announcement); -bool fromwire_hsmd_node_announcement_sig_req(const tal_t *ctx, const void *p, u8 **announcement); - -/* WIRE: HSMD_NODE_ANNOUNCEMENT_SIG_REPLY */ -u8 *towire_hsmd_node_announcement_sig_reply(const tal_t *ctx, const secp256k1_ecdsa_signature *signature); -bool fromwire_hsmd_node_announcement_sig_reply(const void *p, secp256k1_ecdsa_signature *signature); - -/* WIRE: HSMD_SIGN_WITHDRAWAL */ -/* Sign a withdrawal request */ -u8 *towire_hsmd_sign_withdrawal(const tal_t *ctx, const struct utxo **inputs, const struct wally_psbt *psbt); -bool fromwire_hsmd_sign_withdrawal(const tal_t *ctx, const void *p, struct utxo ***inputs, struct wally_psbt **psbt); - -/* WIRE: HSMD_SIGN_WITHDRAWAL_REPLY */ -u8 *towire_hsmd_sign_withdrawal_reply(const tal_t *ctx, const struct wally_psbt *psbt); -bool fromwire_hsmd_sign_withdrawal_reply(const tal_t *ctx, const void *p, struct wally_psbt **psbt); - -/* WIRE: HSMD_SIGN_INVOICE */ -/* Sign an invoice */ -u8 *towire_hsmd_sign_invoice(const tal_t *ctx, const u8 *u5bytes, const u8 *hrp); -bool fromwire_hsmd_sign_invoice(const tal_t *ctx, const void *p, u8 **u5bytes, u8 **hrp); - -/* WIRE: HSMD_SIGN_INVOICE_REPLY */ -u8 *towire_hsmd_sign_invoice_reply(const tal_t *ctx, const secp256k1_ecdsa_recoverable_signature *sig); -bool fromwire_hsmd_sign_invoice_reply(const void *p, secp256k1_ecdsa_recoverable_signature *sig); - -/* WIRE: HSMD_ECDH_REQ */ -/* Give me ECDH(node-id-secret */ -u8 *towire_hsmd_ecdh_req(const tal_t *ctx, const struct pubkey *point); -bool fromwire_hsmd_ecdh_req(const void *p, struct pubkey *point); - -/* WIRE: HSMD_ECDH_RESP */ -u8 *towire_hsmd_ecdh_resp(const tal_t *ctx, const struct secret *ss); -bool fromwire_hsmd_ecdh_resp(const void *p, struct secret *ss); - -/* WIRE: HSMD_CANNOUNCEMENT_SIG_REQ */ -u8 *towire_hsmd_cannouncement_sig_req(const tal_t *ctx, const u8 *ca); -bool fromwire_hsmd_cannouncement_sig_req(const tal_t *ctx, const void *p, u8 **ca); - -/* WIRE: HSMD_CANNOUNCEMENT_SIG_REPLY */ -u8 *towire_hsmd_cannouncement_sig_reply(const tal_t *ctx, const secp256k1_ecdsa_signature *node_signature, const secp256k1_ecdsa_signature *bitcoin_signature); -bool fromwire_hsmd_cannouncement_sig_reply(const void *p, secp256k1_ecdsa_signature *node_signature, secp256k1_ecdsa_signature *bitcoin_signature); - -/* WIRE: HSMD_CUPDATE_SIG_REQ */ -u8 *towire_hsmd_cupdate_sig_req(const tal_t *ctx, const u8 *cu); -bool fromwire_hsmd_cupdate_sig_req(const tal_t *ctx, const void *p, u8 **cu); - -/* WIRE: HSMD_CUPDATE_SIG_REPLY */ -u8 *towire_hsmd_cupdate_sig_reply(const tal_t *ctx, const u8 *cu); -bool fromwire_hsmd_cupdate_sig_reply(const tal_t *ctx, const void *p, u8 **cu); - -/* WIRE: HSMD_SIGN_COMMITMENT_TX */ -/* Master asks HSM to sign a commitment transaction. */ -u8 *towire_hsmd_sign_commitment_tx(const tal_t *ctx, const struct node_id *peer_id, u64 channel_dbid, const struct bitcoin_tx *tx, const struct pubkey *remote_funding_key); -bool fromwire_hsmd_sign_commitment_tx(const tal_t *ctx, const void *p, struct node_id *peer_id, u64 *channel_dbid, struct bitcoin_tx **tx, struct pubkey *remote_funding_key); - -/* WIRE: HSMD_SIGN_COMMITMENT_TX_REPLY */ -u8 *towire_hsmd_sign_commitment_tx_reply(const tal_t *ctx, const struct bitcoin_signature *sig); -bool fromwire_hsmd_sign_commitment_tx_reply(const void *p, struct bitcoin_signature *sig); - -/* WIRE: HSMD_SIGN_DELAYED_PAYMENT_TO_US */ -/* Onchaind asks HSM to sign a spend to-us. Four variants */ -/* of keys is derived differently... */ -/* FIXME: Have master tell hsmd the keyindex */ -u8 *towire_hsmd_sign_delayed_payment_to_us(const tal_t *ctx, u64 commit_num, const struct bitcoin_tx *tx, const u8 *wscript); -bool fromwire_hsmd_sign_delayed_payment_to_us(const tal_t *ctx, const void *p, u64 *commit_num, struct bitcoin_tx **tx, u8 **wscript); - -/* WIRE: HSMD_SIGN_REMOTE_HTLC_TO_US */ -u8 *towire_hsmd_sign_remote_htlc_to_us(const tal_t *ctx, const struct pubkey *remote_per_commitment_point, const struct bitcoin_tx *tx, const u8 *wscript, bool option_anchor_outputs); -bool fromwire_hsmd_sign_remote_htlc_to_us(const tal_t *ctx, const void *p, struct pubkey *remote_per_commitment_point, struct bitcoin_tx **tx, u8 **wscript, bool *option_anchor_outputs); - -/* WIRE: HSMD_SIGN_PENALTY_TO_US */ -u8 *towire_hsmd_sign_penalty_to_us(const tal_t *ctx, const struct secret *revocation_secret, const struct bitcoin_tx *tx, const u8 *wscript); -bool fromwire_hsmd_sign_penalty_to_us(const tal_t *ctx, const void *p, struct secret *revocation_secret, struct bitcoin_tx **tx, u8 **wscript); - -/* WIRE: HSMD_SIGN_LOCAL_HTLC_TX */ -/* Onchaind asks HSM to sign a local HTLC success or HTLC timeout tx. */ -u8 *towire_hsmd_sign_local_htlc_tx(const tal_t *ctx, u64 commit_num, const struct bitcoin_tx *tx, const u8 *wscript, bool option_anchor_outputs); -bool fromwire_hsmd_sign_local_htlc_tx(const tal_t *ctx, const void *p, u64 *commit_num, struct bitcoin_tx **tx, u8 **wscript, bool *option_anchor_outputs); - -/* WIRE: HSMD_SIGN_REMOTE_COMMITMENT_TX */ -/* Openingd/channeld asks HSM to sign the other sides' commitment tx. */ -u8 *towire_hsmd_sign_remote_commitment_tx(const tal_t *ctx, const struct bitcoin_tx *tx, const struct pubkey *remote_funding_key, const struct pubkey *remote_per_commit, bool option_static_remotekey); -bool fromwire_hsmd_sign_remote_commitment_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, struct pubkey *remote_funding_key, struct pubkey *remote_per_commit, bool *option_static_remotekey); - -/* WIRE: HSMD_SIGN_REMOTE_HTLC_TX */ -/* channeld asks HSM to sign remote HTLC tx. */ -u8 *towire_hsmd_sign_remote_htlc_tx(const tal_t *ctx, const struct bitcoin_tx *tx, const u8 *wscript, const struct pubkey *remote_per_commit_point, bool option_anchor_outputs); -bool fromwire_hsmd_sign_remote_htlc_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, u8 **wscript, struct pubkey *remote_per_commit_point, bool *option_anchor_outputs); - -/* WIRE: HSMD_SIGN_MUTUAL_CLOSE_TX */ -/* closingd asks HSM to sign mutual close tx. */ -u8 *towire_hsmd_sign_mutual_close_tx(const tal_t *ctx, const struct bitcoin_tx *tx, const struct pubkey *remote_funding_key); -bool fromwire_hsmd_sign_mutual_close_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, struct pubkey *remote_funding_key); - -/* WIRE: HSMD_SIGN_TX_REPLY */ -/* Reply for all the above requests. */ -u8 *towire_hsmd_sign_tx_reply(const tal_t *ctx, const struct bitcoin_signature *sig); -bool fromwire_hsmd_sign_tx_reply(const void *p, struct bitcoin_signature *sig); - -/* WIRE: HSMD_GET_PER_COMMITMENT_POINT */ -/* Openingd/channeld/onchaind asks for Nth per_commitment_point */ -u8 *towire_hsmd_get_per_commitment_point(const tal_t *ctx, u64 n); -bool fromwire_hsmd_get_per_commitment_point(const void *p, u64 *n); - -/* WIRE: HSMD_GET_PER_COMMITMENT_POINT_REPLY */ -u8 *towire_hsmd_get_per_commitment_point_reply(const tal_t *ctx, const struct pubkey *per_commitment_point, const struct secret *old_commitment_secret); -bool fromwire_hsmd_get_per_commitment_point_reply(const tal_t *ctx, const void *p, struct pubkey *per_commitment_point, struct secret **old_commitment_secret); - -/* WIRE: HSMD_DEV_MEMLEAK */ -/* master -> hsmd: do you have a memleak? */ -u8 *towire_hsmd_dev_memleak(const tal_t *ctx); -bool fromwire_hsmd_dev_memleak(const void *p); - -/* WIRE: HSMD_DEV_MEMLEAK_REPLY */ -u8 *towire_hsmd_dev_memleak_reply(const tal_t *ctx, bool leak); -bool fromwire_hsmd_dev_memleak_reply(const void *p, bool *leak); - -/* WIRE: HSMD_CHECK_FUTURE_SECRET */ -/* channeld asks to check if claimed future commitment_secret is correct. */ -u8 *towire_hsmd_check_future_secret(const tal_t *ctx, u64 n, const struct secret *commitment_secret); -bool fromwire_hsmd_check_future_secret(const void *p, u64 *n, struct secret *commitment_secret); - -/* WIRE: HSMD_CHECK_FUTURE_SECRET_REPLY */ -u8 *towire_hsmd_check_future_secret_reply(const tal_t *ctx, bool correct); -bool fromwire_hsmd_check_future_secret_reply(const void *p, bool *correct); - -/* WIRE: HSMD_SIGN_MESSAGE */ -/* lightningd asks us to sign a string. */ -u8 *towire_hsmd_sign_message(const tal_t *ctx, const u8 *msg); -bool fromwire_hsmd_sign_message(const tal_t *ctx, const void *p, u8 **msg); - -/* WIRE: HSMD_SIGN_MESSAGE_REPLY */ -u8 *towire_hsmd_sign_message_reply(const tal_t *ctx, const secp256k1_ecdsa_recoverable_signature *sig); -bool fromwire_hsmd_sign_message_reply(const void *p, secp256k1_ecdsa_recoverable_signature *sig); - -/* WIRE: HSMD_GET_OUTPUT_SCRIPTPUBKEY */ -/* lightningd needs to get a scriptPubkey for a utxo with closeinfo */ -u8 *towire_hsmd_get_output_scriptpubkey(const tal_t *ctx, u64 channel_id, const struct node_id *peer_id, const struct pubkey *commitment_point); -bool fromwire_hsmd_get_output_scriptpubkey(const tal_t *ctx, const void *p, u64 *channel_id, struct node_id *peer_id, struct pubkey **commitment_point); - -/* WIRE: HSMD_GET_OUTPUT_SCRIPTPUBKEY_REPLY */ -u8 *towire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx, const u8 *script); -bool fromwire_hsmd_get_output_scriptpubkey_reply(const tal_t *ctx, const void *p, u8 **script); - -/* WIRE: HSMD_SIGN_BOLT12 */ -/* Sign a bolt12-style merkle hash */ -u8 *towire_hsmd_sign_bolt12(const tal_t *ctx, const wirestring *messagename, const wirestring *fieldname, const struct sha256 *merkleroot, const u8 *publictweak); -bool fromwire_hsmd_sign_bolt12(const tal_t *ctx, const void *p, wirestring **messagename, wirestring **fieldname, struct sha256 *merkleroot, u8 **publictweak); - -/* WIRE: HSMD_SIGN_BOLT12_REPLY */ -u8 *towire_hsmd_sign_bolt12_reply(const tal_t *ctx, const struct bip340sig *sig); -bool fromwire_hsmd_sign_bolt12_reply(const void *p, struct bip340sig *sig); - -/* WIRE: HSMD_SIGN_OPTION_WILL_FUND_OFFER */ -/* Sign an option_will_fund offer hash */ -u8 *towire_hsmd_sign_option_will_fund_offer(const tal_t *ctx, const struct pubkey *funding_pubkey, u32 blockheight, u32 channel_fee_base_max_msat, u16 channel_fee_proportional_basis_max); -bool fromwire_hsmd_sign_option_will_fund_offer(const void *p, struct pubkey *funding_pubkey, u32 *blockheight, u32 *channel_fee_base_max_msat, u16 *channel_fee_proportional_basis_max); - -/* WIRE: HSMD_SIGN_OPTION_WILL_FUND_OFFER_REPLY */ -u8 *towire_hsmd_sign_option_will_fund_offer_reply(const tal_t *ctx, const secp256k1_ecdsa_signature *rsig); -bool fromwire_hsmd_sign_option_will_fund_offer_reply(const void *p, secp256k1_ecdsa_signature *rsig); - - -#endif /* LIGHTNING_HSMD_HSMD_WIREGEN_H */ -// SHA256STAMP:34afee076f2df0aca89c651f73043e5fbf11817a1ae482d70530212b25a82918 diff --git a/onchaind/onchaind_wiregen.c b/onchaind/onchaind_wiregen.c deleted file mode 100644 index c3be88778..000000000 --- a/onchaind/onchaind_wiregen.c +++ /dev/null @@ -1,642 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *onchaind_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum onchaind_wire)e) { - case WIRE_ONCHAIND_INIT: return "WIRE_ONCHAIND_INIT"; - case WIRE_ONCHAIND_HTLC: return "WIRE_ONCHAIND_HTLC"; - case WIRE_ONCHAIND_INIT_REPLY: return "WIRE_ONCHAIND_INIT_REPLY"; - case WIRE_ONCHAIND_BROADCAST_TX: return "WIRE_ONCHAIND_BROADCAST_TX"; - case WIRE_ONCHAIND_SPENT: return "WIRE_ONCHAIND_SPENT"; - case WIRE_ONCHAIND_DEPTH: return "WIRE_ONCHAIND_DEPTH"; - case WIRE_ONCHAIND_UNWATCH_TX: return "WIRE_ONCHAIND_UNWATCH_TX"; - case WIRE_ONCHAIND_KNOWN_PREIMAGE: return "WIRE_ONCHAIND_KNOWN_PREIMAGE"; - case WIRE_ONCHAIND_EXTRACTED_PREIMAGE: return "WIRE_ONCHAIND_EXTRACTED_PREIMAGE"; - case WIRE_ONCHAIND_MISSING_HTLC_OUTPUT: return "WIRE_ONCHAIND_MISSING_HTLC_OUTPUT"; - case WIRE_ONCHAIND_HTLC_TIMEOUT: return "WIRE_ONCHAIND_HTLC_TIMEOUT"; - case WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED: return "WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED"; - case WIRE_ONCHAIND_ADD_UTXO: return "WIRE_ONCHAIND_ADD_UTXO"; - case WIRE_ONCHAIND_DEV_MEMLEAK: return "WIRE_ONCHAIND_DEV_MEMLEAK"; - case WIRE_ONCHAIND_DEV_MEMLEAK_REPLY: return "WIRE_ONCHAIND_DEV_MEMLEAK_REPLY"; - case WIRE_ONCHAIND_ANNOTATE_TXOUT: return "WIRE_ONCHAIND_ANNOTATE_TXOUT"; - case WIRE_ONCHAIND_ANNOTATE_TXIN: return "WIRE_ONCHAIND_ANNOTATE_TXIN"; - case WIRE_ONCHAIND_NOTIFY_COIN_MVT: return "WIRE_ONCHAIND_NOTIFY_COIN_MVT"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool onchaind_wire_is_defined(u16 type) -{ - switch ((enum onchaind_wire)type) { - case WIRE_ONCHAIND_INIT:; - case WIRE_ONCHAIND_HTLC:; - case WIRE_ONCHAIND_INIT_REPLY:; - case WIRE_ONCHAIND_BROADCAST_TX:; - case WIRE_ONCHAIND_SPENT:; - case WIRE_ONCHAIND_DEPTH:; - case WIRE_ONCHAIND_UNWATCH_TX:; - case WIRE_ONCHAIND_KNOWN_PREIMAGE:; - case WIRE_ONCHAIND_EXTRACTED_PREIMAGE:; - case WIRE_ONCHAIND_MISSING_HTLC_OUTPUT:; - case WIRE_ONCHAIND_HTLC_TIMEOUT:; - case WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED:; - case WIRE_ONCHAIND_ADD_UTXO:; - case WIRE_ONCHAIND_DEV_MEMLEAK:; - case WIRE_ONCHAIND_DEV_MEMLEAK_REPLY:; - case WIRE_ONCHAIND_ANNOTATE_TXOUT:; - case WIRE_ONCHAIND_ANNOTATE_TXIN:; - case WIRE_ONCHAIND_NOTIFY_COIN_MVT:; - return true; - } - return false; -} - - - - - -/* WIRE: ONCHAIND_INIT */ -/* Begin! Here's the onchain tx which spends funding tx */ -u8 *towire_onchaind_init(const tal_t *ctx, const struct shachain *shachain, const struct chainparams *chainparams, struct amount_sat funding_amount_satoshi, struct amount_msat our_msat, const struct pubkey *old_remote_per_commitment_point, const struct pubkey *remote_per_commitment_point, u32 local_to_self_delay, u32 remote_to_self_delay, u32 delayed_to_us_feerate, u32 htlc_feerate, u32 penalty_feerate, struct amount_sat local_dust_limit_satoshi, const struct bitcoin_txid *our_broadcast_txid, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, const struct pubkey *ourwallet_pubkey, enum side opener, const struct basepoints *local_basepoints, const struct basepoints *remote_basepoints, const struct tx_parts *tx_parts, u32 locktime, u32 tx_blockheight, u32 reasonable_depth, const struct bitcoin_signature *htlc_signature, u64 num_htlcs, u32 min_possible_feerate, u32 max_possible_feerate, const struct pubkey *possible_remote_per_commit_point, const struct pubkey *local_funding_pubkey, const struct pubkey *remote_funding_pubkey, u64 local_static_remotekey_start, u64 remote_static_remotekey_start, bool option_anchor_outputs, bool is_replay, u32 min_relay_feerate) -{ - u16 local_scriptpubkey_len = tal_count(local_scriptpubkey); - u16 remote_scriptpubkey_len = tal_count(remote_scriptpubkey); - u16 num_htlc_sigs = tal_count(htlc_signature); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_INIT); - towire_shachain(&p, shachain); - /* This needs to be set explicitly since the same message also contains a */ - /* transaction that we need to parse correctly. */ - towire_chainparams(&p, chainparams); - towire_amount_sat(&p, funding_amount_satoshi); - /* Our current balance (of funding amount */ - towire_amount_msat(&p, our_msat); - /* Remote per commit point for committed tx. */ - towire_pubkey(&p, old_remote_per_commitment_point); - /* Remote per commit point for current tx (needed if we haven't got revoke_and_ack yet). */ - towire_pubkey(&p, remote_per_commitment_point); - towire_u32(&p, local_to_self_delay); - towire_u32(&p, remote_to_self_delay); - towire_u32(&p, delayed_to_us_feerate); - towire_u32(&p, htlc_feerate); - towire_u32(&p, penalty_feerate); - towire_amount_sat(&p, local_dust_limit_satoshi); - /* Gives an easy way to tell if it's our unilateral close or theirs... */ - towire_bitcoin_txid(&p, our_broadcast_txid); - towire_u16(&p, local_scriptpubkey_len); - towire_u8_array(&p, local_scriptpubkey, local_scriptpubkey_len); - towire_u16(&p, remote_scriptpubkey_len); - towire_u8_array(&p, remote_scriptpubkey, remote_scriptpubkey_len); - towire_pubkey(&p, ourwallet_pubkey); - /* We need these two for commit number obscurer */ - towire_side(&p, opener); - towire_basepoints(&p, local_basepoints); - towire_basepoints(&p, remote_basepoints); - towire_tx_parts(&p, tx_parts); - towire_u32(&p, locktime); - towire_u32(&p, tx_blockheight); - towire_u32(&p, reasonable_depth); - towire_u16(&p, num_htlc_sigs); - for (size_t i = 0; i < num_htlc_sigs; i++) - towire_bitcoin_signature(&p, htlc_signature + i); - towire_u64(&p, num_htlcs); - towire_u32(&p, min_possible_feerate); - towire_u32(&p, max_possible_feerate); - if (!possible_remote_per_commit_point) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, possible_remote_per_commit_point); - } - towire_pubkey(&p, local_funding_pubkey); - towire_pubkey(&p, remote_funding_pubkey); - towire_u64(&p, local_static_remotekey_start); - towire_u64(&p, remote_static_remotekey_start); - towire_bool(&p, option_anchor_outputs); - towire_bool(&p, is_replay); - /* We need this for BIP125 rule 4 */ - towire_u32(&p, min_relay_feerate); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_init(const tal_t *ctx, const void *p, struct shachain *shachain, const struct chainparams **chainparams, struct amount_sat *funding_amount_satoshi, struct amount_msat *our_msat, struct pubkey *old_remote_per_commitment_point, struct pubkey *remote_per_commitment_point, u32 *local_to_self_delay, u32 *remote_to_self_delay, u32 *delayed_to_us_feerate, u32 *htlc_feerate, u32 *penalty_feerate, struct amount_sat *local_dust_limit_satoshi, struct bitcoin_txid *our_broadcast_txid, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, struct pubkey *ourwallet_pubkey, enum side *opener, struct basepoints *local_basepoints, struct basepoints *remote_basepoints, struct tx_parts **tx_parts, u32 *locktime, u32 *tx_blockheight, u32 *reasonable_depth, struct bitcoin_signature **htlc_signature, u64 *num_htlcs, u32 *min_possible_feerate, u32 *max_possible_feerate, struct pubkey **possible_remote_per_commit_point, struct pubkey *local_funding_pubkey, struct pubkey *remote_funding_pubkey, u64 *local_static_remotekey_start, u64 *remote_static_remotekey_start, bool *option_anchor_outputs, bool *is_replay, u32 *min_relay_feerate) -{ - u16 local_scriptpubkey_len; - u16 remote_scriptpubkey_len; - u16 num_htlc_sigs; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_INIT) - return false; - fromwire_shachain(&cursor, &plen, shachain); - /* This needs to be set explicitly since the same message also contains a */ - /* transaction that we need to parse correctly. */ - fromwire_chainparams(&cursor, &plen, chainparams); - *funding_amount_satoshi = fromwire_amount_sat(&cursor, &plen); - /* Our current balance (of funding amount */ - *our_msat = fromwire_amount_msat(&cursor, &plen); - /* Remote per commit point for committed tx. */ - fromwire_pubkey(&cursor, &plen, old_remote_per_commitment_point); - /* Remote per commit point for current tx (needed if we haven't got revoke_and_ack yet). */ - fromwire_pubkey(&cursor, &plen, remote_per_commitment_point); - *local_to_self_delay = fromwire_u32(&cursor, &plen); - *remote_to_self_delay = fromwire_u32(&cursor, &plen); - *delayed_to_us_feerate = fromwire_u32(&cursor, &plen); - *htlc_feerate = fromwire_u32(&cursor, &plen); - *penalty_feerate = fromwire_u32(&cursor, &plen); - *local_dust_limit_satoshi = fromwire_amount_sat(&cursor, &plen); - /* Gives an easy way to tell if it's our unilateral close or theirs... */ - fromwire_bitcoin_txid(&cursor, &plen, our_broadcast_txid); - local_scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case local_scriptpubkey - *local_scriptpubkey = local_scriptpubkey_len ? tal_arr(ctx, u8, local_scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *local_scriptpubkey, local_scriptpubkey_len); - remote_scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case remote_scriptpubkey - *remote_scriptpubkey = remote_scriptpubkey_len ? tal_arr(ctx, u8, remote_scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *remote_scriptpubkey, remote_scriptpubkey_len); - fromwire_pubkey(&cursor, &plen, ourwallet_pubkey); - /* We need these two for commit number obscurer */ - *opener = fromwire_side(&cursor, &plen); - fromwire_basepoints(&cursor, &plen, local_basepoints); - fromwire_basepoints(&cursor, &plen, remote_basepoints); - *tx_parts = fromwire_tx_parts(ctx, &cursor, &plen); - *locktime = fromwire_u32(&cursor, &plen); - *tx_blockheight = fromwire_u32(&cursor, &plen); - *reasonable_depth = fromwire_u32(&cursor, &plen); - num_htlc_sigs = fromwire_u16(&cursor, &plen); - // 2nd case htlc_signature - *htlc_signature = num_htlc_sigs ? tal_arr(ctx, struct bitcoin_signature, num_htlc_sigs) : NULL; - for (size_t i = 0; i < num_htlc_sigs; i++) - fromwire_bitcoin_signature(&cursor, &plen, *htlc_signature + i); - *num_htlcs = fromwire_u64(&cursor, &plen); - *min_possible_feerate = fromwire_u32(&cursor, &plen); - *max_possible_feerate = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *possible_remote_per_commit_point = NULL; - else { - *possible_remote_per_commit_point = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *possible_remote_per_commit_point); - } - fromwire_pubkey(&cursor, &plen, local_funding_pubkey); - fromwire_pubkey(&cursor, &plen, remote_funding_pubkey); - *local_static_remotekey_start = fromwire_u64(&cursor, &plen); - *remote_static_remotekey_start = fromwire_u64(&cursor, &plen); - *option_anchor_outputs = fromwire_bool(&cursor, &plen); - *is_replay = fromwire_bool(&cursor, &plen); - /* We need this for BIP125 rule 4 */ - *min_relay_feerate = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_HTLC */ -/* This is all the HTLCs: one per message */ -u8 *towire_onchaind_htlc(const tal_t *ctx, const struct htlc_stub *htlc, bool tell_if_missing, bool tell_immediately) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_HTLC); - towire_htlc_stub(&p, htlc); - /* If it's not in the commitment tx */ - towire_bool(&p, tell_if_missing); - towire_bool(&p, tell_immediately); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_htlc(const void *p, struct htlc_stub *htlc, bool *tell_if_missing, bool *tell_immediately) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_HTLC) - return false; - fromwire_htlc_stub(&cursor, &plen, htlc); - /* If it's not in the commitment tx */ - *tell_if_missing = fromwire_bool(&cursor, &plen); - *tell_immediately = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_INIT_REPLY */ -/* This says we're ready; give us preimages. */ -u8 *towire_onchaind_init_reply(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_INIT_REPLY); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_init_reply(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_INIT_REPLY) - return false; - return cursor != NULL; -} - -/* WIRE: ONCHAIND_BROADCAST_TX */ -/* onchaind->master: Send out a tx. */ -/* If is_rbf is false then master should rebroadcast the tx. */ -/* If is_rbf is true then onchaind is responsible for rebroadcasting */ -/* it with a higher fee. */ -u8 *towire_onchaind_broadcast_tx(const tal_t *ctx, const struct bitcoin_tx *tx, enum wallet_tx_type type, bool is_rbf) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_BROADCAST_TX); - towire_bitcoin_tx(&p, tx); - towire_wallet_tx_type(&p, type); - towire_bool(&p, is_rbf); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_broadcast_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, enum wallet_tx_type *type, bool *is_rbf) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_BROADCAST_TX) - return false; - *tx = fromwire_bitcoin_tx(ctx, &cursor, &plen); - *type = fromwire_wallet_tx_type(&cursor, &plen); - *is_rbf = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_SPENT */ -/* master->onchaind: Notifier that an output has been spent by input_num of tx. */ -u8 *towire_onchaind_spent(const tal_t *ctx, const struct tx_parts *tx, u32 input_num, u32 blockheight, bool is_replay) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_SPENT); - towire_tx_parts(&p, tx); - towire_u32(&p, input_num); - towire_u32(&p, blockheight); - towire_bool(&p, is_replay); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_spent(const tal_t *ctx, const void *p, struct tx_parts **tx, u32 *input_num, u32 *blockheight, bool *is_replay) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_SPENT) - return false; - *tx = fromwire_tx_parts(ctx, &cursor, &plen); - *input_num = fromwire_u32(&cursor, &plen); - *blockheight = fromwire_u32(&cursor, &plen); - *is_replay = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_DEPTH */ -/* master->onchaind: We will receive more than one of these */ -u8 *towire_onchaind_depth(const tal_t *ctx, const struct bitcoin_txid *txid, u32 depth, bool is_replay) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_DEPTH); - towire_bitcoin_txid(&p, txid); - towire_u32(&p, depth); - towire_bool(&p, is_replay); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_depth(const void *p, struct bitcoin_txid *txid, u32 *depth, bool *is_replay) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_DEPTH) - return false; - fromwire_bitcoin_txid(&cursor, &plen, txid); - *depth = fromwire_u32(&cursor, &plen); - *is_replay = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_UNWATCH_TX */ -/* onchaind->master: We don't want to watch this tx */ -u8 *towire_onchaind_unwatch_tx(const tal_t *ctx, const struct bitcoin_txid *txid) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_UNWATCH_TX); - towire_bitcoin_txid(&p, txid); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_unwatch_tx(const void *p, struct bitcoin_txid *txid) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_UNWATCH_TX) - return false; - fromwire_bitcoin_txid(&cursor, &plen, txid); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_KNOWN_PREIMAGE */ -/* master->onchaind: We know HTLC preimage */ -u8 *towire_onchaind_known_preimage(const tal_t *ctx, const struct preimage *preimage, bool is_replay) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_KNOWN_PREIMAGE); - towire_preimage(&p, preimage); - towire_bool(&p, is_replay); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_known_preimage(const void *p, struct preimage *preimage, bool *is_replay) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_KNOWN_PREIMAGE) - return false; - fromwire_preimage(&cursor, &plen, preimage); - *is_replay = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_EXTRACTED_PREIMAGE */ -/* onchaind->master: We discovered HTLC preimage */ -u8 *towire_onchaind_extracted_preimage(const tal_t *ctx, const struct preimage *preimage) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_EXTRACTED_PREIMAGE); - towire_preimage(&p, preimage); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_extracted_preimage(const void *p, struct preimage *preimage) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_EXTRACTED_PREIMAGE) - return false; - fromwire_preimage(&cursor, &plen, preimage); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_MISSING_HTLC_OUTPUT */ -/* onchaind->master: this HTLC was missing from commit tx. */ -u8 *towire_onchaind_missing_htlc_output(const tal_t *ctx, const struct htlc_stub *htlc) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_MISSING_HTLC_OUTPUT); - towire_htlc_stub(&p, htlc); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_missing_htlc_output(const void *p, struct htlc_stub *htlc) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_MISSING_HTLC_OUTPUT) - return false; - fromwire_htlc_stub(&cursor, &plen, htlc); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_HTLC_TIMEOUT */ -/* onchaind->master: this HTLC has timed out (after reasonable_depth) */ -u8 *towire_onchaind_htlc_timeout(const tal_t *ctx, const struct htlc_stub *htlc) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_HTLC_TIMEOUT); - towire_htlc_stub(&p, htlc); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_htlc_timeout(const void *p, struct htlc_stub *htlc) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_HTLC_TIMEOUT) - return false; - fromwire_htlc_stub(&cursor, &plen, htlc); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_ALL_IRREVOCABLY_RESOLVED */ -/* onchaind->master: this peer can be forgotten */ -u8 *towire_onchaind_all_irrevocably_resolved(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_all_irrevocably_resolved(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED) - return false; - return cursor != NULL; -} - -/* WIRE: ONCHAIND_ADD_UTXO */ -/* onchaind->master: hey */ -u8 *towire_onchaind_add_utxo(const tal_t *ctx, const struct bitcoin_txid *prev_out_tx, u32 prev_out_index, const struct pubkey *per_commit_point, struct amount_sat value, u32 blockheight, const u8 *scriptpubkey, u32 csv_lock) -{ - u16 len = tal_count(scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_ADD_UTXO); - towire_bitcoin_txid(&p, prev_out_tx); - towire_u32(&p, prev_out_index); - if (!per_commit_point) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_pubkey(&p, per_commit_point); - } - towire_amount_sat(&p, value); - towire_u32(&p, blockheight); - towire_u16(&p, len); - towire_u8_array(&p, scriptpubkey, len); - towire_u32(&p, csv_lock); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_add_utxo(const tal_t *ctx, const void *p, struct bitcoin_txid *prev_out_tx, u32 *prev_out_index, struct pubkey **per_commit_point, struct amount_sat *value, u32 *blockheight, u8 **scriptpubkey, u32 *csv_lock) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_ADD_UTXO) - return false; - fromwire_bitcoin_txid(&cursor, &plen, prev_out_tx); - *prev_out_index = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *per_commit_point = NULL; - else { - *per_commit_point = tal(ctx, struct pubkey); - fromwire_pubkey(&cursor, &plen, *per_commit_point); - } - *value = fromwire_amount_sat(&cursor, &plen); - *blockheight = fromwire_u32(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case scriptpubkey - *scriptpubkey = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *scriptpubkey, len); - *csv_lock = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_DEV_MEMLEAK */ -/* master -> onchaind: do you have a memleak? */ -u8 *towire_onchaind_dev_memleak(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_DEV_MEMLEAK); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_dev_memleak(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_DEV_MEMLEAK) - return false; - return cursor != NULL; -} - -/* WIRE: ONCHAIND_DEV_MEMLEAK_REPLY */ -u8 *towire_onchaind_dev_memleak_reply(const tal_t *ctx, bool leak) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_DEV_MEMLEAK_REPLY); - towire_bool(&p, leak); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_dev_memleak_reply(const void *p, bool *leak) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_DEV_MEMLEAK_REPLY) - return false; - *leak = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_ANNOTATE_TXOUT */ -/* Tell the main daemon what we've been watching */ -/* that we tracked automatically but only onchaind knows how to classify their */ -/* transactions. */ -u8 *towire_onchaind_annotate_txout(const tal_t *ctx, const struct bitcoin_txid *txid, u32 outnum, enum wallet_tx_type type) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_ANNOTATE_TXOUT); - towire_bitcoin_txid(&p, txid); - towire_u32(&p, outnum); - towire_wallet_tx_type(&p, type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_annotate_txout(const void *p, struct bitcoin_txid *txid, u32 *outnum, enum wallet_tx_type *type) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_ANNOTATE_TXOUT) - return false; - fromwire_bitcoin_txid(&cursor, &plen, txid); - *outnum = fromwire_u32(&cursor, &plen); - *type = fromwire_wallet_tx_type(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_ANNOTATE_TXIN */ -u8 *towire_onchaind_annotate_txin(const tal_t *ctx, const struct bitcoin_txid *txid, u32 innum, enum wallet_tx_type type) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_ANNOTATE_TXIN); - towire_bitcoin_txid(&p, txid); - towire_u32(&p, innum); - towire_wallet_tx_type(&p, type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_annotate_txin(const void *p, struct bitcoin_txid *txid, u32 *innum, enum wallet_tx_type *type) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_ANNOTATE_TXIN) - return false; - fromwire_bitcoin_txid(&cursor, &plen, txid); - *innum = fromwire_u32(&cursor, &plen); - *type = fromwire_wallet_tx_type(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ONCHAIND_NOTIFY_COIN_MVT */ -u8 *towire_onchaind_notify_coin_mvt(const tal_t *ctx, const struct chain_coin_mvt *mvt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONCHAIND_NOTIFY_COIN_MVT); - towire_chain_coin_mvt(&p, mvt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONCHAIND_NOTIFY_COIN_MVT) - return false; - fromwire_chain_coin_mvt(&cursor, &plen, mvt); - return cursor != NULL; -} -// SHA256STAMP:407c8ab97dba44866916b0c6285f608a26f727a7bc575365b7e48729594121e1 diff --git a/onchaind/onchaind_wiregen.h b/onchaind/onchaind_wiregen.h deleted file mode 100644 index 1a6107df7..000000000 --- a/onchaind/onchaind_wiregen.h +++ /dev/null @@ -1,164 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_ONCHAIND_ONCHAIND_WIREGEN_H -#define LIGHTNING_ONCHAIND_ONCHAIND_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum onchaind_wire { - /* Begin! Here's the onchain tx which spends funding tx */ - WIRE_ONCHAIND_INIT = 5001, - /* This is all the HTLCs: one per message */ - WIRE_ONCHAIND_HTLC = 5002, - /* This says we're ready; give us preimages. */ - WIRE_ONCHAIND_INIT_REPLY = 5101, - /* onchaind->master: Send out a tx. */ - /* If is_rbf is false then master should rebroadcast the tx. */ - /* If is_rbf is true then onchaind is responsible for rebroadcasting */ - /* it with a higher fee. */ - WIRE_ONCHAIND_BROADCAST_TX = 5003, - /* master->onchaind: Notifier that an output has been spent by input_num of tx. */ - WIRE_ONCHAIND_SPENT = 5004, - /* master->onchaind: We will receive more than one of these */ - WIRE_ONCHAIND_DEPTH = 5005, - /* onchaind->master: We don't want to watch this tx */ - WIRE_ONCHAIND_UNWATCH_TX = 5006, - /* master->onchaind: We know HTLC preimage */ - WIRE_ONCHAIND_KNOWN_PREIMAGE = 5007, - /* onchaind->master: We discovered HTLC preimage */ - WIRE_ONCHAIND_EXTRACTED_PREIMAGE = 5008, - /* onchaind->master: this HTLC was missing from commit tx. */ - WIRE_ONCHAIND_MISSING_HTLC_OUTPUT = 5009, - /* onchaind->master: this HTLC has timed out (after reasonable_depth) */ - WIRE_ONCHAIND_HTLC_TIMEOUT = 5010, - /* onchaind->master: this peer can be forgotten */ - WIRE_ONCHAIND_ALL_IRREVOCABLY_RESOLVED = 5011, - /* onchaind->master: hey */ - WIRE_ONCHAIND_ADD_UTXO = 5012, - /* master -> onchaind: do you have a memleak? */ - WIRE_ONCHAIND_DEV_MEMLEAK = 5033, - WIRE_ONCHAIND_DEV_MEMLEAK_REPLY = 5133, - /* Tell the main daemon what we've been watching */ - /* that we tracked automatically but only onchaind knows how to classify their */ - /* transactions. */ - WIRE_ONCHAIND_ANNOTATE_TXOUT = 5035, - WIRE_ONCHAIND_ANNOTATE_TXIN = 5036, - WIRE_ONCHAIND_NOTIFY_COIN_MVT = 5037, -}; - -const char *onchaind_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool onchaind_wire_is_defined(u16 type); - - -/* WIRE: ONCHAIND_INIT */ -/* Begin! Here's the onchain tx which spends funding tx */ -u8 *towire_onchaind_init(const tal_t *ctx, const struct shachain *shachain, const struct chainparams *chainparams, struct amount_sat funding_amount_satoshi, struct amount_msat our_msat, const struct pubkey *old_remote_per_commitment_point, const struct pubkey *remote_per_commitment_point, u32 local_to_self_delay, u32 remote_to_self_delay, u32 delayed_to_us_feerate, u32 htlc_feerate, u32 penalty_feerate, struct amount_sat local_dust_limit_satoshi, const struct bitcoin_txid *our_broadcast_txid, const u8 *local_scriptpubkey, const u8 *remote_scriptpubkey, const struct pubkey *ourwallet_pubkey, enum side opener, const struct basepoints *local_basepoints, const struct basepoints *remote_basepoints, const struct tx_parts *tx_parts, u32 locktime, u32 tx_blockheight, u32 reasonable_depth, const struct bitcoin_signature *htlc_signature, u64 num_htlcs, u32 min_possible_feerate, u32 max_possible_feerate, const struct pubkey *possible_remote_per_commit_point, const struct pubkey *local_funding_pubkey, const struct pubkey *remote_funding_pubkey, u64 local_static_remotekey_start, u64 remote_static_remotekey_start, bool option_anchor_outputs, bool is_replay, u32 min_relay_feerate); -bool fromwire_onchaind_init(const tal_t *ctx, const void *p, struct shachain *shachain, const struct chainparams **chainparams, struct amount_sat *funding_amount_satoshi, struct amount_msat *our_msat, struct pubkey *old_remote_per_commitment_point, struct pubkey *remote_per_commitment_point, u32 *local_to_self_delay, u32 *remote_to_self_delay, u32 *delayed_to_us_feerate, u32 *htlc_feerate, u32 *penalty_feerate, struct amount_sat *local_dust_limit_satoshi, struct bitcoin_txid *our_broadcast_txid, u8 **local_scriptpubkey, u8 **remote_scriptpubkey, struct pubkey *ourwallet_pubkey, enum side *opener, struct basepoints *local_basepoints, struct basepoints *remote_basepoints, struct tx_parts **tx_parts, u32 *locktime, u32 *tx_blockheight, u32 *reasonable_depth, struct bitcoin_signature **htlc_signature, u64 *num_htlcs, u32 *min_possible_feerate, u32 *max_possible_feerate, struct pubkey **possible_remote_per_commit_point, struct pubkey *local_funding_pubkey, struct pubkey *remote_funding_pubkey, u64 *local_static_remotekey_start, u64 *remote_static_remotekey_start, bool *option_anchor_outputs, bool *is_replay, u32 *min_relay_feerate); - -/* WIRE: ONCHAIND_HTLC */ -/* This is all the HTLCs: one per message */ -u8 *towire_onchaind_htlc(const tal_t *ctx, const struct htlc_stub *htlc, bool tell_if_missing, bool tell_immediately); -bool fromwire_onchaind_htlc(const void *p, struct htlc_stub *htlc, bool *tell_if_missing, bool *tell_immediately); - -/* WIRE: ONCHAIND_INIT_REPLY */ -/* This says we're ready; give us preimages. */ -u8 *towire_onchaind_init_reply(const tal_t *ctx); -bool fromwire_onchaind_init_reply(const void *p); - -/* WIRE: ONCHAIND_BROADCAST_TX */ -/* onchaind->master: Send out a tx. */ -/* If is_rbf is false then master should rebroadcast the tx. */ -/* If is_rbf is true then onchaind is responsible for rebroadcasting */ -/* it with a higher fee. */ -u8 *towire_onchaind_broadcast_tx(const tal_t *ctx, const struct bitcoin_tx *tx, enum wallet_tx_type type, bool is_rbf); -bool fromwire_onchaind_broadcast_tx(const tal_t *ctx, const void *p, struct bitcoin_tx **tx, enum wallet_tx_type *type, bool *is_rbf); - -/* WIRE: ONCHAIND_SPENT */ -/* master->onchaind: Notifier that an output has been spent by input_num of tx. */ -u8 *towire_onchaind_spent(const tal_t *ctx, const struct tx_parts *tx, u32 input_num, u32 blockheight, bool is_replay); -bool fromwire_onchaind_spent(const tal_t *ctx, const void *p, struct tx_parts **tx, u32 *input_num, u32 *blockheight, bool *is_replay); - -/* WIRE: ONCHAIND_DEPTH */ -/* master->onchaind: We will receive more than one of these */ -u8 *towire_onchaind_depth(const tal_t *ctx, const struct bitcoin_txid *txid, u32 depth, bool is_replay); -bool fromwire_onchaind_depth(const void *p, struct bitcoin_txid *txid, u32 *depth, bool *is_replay); - -/* WIRE: ONCHAIND_UNWATCH_TX */ -/* onchaind->master: We don't want to watch this tx */ -u8 *towire_onchaind_unwatch_tx(const tal_t *ctx, const struct bitcoin_txid *txid); -bool fromwire_onchaind_unwatch_tx(const void *p, struct bitcoin_txid *txid); - -/* WIRE: ONCHAIND_KNOWN_PREIMAGE */ -/* master->onchaind: We know HTLC preimage */ -u8 *towire_onchaind_known_preimage(const tal_t *ctx, const struct preimage *preimage, bool is_replay); -bool fromwire_onchaind_known_preimage(const void *p, struct preimage *preimage, bool *is_replay); - -/* WIRE: ONCHAIND_EXTRACTED_PREIMAGE */ -/* onchaind->master: We discovered HTLC preimage */ -u8 *towire_onchaind_extracted_preimage(const tal_t *ctx, const struct preimage *preimage); -bool fromwire_onchaind_extracted_preimage(const void *p, struct preimage *preimage); - -/* WIRE: ONCHAIND_MISSING_HTLC_OUTPUT */ -/* onchaind->master: this HTLC was missing from commit tx. */ -u8 *towire_onchaind_missing_htlc_output(const tal_t *ctx, const struct htlc_stub *htlc); -bool fromwire_onchaind_missing_htlc_output(const void *p, struct htlc_stub *htlc); - -/* WIRE: ONCHAIND_HTLC_TIMEOUT */ -/* onchaind->master: this HTLC has timed out (after reasonable_depth) */ -u8 *towire_onchaind_htlc_timeout(const tal_t *ctx, const struct htlc_stub *htlc); -bool fromwire_onchaind_htlc_timeout(const void *p, struct htlc_stub *htlc); - -/* WIRE: ONCHAIND_ALL_IRREVOCABLY_RESOLVED */ -/* onchaind->master: this peer can be forgotten */ -u8 *towire_onchaind_all_irrevocably_resolved(const tal_t *ctx); -bool fromwire_onchaind_all_irrevocably_resolved(const void *p); - -/* WIRE: ONCHAIND_ADD_UTXO */ -/* onchaind->master: hey */ -u8 *towire_onchaind_add_utxo(const tal_t *ctx, const struct bitcoin_txid *prev_out_tx, u32 prev_out_index, const struct pubkey *per_commit_point, struct amount_sat value, u32 blockheight, const u8 *scriptpubkey, u32 csv_lock); -bool fromwire_onchaind_add_utxo(const tal_t *ctx, const void *p, struct bitcoin_txid *prev_out_tx, u32 *prev_out_index, struct pubkey **per_commit_point, struct amount_sat *value, u32 *blockheight, u8 **scriptpubkey, u32 *csv_lock); - -/* WIRE: ONCHAIND_DEV_MEMLEAK */ -/* master -> onchaind: do you have a memleak? */ -u8 *towire_onchaind_dev_memleak(const tal_t *ctx); -bool fromwire_onchaind_dev_memleak(const void *p); - -/* WIRE: ONCHAIND_DEV_MEMLEAK_REPLY */ -u8 *towire_onchaind_dev_memleak_reply(const tal_t *ctx, bool leak); -bool fromwire_onchaind_dev_memleak_reply(const void *p, bool *leak); - -/* WIRE: ONCHAIND_ANNOTATE_TXOUT */ -/* Tell the main daemon what we've been watching */ -/* that we tracked automatically but only onchaind knows how to classify their */ -/* transactions. */ -u8 *towire_onchaind_annotate_txout(const tal_t *ctx, const struct bitcoin_txid *txid, u32 outnum, enum wallet_tx_type type); -bool fromwire_onchaind_annotate_txout(const void *p, struct bitcoin_txid *txid, u32 *outnum, enum wallet_tx_type *type); - -/* WIRE: ONCHAIND_ANNOTATE_TXIN */ -u8 *towire_onchaind_annotate_txin(const tal_t *ctx, const struct bitcoin_txid *txid, u32 innum, enum wallet_tx_type type); -bool fromwire_onchaind_annotate_txin(const void *p, struct bitcoin_txid *txid, u32 *innum, enum wallet_tx_type *type); - -/* WIRE: ONCHAIND_NOTIFY_COIN_MVT */ -u8 *towire_onchaind_notify_coin_mvt(const tal_t *ctx, const struct chain_coin_mvt *mvt); -bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt); - - -#endif /* LIGHTNING_ONCHAIND_ONCHAIND_WIREGEN_H */ -// SHA256STAMP:407c8ab97dba44866916b0c6285f608a26f727a7bc575365b7e48729594121e1 diff --git a/openingd/dualopend_wiregen.c b/openingd/dualopend_wiregen.c deleted file mode 100644 index 1d71ec42c..000000000 --- a/openingd/dualopend_wiregen.c +++ /dev/null @@ -1,1054 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *dualopend_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum dualopend_wire)e) { - case WIRE_DUALOPEND_INIT: return "WIRE_DUALOPEND_INIT"; - case WIRE_DUALOPEND_REINIT: return "WIRE_DUALOPEND_REINIT"; - case WIRE_DUALOPEND_GOT_OFFER: return "WIRE_DUALOPEND_GOT_OFFER"; - case WIRE_DUALOPEND_GOT_OFFER_REPLY: return "WIRE_DUALOPEND_GOT_OFFER_REPLY"; - case WIRE_DUALOPEND_GOT_RBF_OFFER: return "WIRE_DUALOPEND_GOT_RBF_OFFER"; - case WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY: return "WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY"; - case WIRE_DUALOPEND_RBF_VALIDATE: return "WIRE_DUALOPEND_RBF_VALIDATE"; - case WIRE_DUALOPEND_RBF_VALID: return "WIRE_DUALOPEND_RBF_VALID"; - case WIRE_DUALOPEND_RBF_INIT: return "WIRE_DUALOPEND_RBF_INIT"; - case WIRE_DUALOPEND_COMMIT_RCVD: return "WIRE_DUALOPEND_COMMIT_RCVD"; - case WIRE_DUALOPEND_PSBT_CHANGED: return "WIRE_DUALOPEND_PSBT_CHANGED"; - case WIRE_DUALOPEND_PSBT_UPDATED: return "WIRE_DUALOPEND_PSBT_UPDATED"; - case WIRE_DUALOPEND_FAIL: return "WIRE_DUALOPEND_FAIL"; - case WIRE_DUALOPEND_OPENER_INIT: return "WIRE_DUALOPEND_OPENER_INIT"; - case WIRE_DUALOPEND_FUNDING_SIGS: return "WIRE_DUALOPEND_FUNDING_SIGS"; - case WIRE_DUALOPEND_SEND_TX_SIGS: return "WIRE_DUALOPEND_SEND_TX_SIGS"; - case WIRE_DUALOPEND_TX_SIGS_SENT: return "WIRE_DUALOPEND_TX_SIGS_SENT"; - case WIRE_DUALOPEND_PEER_LOCKED: return "WIRE_DUALOPEND_PEER_LOCKED"; - case WIRE_DUALOPEND_CHANNEL_LOCKED: return "WIRE_DUALOPEND_CHANNEL_LOCKED"; - case WIRE_DUALOPEND_DEPTH_REACHED: return "WIRE_DUALOPEND_DEPTH_REACHED"; - case WIRE_DUALOPEND_SEND_SHUTDOWN: return "WIRE_DUALOPEND_SEND_SHUTDOWN"; - case WIRE_DUALOPEND_GOT_SHUTDOWN: return "WIRE_DUALOPEND_GOT_SHUTDOWN"; - case WIRE_DUALOPEND_FAIL_FALLEN_BEHIND: return "WIRE_DUALOPEND_FAIL_FALLEN_BEHIND"; - case WIRE_DUALOPEND_SHUTDOWN_COMPLETE: return "WIRE_DUALOPEND_SHUTDOWN_COMPLETE"; - case WIRE_DUALOPEND_DRY_RUN: return "WIRE_DUALOPEND_DRY_RUN"; - case WIRE_DUALOPEND_VALIDATE_LEASE: return "WIRE_DUALOPEND_VALIDATE_LEASE"; - case WIRE_DUALOPEND_VALIDATE_LEASE_REPLY: return "WIRE_DUALOPEND_VALIDATE_LEASE_REPLY"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool dualopend_wire_is_defined(u16 type) -{ - switch ((enum dualopend_wire)type) { - case WIRE_DUALOPEND_INIT:; - case WIRE_DUALOPEND_REINIT:; - case WIRE_DUALOPEND_GOT_OFFER:; - case WIRE_DUALOPEND_GOT_OFFER_REPLY:; - case WIRE_DUALOPEND_GOT_RBF_OFFER:; - case WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY:; - case WIRE_DUALOPEND_RBF_VALIDATE:; - case WIRE_DUALOPEND_RBF_VALID:; - case WIRE_DUALOPEND_RBF_INIT:; - case WIRE_DUALOPEND_COMMIT_RCVD:; - case WIRE_DUALOPEND_PSBT_CHANGED:; - case WIRE_DUALOPEND_PSBT_UPDATED:; - case WIRE_DUALOPEND_FAIL:; - case WIRE_DUALOPEND_OPENER_INIT:; - case WIRE_DUALOPEND_FUNDING_SIGS:; - case WIRE_DUALOPEND_SEND_TX_SIGS:; - case WIRE_DUALOPEND_TX_SIGS_SENT:; - case WIRE_DUALOPEND_PEER_LOCKED:; - case WIRE_DUALOPEND_CHANNEL_LOCKED:; - case WIRE_DUALOPEND_DEPTH_REACHED:; - case WIRE_DUALOPEND_SEND_SHUTDOWN:; - case WIRE_DUALOPEND_GOT_SHUTDOWN:; - case WIRE_DUALOPEND_FAIL_FALLEN_BEHIND:; - case WIRE_DUALOPEND_SHUTDOWN_COMPLETE:; - case WIRE_DUALOPEND_DRY_RUN:; - case WIRE_DUALOPEND_VALIDATE_LEASE:; - case WIRE_DUALOPEND_VALIDATE_LEASE_REPLY:; - return true; - } - return false; -} - - - - - -/* WIRE: DUALOPEND_INIT */ -u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth) -{ - u16 their_init_features_len = tal_count(their_init_features); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_INIT); - /* Which network are we configured for? */ - towire_chainparams(&p, chainparams); - towire_feature_set(&p, our_feature_set); - towire_u16(&p, their_init_features_len); - towire_u8_array(&p, their_init_features, their_init_features_len); - /* Base configuration we'll offer */ - towire_channel_config(&p, our_config); - /* Minimum/maximum configuration values we'll accept */ - towire_u32(&p, max_to_self_delay); - towire_amount_msat(&p, min_effective_htlc_capacity_msat); - towire_per_peer_state(&p, pps); - towire_basepoints(&p, our_basepoints); - towire_pubkey(&p, our_funding_pubkey); - /* Constraints in case the other end tries to open a channel. */ - towire_u32(&p, minimum_depth); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth) -{ - u16 their_init_features_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_INIT) - return false; - /* Which network are we configured for? */ - fromwire_chainparams(&cursor, &plen, chainparams); - *our_feature_set = fromwire_feature_set(ctx, &cursor, &plen); - their_init_features_len = fromwire_u16(&cursor, &plen); - // 2nd case their_init_features - *their_init_features = their_init_features_len ? tal_arr(ctx, u8, their_init_features_len) : NULL; - fromwire_u8_array(&cursor, &plen, *their_init_features, their_init_features_len); - /* Base configuration we'll offer */ - fromwire_channel_config(&cursor, &plen, our_config); - /* Minimum/maximum configuration values we'll accept */ - *max_to_self_delay = fromwire_u32(&cursor, &plen); - *min_effective_htlc_capacity_msat = fromwire_amount_msat(&cursor, &plen); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_basepoints(&cursor, &plen, our_basepoints); - fromwire_pubkey(&cursor, &plen, our_funding_pubkey); - /* Constraints in case the other end tries to open a channel. */ - *minimum_depth = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_REINIT */ -/* master-dualopend: peer has reconnected */ -u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags, u32 lease_start_blockheight, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt) -{ - u16 their_init_features_len = tal_count(their_init_features); - u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey); - u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_REINIT); - towire_chainparams(&p, chainparams); - towire_feature_set(&p, our_feature_set); - towire_u16(&p, their_init_features_len); - towire_u8_array(&p, their_init_features, their_init_features_len); - towire_channel_config(&p, our_config); - towire_channel_config(&p, their_config); - towire_channel_id(&p, channel_id); - towire_u32(&p, max_to_self_delay); - towire_amount_msat(&p, min_effective_htlc_capacity_msat); - towire_per_peer_state(&p, pps); - towire_basepoints(&p, our_basepoints); - towire_pubkey(&p, our_funding_pubkey); - towire_pubkey(&p, their_funding_pubkey); - towire_u32(&p, minimum_depth); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_u32(&p, most_recent_feerate_per_kw_funding); - towire_amount_sat(&p, funding_satoshi); - towire_amount_msat(&p, our_funding); - towire_basepoints(&p, their_basepoints); - towire_pubkey(&p, remote_per_commit); - towire_wally_psbt(&p, funding_psbt); - towire_side(&p, opener); - towire_bool(&p, local_funding_locked); - towire_bool(&p, remote_funding_locked); - towire_bool(&p, send_shutdown); - towire_bool(&p, remote_shutdown_received); - towire_u16(&p, local_shutdown_len); - towire_u8_array(&p, local_shutdown_scriptpubkey, local_shutdown_len); - towire_u16(&p, remote_shutdown_len); - towire_u8_array(&p, remote_shutdown_scriptpubkey, remote_shutdown_len); - towire_bool(&p, remote_funding_sigs_received); - towire_fee_states(&p, fee_states); - towire_u8(&p, channel_flags); - towire_u32(&p, lease_start_blockheight); - towire_u32(&p, lease_expiry); - if (!lease_commit_sig) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secp256k1_ecdsa_signature(&p, lease_commit_sig); - } - towire_u32(&p, lease_chan_max_msat); - towire_u16(&p, lease_chan_max_ppt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags, u32 *lease_start_blockheight, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt) -{ - u16 their_init_features_len; - u16 local_shutdown_len; - u16 remote_shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_REINIT) - return false; - fromwire_chainparams(&cursor, &plen, chainparams); - *our_feature_set = fromwire_feature_set(ctx, &cursor, &plen); - their_init_features_len = fromwire_u16(&cursor, &plen); - // 2nd case their_init_features - *their_init_features = their_init_features_len ? tal_arr(ctx, u8, their_init_features_len) : NULL; - fromwire_u8_array(&cursor, &plen, *their_init_features, their_init_features_len); - fromwire_channel_config(&cursor, &plen, our_config); - fromwire_channel_config(&cursor, &plen, their_config); - fromwire_channel_id(&cursor, &plen, channel_id); - *max_to_self_delay = fromwire_u32(&cursor, &plen); - *min_effective_htlc_capacity_msat = fromwire_amount_msat(&cursor, &plen); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_basepoints(&cursor, &plen, our_basepoints); - fromwire_pubkey(&cursor, &plen, our_funding_pubkey); - fromwire_pubkey(&cursor, &plen, their_funding_pubkey); - *minimum_depth = fromwire_u32(&cursor, &plen); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *most_recent_feerate_per_kw_funding = fromwire_u32(&cursor, &plen); - *funding_satoshi = fromwire_amount_sat(&cursor, &plen); - *our_funding = fromwire_amount_msat(&cursor, &plen); - fromwire_basepoints(&cursor, &plen, their_basepoints); - fromwire_pubkey(&cursor, &plen, remote_per_commit); - *funding_psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - *opener = fromwire_side(&cursor, &plen); - *local_funding_locked = fromwire_bool(&cursor, &plen); - *remote_funding_locked = fromwire_bool(&cursor, &plen); - *send_shutdown = fromwire_bool(&cursor, &plen); - *remote_shutdown_received = fromwire_bool(&cursor, &plen); - local_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case local_shutdown_scriptpubkey - *local_shutdown_scriptpubkey = local_shutdown_len ? tal_arr(ctx, u8, local_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *local_shutdown_scriptpubkey, local_shutdown_len); - remote_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case remote_shutdown_scriptpubkey - *remote_shutdown_scriptpubkey = remote_shutdown_len ? tal_arr(ctx, u8, remote_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *remote_shutdown_scriptpubkey, remote_shutdown_len); - *remote_funding_sigs_received = fromwire_bool(&cursor, &plen); - *fee_states = fromwire_fee_states(ctx, &cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *lease_start_blockheight = fromwire_u32(&cursor, &plen); - *lease_expiry = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *lease_commit_sig = NULL; - else { - *lease_commit_sig = tal(ctx, secp256k1_ecdsa_signature); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *lease_commit_sig); - } - *lease_chan_max_msat = fromwire_u32(&cursor, &plen); - *lease_chan_max_ppt = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_GOT_OFFER */ -/* dualopend->master: they offered channel */ -u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat opener_funding, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, u32 locktime, const u8 *shutdown_scriptpubkey, struct amount_sat requested_amt, u32 lease_blockheight_start) -{ - u16 shutdown_len = tal_count(shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_GOT_OFFER); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, opener_funding); - towire_amount_sat(&p, dust_limit_satoshis); - towire_amount_msat(&p, max_htlc_value_in_flight_msat); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, feerate_per_kw_funding); - towire_u32(&p, feerate_per_kw_commitment); - towire_u16(&p, to_self_delay); - towire_u16(&p, max_accepted_htlcs); - towire_u8(&p, channel_flags); - towire_u32(&p, locktime); - towire_u16(&p, shutdown_len); - towire_u8_array(&p, shutdown_scriptpubkey, shutdown_len); - towire_amount_sat(&p, requested_amt); - towire_u32(&p, lease_blockheight_start); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *opener_funding, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u32 *locktime, u8 **shutdown_scriptpubkey, struct amount_sat *requested_amt, u32 *lease_blockheight_start) -{ - u16 shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_GOT_OFFER) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *opener_funding = fromwire_amount_sat(&cursor, &plen); - *dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen); - *max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *feerate_per_kw_funding = fromwire_u32(&cursor, &plen); - *feerate_per_kw_commitment = fromwire_u32(&cursor, &plen); - *to_self_delay = fromwire_u16(&cursor, &plen); - *max_accepted_htlcs = fromwire_u16(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *locktime = fromwire_u32(&cursor, &plen); - shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case shutdown_scriptpubkey - *shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_len); - *requested_amt = fromwire_amount_sat(&cursor, &plen); - *lease_blockheight_start = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_GOT_OFFER_REPLY */ -/* master->dualopend: reply back with our first funding info/contribs */ -u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepter_funding, const struct wally_psbt *psbt, const u8 *our_shutdown_scriptpubkey, const struct lease_rates *lease_rates) -{ - u16 shutdown_len = tal_count(our_shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_GOT_OFFER_REPLY); - towire_amount_sat(&p, accepter_funding); - towire_wally_psbt(&p, psbt); - towire_u16(&p, shutdown_len); - towire_u8_array(&p, our_shutdown_scriptpubkey, shutdown_len); - /* must go last because of embedded tu32 */ - if (!lease_rates) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_lease_rates(&p, lease_rates); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *accepter_funding, struct wally_psbt **psbt, u8 **our_shutdown_scriptpubkey, struct lease_rates **lease_rates) -{ - u16 shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_GOT_OFFER_REPLY) - return false; - *accepter_funding = fromwire_amount_sat(&cursor, &plen); - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case our_shutdown_scriptpubkey - *our_shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *our_shutdown_scriptpubkey, shutdown_len); - /* must go last because of embedded tu32 */ - if (!fromwire_bool(&cursor, &plen)) - *lease_rates = NULL; - else { - *lease_rates = tal(ctx, struct lease_rates); - fromwire_lease_rates(&cursor, &plen, *lease_rates); - } - return cursor != NULL; -} - -/* WIRE: DUALOPEND_GOT_RBF_OFFER */ -/* dualopend->master: they offered a RBF */ -u8 *towire_dualopend_got_rbf_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat their_funding, u32 funding_feerate_per_kw, u32 locktime) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_GOT_RBF_OFFER); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, their_funding); - towire_u32(&p, funding_feerate_per_kw); - towire_u32(&p, locktime); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_got_rbf_offer(const void *p, struct channel_id *channel_id, struct amount_sat *their_funding, u32 *funding_feerate_per_kw, u32 *locktime) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_GOT_RBF_OFFER) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *their_funding = fromwire_amount_sat(&cursor, &plen); - *funding_feerate_per_kw = fromwire_u32(&cursor, &plen); - *locktime = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_GOT_RBF_OFFER_REPLY */ -/* master->dualopend: reply back with our funding info/contribs */ -u8 *towire_dualopend_got_rbf_offer_reply(const tal_t *ctx, struct amount_sat our_funding, const struct wally_psbt *psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY); - towire_amount_sat(&p, our_funding); - towire_wally_psbt(&p, psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_got_rbf_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *our_funding, struct wally_psbt **psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY) - return false; - *our_funding = fromwire_amount_sat(&cursor, &plen); - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_RBF_VALIDATE */ -/* dualopend->master: is this a valid RBF candidate transaction? */ -u8 *towire_dualopend_rbf_validate(const tal_t *ctx, const struct wally_psbt *proposed_funding_psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_RBF_VALIDATE); - towire_wally_psbt(&p, proposed_funding_psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_rbf_validate(const tal_t *ctx, const void *p, struct wally_psbt **proposed_funding_psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_RBF_VALIDATE) - return false; - *proposed_funding_psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_RBF_VALID */ -/* master->dualopend: this is a valid RBF candidate transaction */ -u8 *towire_dualopend_rbf_valid(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_RBF_VALID); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_rbf_valid(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_RBF_VALID) - return false; - return cursor != NULL; -} - -/* WIRE: DUALOPEND_RBF_INIT */ -/* master->dualopend: attempt an RBF */ -u8 *towire_dualopend_rbf_init(const tal_t *ctx, struct amount_sat our_funding, u32 funding_feerate_perkw, const struct wally_psbt *psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_RBF_INIT); - towire_amount_sat(&p, our_funding); - towire_u32(&p, funding_feerate_perkw); - towire_wally_psbt(&p, psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_rbf_init(const tal_t *ctx, const void *p, struct amount_sat *our_funding, u32 *funding_feerate_perkw, struct wally_psbt **psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_RBF_INIT) - return false; - *our_funding = fromwire_amount_sat(&cursor, &plen); - *funding_feerate_perkw = fromwire_u32(&cursor, &plen); - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_COMMIT_RCVD */ -/* dualopend->master: ready to commit channel open to database and */ -/* get some signatures for the funding_tx. */ -u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *remote_first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct wally_psbt *psbt, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_sat our_funding_sats, u8 channel_flags, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, u32 lease_start_blockheight, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt) -{ - u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey); - u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_COMMIT_RCVD); - towire_channel_config(&p, their_config); - towire_bitcoin_tx(&p, remote_first_commit); - if (!pbase) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_penalty_base(&p, pbase); - } - towire_bitcoin_signature(&p, first_commit_sig); - towire_wally_psbt(&p, psbt); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, their_per_commit_point); - towire_pubkey(&p, remote_fundingkey); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_amount_sat(&p, funding_satoshis); - towire_amount_sat(&p, our_funding_sats); - towire_u8(&p, channel_flags); - towire_u32(&p, feerate_per_kw_funding); - towire_u32(&p, feerate_per_kw_commitment); - towire_u16(&p, local_shutdown_len); - towire_u8_array(&p, local_shutdown_scriptpubkey, local_shutdown_len); - towire_u16(&p, remote_shutdown_len); - towire_u8_array(&p, remote_shutdown_scriptpubkey, remote_shutdown_len); - towire_u32(&p, lease_start_blockheight); - towire_u32(&p, lease_expiry); - if (!lease_commit_sig) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_secp256k1_ecdsa_signature(&p, lease_commit_sig); - } - towire_u32(&p, lease_chan_max_msat); - towire_u16(&p, lease_chan_max_ppt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **remote_first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct wally_psbt **psbt, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_sat *our_funding_sats, u8 *channel_flags, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, u32 *lease_start_blockheight, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt) -{ - u16 local_shutdown_len; - u16 remote_shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_COMMIT_RCVD) - return false; - fromwire_channel_config(&cursor, &plen, their_config); - *remote_first_commit = fromwire_bitcoin_tx(ctx, &cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *pbase = NULL; - else { - *pbase = tal(ctx, struct penalty_base); - fromwire_penalty_base(&cursor, &plen, *pbase); - } - fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig); - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, their_per_commit_point); - fromwire_pubkey(&cursor, &plen, remote_fundingkey); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *our_funding_sats = fromwire_amount_sat(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *feerate_per_kw_funding = fromwire_u32(&cursor, &plen); - *feerate_per_kw_commitment = fromwire_u32(&cursor, &plen); - local_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case local_shutdown_scriptpubkey - *local_shutdown_scriptpubkey = local_shutdown_len ? tal_arr(ctx, u8, local_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *local_shutdown_scriptpubkey, local_shutdown_len); - remote_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case remote_shutdown_scriptpubkey - *remote_shutdown_scriptpubkey = remote_shutdown_len ? tal_arr(ctx, u8, remote_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *remote_shutdown_scriptpubkey, remote_shutdown_len); - *lease_start_blockheight = fromwire_u32(&cursor, &plen); - *lease_expiry = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *lease_commit_sig = NULL; - else { - *lease_commit_sig = tal(ctx, secp256k1_ecdsa_signature); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *lease_commit_sig); - } - *lease_chan_max_msat = fromwire_u32(&cursor, &plen); - *lease_chan_max_ppt = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_PSBT_CHANGED */ -/* dualopend->master: peer updated the psbt */ -u8 *towire_dualopend_psbt_changed(const tal_t *ctx, const struct channel_id *channel_id, u64 funding_serial, const struct wally_psbt *psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_PSBT_CHANGED); - towire_channel_id(&p, channel_id); - towire_u64(&p, funding_serial); - towire_wally_psbt(&p, psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_psbt_changed(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *funding_serial, struct wally_psbt **psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_PSBT_CHANGED) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *funding_serial = fromwire_u64(&cursor, &plen); - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_PSBT_UPDATED */ -/* master->dualopend: we updated the psbt */ -u8 *towire_dualopend_psbt_updated(const tal_t *ctx, const struct wally_psbt *psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_PSBT_UPDATED); - towire_wally_psbt(&p, psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_psbt_updated(const tal_t *ctx, const void *p, struct wally_psbt **psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_PSBT_UPDATED) - return false; - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_FAIL */ -/* master->dualopend: fail this channel open */ -u8 *towire_dualopend_fail(const tal_t *ctx, const wirestring *reason) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_FAIL); - towire_wirestring(&p, reason); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_fail(const tal_t *ctx, const void *p, wirestring **reason) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_FAIL) - return false; - *reason = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_OPENER_INIT */ -/* master->dualopend: hello */ -u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt, struct amount_sat funding_amount, const u8 *local_shutdown_scriptpubkey, u32 feerate_per_kw, u32 feerate_per_kw_funding, u8 channel_flags, struct amount_sat requested_sats, u32 blockheight, bool dry_run, const struct lease_rates *expected_rates) -{ - u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_OPENER_INIT); - towire_wally_psbt(&p, psbt); - towire_amount_sat(&p, funding_amount); - towire_u16(&p, local_shutdown_len); - towire_u8_array(&p, local_shutdown_scriptpubkey, local_shutdown_len); - towire_u32(&p, feerate_per_kw); - towire_u32(&p, feerate_per_kw_funding); - towire_u8(&p, channel_flags); - towire_amount_sat(&p, requested_sats); - towire_u32(&p, blockheight); - towire_bool(&p, dry_run); - /* must go last because embedded tu32 */ - if (!expected_rates) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_lease_rates(&p, expected_rates); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wally_psbt **psbt, struct amount_sat *funding_amount, u8 **local_shutdown_scriptpubkey, u32 *feerate_per_kw, u32 *feerate_per_kw_funding, u8 *channel_flags, struct amount_sat *requested_sats, u32 *blockheight, bool *dry_run, struct lease_rates **expected_rates) -{ - u16 local_shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_OPENER_INIT) - return false; - *psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - *funding_amount = fromwire_amount_sat(&cursor, &plen); - local_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case local_shutdown_scriptpubkey - *local_shutdown_scriptpubkey = local_shutdown_len ? tal_arr(ctx, u8, local_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *local_shutdown_scriptpubkey, local_shutdown_len); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - *feerate_per_kw_funding = fromwire_u32(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *requested_sats = fromwire_amount_sat(&cursor, &plen); - *blockheight = fromwire_u32(&cursor, &plen); - *dry_run = fromwire_bool(&cursor, &plen); - /* must go last because embedded tu32 */ - if (!fromwire_bool(&cursor, &plen)) - *expected_rates = NULL; - else { - *expected_rates = tal(ctx, struct lease_rates); - fromwire_lease_rates(&cursor, &plen, *expected_rates); - } - return cursor != NULL; -} - -/* WIRE: DUALOPEND_FUNDING_SIGS */ -/* dualopend->master received tx_sigs from peer */ -u8 *towire_dualopend_funding_sigs(const tal_t *ctx, const struct wally_psbt *signed_psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_FUNDING_SIGS); - towire_wally_psbt(&p, signed_psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_funding_sigs(const tal_t *ctx, const void *p, struct wally_psbt **signed_psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_FUNDING_SIGS) - return false; - *signed_psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_SEND_TX_SIGS */ -/* master->dualopend send our tx_sigs to peer */ -u8 *towire_dualopend_send_tx_sigs(const tal_t *ctx, const struct wally_psbt *signed_psbt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_SEND_TX_SIGS); - towire_wally_psbt(&p, signed_psbt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_send_tx_sigs(const tal_t *ctx, const void *p, struct wally_psbt **signed_psbt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_SEND_TX_SIGS) - return false; - *signed_psbt = fromwire_wally_psbt(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_TX_SIGS_SENT */ -/* dualopend->master tx sigs transmitted to peer */ -u8 *towire_dualopend_tx_sigs_sent(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_TX_SIGS_SENT); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_tx_sigs_sent(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_TX_SIGS_SENT) - return false; - return cursor != NULL; -} - -/* WIRE: DUALOPEND_PEER_LOCKED */ -/* dualopend->peer peer locked channel */ -u8 *towire_dualopend_peer_locked(const tal_t *ctx, const struct pubkey *remote_per_commit) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_PEER_LOCKED); - towire_pubkey(&p, remote_per_commit); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_peer_locked(const void *p, struct pubkey *remote_per_commit) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_PEER_LOCKED) - return false; - fromwire_pubkey(&cursor, &plen, remote_per_commit); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_CHANNEL_LOCKED */ -/* dualopend->master this channel has been locked */ -u8 *towire_dualopend_channel_locked(const tal_t *ctx, const struct per_peer_state *pps) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_CHANNEL_LOCKED); - towire_per_peer_state(&p, pps); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_channel_locked(const tal_t *ctx, const void *p, struct per_peer_state **pps) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_CHANNEL_LOCKED) - return false; - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_DEPTH_REACHED */ -/* master->dualopend funding reached depth; tell peer */ -u8 *towire_dualopend_depth_reached(const tal_t *ctx, u32 depth) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_DEPTH_REACHED); - towire_u32(&p, depth); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_depth_reached(const void *p, u32 *depth) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_DEPTH_REACHED) - return false; - *depth = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_SEND_SHUTDOWN */ -/* Tell peer to shut down channel. */ -u8 *towire_dualopend_send_shutdown(const tal_t *ctx, const u8 *shutdown_scriptpubkey) -{ - u16 shutdown_scriptpubkey_len = tal_count(shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_SEND_SHUTDOWN); - towire_u16(&p, shutdown_scriptpubkey_len); - towire_u8_array(&p, shutdown_scriptpubkey, shutdown_scriptpubkey_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_send_shutdown(const tal_t *ctx, const void *p, u8 **shutdown_scriptpubkey) -{ - u16 shutdown_scriptpubkey_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_SEND_SHUTDOWN) - return false; - shutdown_scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case shutdown_scriptpubkey - *shutdown_scriptpubkey = shutdown_scriptpubkey_len ? tal_arr(ctx, u8, shutdown_scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_scriptpubkey_len); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_GOT_SHUTDOWN */ -/* Peer told us that channel is shutting down */ -u8 *towire_dualopend_got_shutdown(const tal_t *ctx, const u8 *scriptpubkey) -{ - u16 scriptpubkey_len = tal_count(scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_GOT_SHUTDOWN); - towire_u16(&p, scriptpubkey_len); - towire_u8_array(&p, scriptpubkey, scriptpubkey_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_got_shutdown(const tal_t *ctx, const void *p, u8 **scriptpubkey) -{ - u16 scriptpubkey_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_GOT_SHUTDOWN) - return false; - scriptpubkey_len = fromwire_u16(&cursor, &plen); - // 2nd case scriptpubkey - *scriptpubkey = scriptpubkey_len ? tal_arr(ctx, u8, scriptpubkey_len) : NULL; - fromwire_u8_array(&cursor, &plen, *scriptpubkey, scriptpubkey_len); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_FAIL_FALLEN_BEHIND */ -/* Peer presented proof it was from the future. */ -u8 *towire_dualopend_fail_fallen_behind(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_FAIL_FALLEN_BEHIND); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_fail_fallen_behind(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_FAIL_FALLEN_BEHIND) - return false; - return cursor != NULL; -} - -/* WIRE: DUALOPEND_SHUTDOWN_COMPLETE */ -/* Shutdown is complete */ -u8 *towire_dualopend_shutdown_complete(const tal_t *ctx, const struct per_peer_state *per_peer_state) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_SHUTDOWN_COMPLETE); - towire_per_peer_state(&p, per_peer_state); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_shutdown_complete(const tal_t *ctx, const void *p, struct per_peer_state **per_peer_state) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_SHUTDOWN_COMPLETE) - return false; - *per_peer_state = fromwire_per_peer_state(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_DRY_RUN */ -/* dualopend -> master: this was a dry run */ -u8 *towire_dualopend_dry_run(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat our_funding, struct amount_sat their_funding, const struct lease_rates *lease_rates) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_DRY_RUN); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, our_funding); - towire_amount_sat(&p, their_funding); - /* must go last because of embedded tu32 */ - if (!lease_rates) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_lease_rates(&p, lease_rates); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_dry_run(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *our_funding, struct amount_sat *their_funding, struct lease_rates **lease_rates) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_DRY_RUN) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *our_funding = fromwire_amount_sat(&cursor, &plen); - *their_funding = fromwire_amount_sat(&cursor, &plen); - /* must go last because of embedded tu32 */ - if (!fromwire_bool(&cursor, &plen)) - *lease_rates = NULL; - else { - *lease_rates = tal(ctx, struct lease_rates); - fromwire_lease_rates(&cursor, &plen, *lease_rates); - } - return cursor != NULL; -} - -/* WIRE: DUALOPEND_VALIDATE_LEASE */ -/* dualopend -> master: validate liqudity offer sig */ -u8 *towire_dualopend_validate_lease(const tal_t *ctx, const secp256k1_ecdsa_signature *sig, u32 lease_expiry, u32 chan_fee_max_base_msat, u16 chan_fee_max_ppt, const struct pubkey *their_pubkey) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_VALIDATE_LEASE); - towire_secp256k1_ecdsa_signature(&p, sig); - towire_u32(&p, lease_expiry); - towire_u32(&p, chan_fee_max_base_msat); - towire_u16(&p, chan_fee_max_ppt); - towire_pubkey(&p, their_pubkey); - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_validate_lease(const void *p, secp256k1_ecdsa_signature *sig, u32 *lease_expiry, u32 *chan_fee_max_base_msat, u16 *chan_fee_max_ppt, struct pubkey *their_pubkey) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_VALIDATE_LEASE) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, sig); - *lease_expiry = fromwire_u32(&cursor, &plen); - *chan_fee_max_base_msat = fromwire_u32(&cursor, &plen); - *chan_fee_max_ppt = fromwire_u16(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, their_pubkey); - return cursor != NULL; -} - -/* WIRE: DUALOPEND_VALIDATE_LEASE_REPLY */ -u8 *towire_dualopend_validate_lease_reply(const tal_t *ctx, const wirestring *err_msg) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_DUALOPEND_VALIDATE_LEASE_REPLY); - if (!err_msg) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_wirestring(&p, err_msg); - } - - return memcheck(p, tal_count(p)); -} -bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wirestring **err_msg) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_DUALOPEND_VALIDATE_LEASE_REPLY) - return false; - if (!fromwire_bool(&cursor, &plen)) - *err_msg = NULL; - else { - *err_msg = fromwire_wirestring(ctx, &cursor, &plen); - } - return cursor != NULL; -} -// SHA256STAMP:da973afd41ef15546d902945a3108aa3c02571d13ffaff0aed63c1ac39740f04 diff --git a/openingd/dualopend_wiregen.h b/openingd/dualopend_wiregen.h deleted file mode 100644 index 82a9b9b3d..000000000 --- a/openingd/dualopend_wiregen.h +++ /dev/null @@ -1,228 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H -#define LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum dualopend_wire { - WIRE_DUALOPEND_INIT = 7000, - /* master-dualopend: peer has reconnected */ - WIRE_DUALOPEND_REINIT = 7001, - /* dualopend->master: they offered channel */ - WIRE_DUALOPEND_GOT_OFFER = 7005, - /* master->dualopend: reply back with our first funding info/contribs */ - WIRE_DUALOPEND_GOT_OFFER_REPLY = 7105, - /* dualopend->master: they offered a RBF */ - WIRE_DUALOPEND_GOT_RBF_OFFER = 7500, - /* master->dualopend: reply back with our funding info/contribs */ - WIRE_DUALOPEND_GOT_RBF_OFFER_REPLY = 7505, - /* dualopend->master: is this a valid RBF candidate transaction? */ - WIRE_DUALOPEND_RBF_VALIDATE = 7506, - /* master->dualopend: this is a valid RBF candidate transaction */ - WIRE_DUALOPEND_RBF_VALID = 7507, - /* master->dualopend: attempt an RBF */ - WIRE_DUALOPEND_RBF_INIT = 7509, - /* dualopend->master: ready to commit channel open to database and */ - /* get some signatures for the funding_tx. */ - WIRE_DUALOPEND_COMMIT_RCVD = 7007, - /* dualopend->master: peer updated the psbt */ - WIRE_DUALOPEND_PSBT_CHANGED = 7107, - /* master->dualopend: we updated the psbt */ - WIRE_DUALOPEND_PSBT_UPDATED = 7108, - /* master->dualopend: fail this channel open */ - WIRE_DUALOPEND_FAIL = 7003, - /* master->dualopend: hello */ - WIRE_DUALOPEND_OPENER_INIT = 7200, - /* dualopend->master received tx_sigs from peer */ - WIRE_DUALOPEND_FUNDING_SIGS = 7010, - /* master->dualopend send our tx_sigs to peer */ - WIRE_DUALOPEND_SEND_TX_SIGS = 7011, - /* dualopend->master tx sigs transmitted to peer */ - WIRE_DUALOPEND_TX_SIGS_SENT = 7012, - /* dualopend->peer peer locked channel */ - WIRE_DUALOPEND_PEER_LOCKED = 7018, - /* dualopend->master this channel has been locked */ - WIRE_DUALOPEND_CHANNEL_LOCKED = 7019, - /* master->dualopend funding reached depth; tell peer */ - WIRE_DUALOPEND_DEPTH_REACHED = 7020, - /* Tell peer to shut down channel. */ - WIRE_DUALOPEND_SEND_SHUTDOWN = 7023, - /* Peer told us that channel is shutting down */ - WIRE_DUALOPEND_GOT_SHUTDOWN = 7024, - /* Peer presented proof it was from the future. */ - WIRE_DUALOPEND_FAIL_FALLEN_BEHIND = 1028, - /* Shutdown is complete */ - WIRE_DUALOPEND_SHUTDOWN_COMPLETE = 7025, - /* dualopend -> master: this was a dry run */ - WIRE_DUALOPEND_DRY_RUN = 7026, - /* dualopend -> master: validate liqudity offer sig */ - WIRE_DUALOPEND_VALIDATE_LEASE = 7027, - WIRE_DUALOPEND_VALIDATE_LEASE_REPLY = 7127, -}; - -const char *dualopend_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool dualopend_wire_is_defined(u16 type); - - -/* WIRE: DUALOPEND_INIT */ -u8 *towire_dualopend_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth); -bool fromwire_dualopend_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth); - -/* WIRE: DUALOPEND_REINIT */ -/* master-dualopend: peer has reconnected */ -u8 *towire_dualopend_reinit(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_feature_set, const u8 *their_init_features, const struct channel_config *our_config, const struct channel_config *their_config, const struct channel_id *channel_id, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, const struct pubkey *their_funding_pubkey, u32 minimum_depth, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 most_recent_feerate_per_kw_funding, struct amount_sat funding_satoshi, struct amount_msat our_funding, const struct basepoints *their_basepoints, const struct pubkey *remote_per_commit, const struct wally_psbt *funding_psbt, enum side opener, bool local_funding_locked, bool remote_funding_locked, bool send_shutdown, bool remote_shutdown_received, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, bool remote_funding_sigs_received, const struct fee_states *fee_states, u8 channel_flags, u32 lease_start_blockheight, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt); -bool fromwire_dualopend_reinit(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_feature_set, u8 **their_init_features, struct channel_config *our_config, struct channel_config *their_config, struct channel_id *channel_id, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, struct pubkey *their_funding_pubkey, u32 *minimum_depth, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *most_recent_feerate_per_kw_funding, struct amount_sat *funding_satoshi, struct amount_msat *our_funding, struct basepoints *their_basepoints, struct pubkey *remote_per_commit, struct wally_psbt **funding_psbt, enum side *opener, bool *local_funding_locked, bool *remote_funding_locked, bool *send_shutdown, bool *remote_shutdown_received, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, bool *remote_funding_sigs_received, struct fee_states **fee_states, u8 *channel_flags, u32 *lease_start_blockheight, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt); - -/* WIRE: DUALOPEND_GOT_OFFER */ -/* dualopend->master: they offered channel */ -u8 *towire_dualopend_got_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat opener_funding, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, u32 locktime, const u8 *shutdown_scriptpubkey, struct amount_sat requested_amt, u32 lease_blockheight_start); -bool fromwire_dualopend_got_offer(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *opener_funding, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u32 *locktime, u8 **shutdown_scriptpubkey, struct amount_sat *requested_amt, u32 *lease_blockheight_start); - -/* WIRE: DUALOPEND_GOT_OFFER_REPLY */ -/* master->dualopend: reply back with our first funding info/contribs */ -u8 *towire_dualopend_got_offer_reply(const tal_t *ctx, struct amount_sat accepter_funding, const struct wally_psbt *psbt, const u8 *our_shutdown_scriptpubkey, const struct lease_rates *lease_rates); -bool fromwire_dualopend_got_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *accepter_funding, struct wally_psbt **psbt, u8 **our_shutdown_scriptpubkey, struct lease_rates **lease_rates); - -/* WIRE: DUALOPEND_GOT_RBF_OFFER */ -/* dualopend->master: they offered a RBF */ -u8 *towire_dualopend_got_rbf_offer(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat their_funding, u32 funding_feerate_per_kw, u32 locktime); -bool fromwire_dualopend_got_rbf_offer(const void *p, struct channel_id *channel_id, struct amount_sat *their_funding, u32 *funding_feerate_per_kw, u32 *locktime); - -/* WIRE: DUALOPEND_GOT_RBF_OFFER_REPLY */ -/* master->dualopend: reply back with our funding info/contribs */ -u8 *towire_dualopend_got_rbf_offer_reply(const tal_t *ctx, struct amount_sat our_funding, const struct wally_psbt *psbt); -bool fromwire_dualopend_got_rbf_offer_reply(const tal_t *ctx, const void *p, struct amount_sat *our_funding, struct wally_psbt **psbt); - -/* WIRE: DUALOPEND_RBF_VALIDATE */ -/* dualopend->master: is this a valid RBF candidate transaction? */ -u8 *towire_dualopend_rbf_validate(const tal_t *ctx, const struct wally_psbt *proposed_funding_psbt); -bool fromwire_dualopend_rbf_validate(const tal_t *ctx, const void *p, struct wally_psbt **proposed_funding_psbt); - -/* WIRE: DUALOPEND_RBF_VALID */ -/* master->dualopend: this is a valid RBF candidate transaction */ -u8 *towire_dualopend_rbf_valid(const tal_t *ctx); -bool fromwire_dualopend_rbf_valid(const void *p); - -/* WIRE: DUALOPEND_RBF_INIT */ -/* master->dualopend: attempt an RBF */ -u8 *towire_dualopend_rbf_init(const tal_t *ctx, struct amount_sat our_funding, u32 funding_feerate_perkw, const struct wally_psbt *psbt); -bool fromwire_dualopend_rbf_init(const tal_t *ctx, const void *p, struct amount_sat *our_funding, u32 *funding_feerate_perkw, struct wally_psbt **psbt); - -/* WIRE: DUALOPEND_COMMIT_RCVD */ -/* dualopend->master: ready to commit channel open to database and */ -/* get some signatures for the funding_tx. */ -u8 *towire_dualopend_commit_rcvd(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *remote_first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct wally_psbt *psbt, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_sat our_funding_sats, u8 channel_flags, u32 feerate_per_kw_funding, u32 feerate_per_kw_commitment, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, u32 lease_start_blockheight, u32 lease_expiry, const secp256k1_ecdsa_signature *lease_commit_sig, u32 lease_chan_max_msat, u16 lease_chan_max_ppt); -bool fromwire_dualopend_commit_rcvd(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **remote_first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct wally_psbt **psbt, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_sat *our_funding_sats, u8 *channel_flags, u32 *feerate_per_kw_funding, u32 *feerate_per_kw_commitment, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, u32 *lease_start_blockheight, u32 *lease_expiry, secp256k1_ecdsa_signature **lease_commit_sig, u32 *lease_chan_max_msat, u16 *lease_chan_max_ppt); - -/* WIRE: DUALOPEND_PSBT_CHANGED */ -/* dualopend->master: peer updated the psbt */ -u8 *towire_dualopend_psbt_changed(const tal_t *ctx, const struct channel_id *channel_id, u64 funding_serial, const struct wally_psbt *psbt); -bool fromwire_dualopend_psbt_changed(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *funding_serial, struct wally_psbt **psbt); - -/* WIRE: DUALOPEND_PSBT_UPDATED */ -/* master->dualopend: we updated the psbt */ -u8 *towire_dualopend_psbt_updated(const tal_t *ctx, const struct wally_psbt *psbt); -bool fromwire_dualopend_psbt_updated(const tal_t *ctx, const void *p, struct wally_psbt **psbt); - -/* WIRE: DUALOPEND_FAIL */ -/* master->dualopend: fail this channel open */ -u8 *towire_dualopend_fail(const tal_t *ctx, const wirestring *reason); -bool fromwire_dualopend_fail(const tal_t *ctx, const void *p, wirestring **reason); - -/* WIRE: DUALOPEND_OPENER_INIT */ -/* master->dualopend: hello */ -u8 *towire_dualopend_opener_init(const tal_t *ctx, const struct wally_psbt *psbt, struct amount_sat funding_amount, const u8 *local_shutdown_scriptpubkey, u32 feerate_per_kw, u32 feerate_per_kw_funding, u8 channel_flags, struct amount_sat requested_sats, u32 blockheight, bool dry_run, const struct lease_rates *expected_rates); -bool fromwire_dualopend_opener_init(const tal_t *ctx, const void *p, struct wally_psbt **psbt, struct amount_sat *funding_amount, u8 **local_shutdown_scriptpubkey, u32 *feerate_per_kw, u32 *feerate_per_kw_funding, u8 *channel_flags, struct amount_sat *requested_sats, u32 *blockheight, bool *dry_run, struct lease_rates **expected_rates); - -/* WIRE: DUALOPEND_FUNDING_SIGS */ -/* dualopend->master received tx_sigs from peer */ -u8 *towire_dualopend_funding_sigs(const tal_t *ctx, const struct wally_psbt *signed_psbt); -bool fromwire_dualopend_funding_sigs(const tal_t *ctx, const void *p, struct wally_psbt **signed_psbt); - -/* WIRE: DUALOPEND_SEND_TX_SIGS */ -/* master->dualopend send our tx_sigs to peer */ -u8 *towire_dualopend_send_tx_sigs(const tal_t *ctx, const struct wally_psbt *signed_psbt); -bool fromwire_dualopend_send_tx_sigs(const tal_t *ctx, const void *p, struct wally_psbt **signed_psbt); - -/* WIRE: DUALOPEND_TX_SIGS_SENT */ -/* dualopend->master tx sigs transmitted to peer */ -u8 *towire_dualopend_tx_sigs_sent(const tal_t *ctx); -bool fromwire_dualopend_tx_sigs_sent(const void *p); - -/* WIRE: DUALOPEND_PEER_LOCKED */ -/* dualopend->peer peer locked channel */ -u8 *towire_dualopend_peer_locked(const tal_t *ctx, const struct pubkey *remote_per_commit); -bool fromwire_dualopend_peer_locked(const void *p, struct pubkey *remote_per_commit); - -/* WIRE: DUALOPEND_CHANNEL_LOCKED */ -/* dualopend->master this channel has been locked */ -u8 *towire_dualopend_channel_locked(const tal_t *ctx, const struct per_peer_state *pps); -bool fromwire_dualopend_channel_locked(const tal_t *ctx, const void *p, struct per_peer_state **pps); - -/* WIRE: DUALOPEND_DEPTH_REACHED */ -/* master->dualopend funding reached depth; tell peer */ -u8 *towire_dualopend_depth_reached(const tal_t *ctx, u32 depth); -bool fromwire_dualopend_depth_reached(const void *p, u32 *depth); - -/* WIRE: DUALOPEND_SEND_SHUTDOWN */ -/* Tell peer to shut down channel. */ -u8 *towire_dualopend_send_shutdown(const tal_t *ctx, const u8 *shutdown_scriptpubkey); -bool fromwire_dualopend_send_shutdown(const tal_t *ctx, const void *p, u8 **shutdown_scriptpubkey); - -/* WIRE: DUALOPEND_GOT_SHUTDOWN */ -/* Peer told us that channel is shutting down */ -u8 *towire_dualopend_got_shutdown(const tal_t *ctx, const u8 *scriptpubkey); -bool fromwire_dualopend_got_shutdown(const tal_t *ctx, const void *p, u8 **scriptpubkey); - -/* WIRE: DUALOPEND_FAIL_FALLEN_BEHIND */ -/* Peer presented proof it was from the future. */ -u8 *towire_dualopend_fail_fallen_behind(const tal_t *ctx); -bool fromwire_dualopend_fail_fallen_behind(const void *p); - -/* WIRE: DUALOPEND_SHUTDOWN_COMPLETE */ -/* Shutdown is complete */ -u8 *towire_dualopend_shutdown_complete(const tal_t *ctx, const struct per_peer_state *per_peer_state); -bool fromwire_dualopend_shutdown_complete(const tal_t *ctx, const void *p, struct per_peer_state **per_peer_state); - -/* WIRE: DUALOPEND_DRY_RUN */ -/* dualopend -> master: this was a dry run */ -u8 *towire_dualopend_dry_run(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat our_funding, struct amount_sat their_funding, const struct lease_rates *lease_rates); -bool fromwire_dualopend_dry_run(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct amount_sat *our_funding, struct amount_sat *their_funding, struct lease_rates **lease_rates); - -/* WIRE: DUALOPEND_VALIDATE_LEASE */ -/* dualopend -> master: validate liqudity offer sig */ -u8 *towire_dualopend_validate_lease(const tal_t *ctx, const secp256k1_ecdsa_signature *sig, u32 lease_expiry, u32 chan_fee_max_base_msat, u16 chan_fee_max_ppt, const struct pubkey *their_pubkey); -bool fromwire_dualopend_validate_lease(const void *p, secp256k1_ecdsa_signature *sig, u32 *lease_expiry, u32 *chan_fee_max_base_msat, u16 *chan_fee_max_ppt, struct pubkey *their_pubkey); - -/* WIRE: DUALOPEND_VALIDATE_LEASE_REPLY */ -u8 *towire_dualopend_validate_lease_reply(const tal_t *ctx, const wirestring *err_msg); -bool fromwire_dualopend_validate_lease_reply(const tal_t *ctx, const void *p, wirestring **err_msg); - - -#endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */ -// SHA256STAMP:da973afd41ef15546d902945a3108aa3c02571d13ffaff0aed63c1ac39740f04 diff --git a/openingd/openingd_wiregen.c b/openingd/openingd_wiregen.c deleted file mode 100644 index 3dea104cb..000000000 --- a/openingd/openingd_wiregen.c +++ /dev/null @@ -1,611 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *openingd_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum openingd_wire)e) { - case WIRE_OPENINGD_INIT: return "WIRE_OPENINGD_INIT"; - case WIRE_OPENINGD_GOT_REESTABLISH: return "WIRE_OPENINGD_GOT_REESTABLISH"; - case WIRE_OPENINGD_GOT_OFFER: return "WIRE_OPENINGD_GOT_OFFER"; - case WIRE_OPENINGD_GOT_OFFER_REPLY: return "WIRE_OPENINGD_GOT_OFFER_REPLY"; - case WIRE_OPENINGD_FUNDER_REPLY: return "WIRE_OPENINGD_FUNDER_REPLY"; - case WIRE_OPENINGD_FUNDER_START: return "WIRE_OPENINGD_FUNDER_START"; - case WIRE_OPENINGD_FUNDER_START_REPLY: return "WIRE_OPENINGD_FUNDER_START_REPLY"; - case WIRE_OPENINGD_FUNDER_COMPLETE: return "WIRE_OPENINGD_FUNDER_COMPLETE"; - case WIRE_OPENINGD_FUNDER_CANCEL: return "WIRE_OPENINGD_FUNDER_CANCEL"; - case WIRE_OPENINGD_FUNDER_FAILED: return "WIRE_OPENINGD_FUNDER_FAILED"; - case WIRE_OPENINGD_FUNDEE: return "WIRE_OPENINGD_FUNDEE"; - case WIRE_OPENINGD_DEV_MEMLEAK: return "WIRE_OPENINGD_DEV_MEMLEAK"; - case WIRE_OPENINGD_DEV_MEMLEAK_REPLY: return "WIRE_OPENINGD_DEV_MEMLEAK_REPLY"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool openingd_wire_is_defined(u16 type) -{ - switch ((enum openingd_wire)type) { - case WIRE_OPENINGD_INIT:; - case WIRE_OPENINGD_GOT_REESTABLISH:; - case WIRE_OPENINGD_GOT_OFFER:; - case WIRE_OPENINGD_GOT_OFFER_REPLY:; - case WIRE_OPENINGD_FUNDER_REPLY:; - case WIRE_OPENINGD_FUNDER_START:; - case WIRE_OPENINGD_FUNDER_START_REPLY:; - case WIRE_OPENINGD_FUNDER_COMPLETE:; - case WIRE_OPENINGD_FUNDER_CANCEL:; - case WIRE_OPENINGD_FUNDER_FAILED:; - case WIRE_OPENINGD_FUNDEE:; - case WIRE_OPENINGD_DEV_MEMLEAK:; - case WIRE_OPENINGD_DEV_MEMLEAK_REPLY:; - return true; - } - return false; -} - - - - - -/* WIRE: OPENINGD_INIT */ -u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, u32 min_feerate, u32 max_feerate, const struct channel_id *dev_temporary_channel_id, bool dev_fast_gossip) -{ - u16 their_init_features_len = tal_count(their_init_features); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_INIT); - /* Which network are we configured for? */ - towire_chainparams(&p, chainparams); - towire_feature_set(&p, our_features); - towire_u16(&p, their_init_features_len); - towire_u8_array(&p, their_init_features, their_init_features_len); - /* Base configuration we'll offer (channel reserve will vary with amount) */ - towire_channel_config(&p, our_config); - /* Minimum/maximum configuration values we'll accept */ - towire_u32(&p, max_to_self_delay); - towire_amount_msat(&p, min_effective_htlc_capacity_msat); - towire_per_peer_state(&p, pps); - towire_basepoints(&p, our_basepoints); - towire_pubkey(&p, our_funding_pubkey); - /* Constraints in case the other end tries to open a channel. */ - towire_u32(&p, minimum_depth); - towire_u32(&p, min_feerate); - towire_u32(&p, max_feerate); - if (!dev_temporary_channel_id) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_channel_id(&p, dev_temporary_channel_id); - } - towire_bool(&p, dev_fast_gossip); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u32 *min_feerate, u32 *max_feerate, struct channel_id **dev_temporary_channel_id, bool *dev_fast_gossip) -{ - u16 their_init_features_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_INIT) - return false; - /* Which network are we configured for? */ - fromwire_chainparams(&cursor, &plen, chainparams); - *our_features = fromwire_feature_set(ctx, &cursor, &plen); - their_init_features_len = fromwire_u16(&cursor, &plen); - // 2nd case their_init_features - *their_init_features = their_init_features_len ? tal_arr(ctx, u8, their_init_features_len) : NULL; - fromwire_u8_array(&cursor, &plen, *their_init_features, their_init_features_len); - /* Base configuration we'll offer (channel reserve will vary with amount) */ - fromwire_channel_config(&cursor, &plen, our_config); - /* Minimum/maximum configuration values we'll accept */ - *max_to_self_delay = fromwire_u32(&cursor, &plen); - *min_effective_htlc_capacity_msat = fromwire_amount_msat(&cursor, &plen); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_basepoints(&cursor, &plen, our_basepoints); - fromwire_pubkey(&cursor, &plen, our_funding_pubkey); - /* Constraints in case the other end tries to open a channel. */ - *minimum_depth = fromwire_u32(&cursor, &plen); - *min_feerate = fromwire_u32(&cursor, &plen); - *max_feerate = fromwire_u32(&cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *dev_temporary_channel_id = NULL; - else { - *dev_temporary_channel_id = tal(ctx, struct channel_id); - fromwire_channel_id(&cursor, &plen, *dev_temporary_channel_id); - } - *dev_fast_gossip = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_GOT_REESTABLISH */ -/* Openingd->master: they tried to reestablish a channel. */ -u8 *towire_openingd_got_reestablish(const tal_t *ctx, const struct channel_id *channel_id, const u8 *msg, const struct per_peer_state *pps) -{ - u16 len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_GOT_REESTABLISH); - towire_channel_id(&p, channel_id); - towire_u16(&p, len); - towire_u8_array(&p, msg, len); - towire_per_peer_state(&p, pps); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_got_reestablish(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **msg, struct per_peer_state **pps) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_GOT_REESTABLISH) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, len); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_GOT_OFFER */ -/* Openingd->master: they offered channel */ -u8 *towire_openingd_got_offer(const tal_t *ctx, struct amount_sat funding_satoshis, struct amount_msat push_msat, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_sat channel_reserve_satoshis, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, const u8 *shutdown_scriptpubkey) -{ - u16 shutdown_len = tal_count(shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_GOT_OFFER); - towire_amount_sat(&p, funding_satoshis); - towire_amount_msat(&p, push_msat); - towire_amount_sat(&p, dust_limit_satoshis); - towire_amount_msat(&p, max_htlc_value_in_flight_msat); - towire_amount_sat(&p, channel_reserve_satoshis); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, feerate_per_kw); - towire_u16(&p, to_self_delay); - towire_u16(&p, max_accepted_htlcs); - towire_u8(&p, channel_flags); - towire_u16(&p, shutdown_len); - towire_u8_array(&p, shutdown_scriptpubkey, shutdown_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_got_offer(const tal_t *ctx, const void *p, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_sat *channel_reserve_satoshis, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u8 **shutdown_scriptpubkey) -{ - u16 shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_GOT_OFFER) - return false; - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *push_msat = fromwire_amount_msat(&cursor, &plen); - *dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen); - *max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen); - *channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - *to_self_delay = fromwire_u16(&cursor, &plen); - *max_accepted_htlcs = fromwire_u16(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case shutdown_scriptpubkey - *shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_len); - return cursor != NULL; -} - -/* WIRE: OPENINGD_GOT_OFFER_REPLY */ -/* master->openingd: optional rejection message */ -u8 *towire_openingd_got_offer_reply(const tal_t *ctx, const wirestring *rejection, const u8 *our_shutdown_scriptpubkey) -{ - u16 shutdown_len = tal_count(our_shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_GOT_OFFER_REPLY); - if (!rejection) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_wirestring(&p, rejection); - } - towire_u16(&p, shutdown_len); - towire_u8_array(&p, our_shutdown_scriptpubkey, shutdown_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_got_offer_reply(const tal_t *ctx, const void *p, wirestring **rejection, u8 **our_shutdown_scriptpubkey) -{ - u16 shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_GOT_OFFER_REPLY) - return false; - if (!fromwire_bool(&cursor, &plen)) - *rejection = NULL; - else { - *rejection = fromwire_wirestring(ctx, &cursor, &plen); - } - shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case our_shutdown_scriptpubkey - *our_shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *our_shutdown_scriptpubkey, shutdown_len); - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDER_REPLY */ -/* Openingd->master: we've successfully offered channel. */ -/* This gives their sig */ -u8 *towire_openingd_funder_reply(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct per_peer_state *pps, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, u32 minimum_depth, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 feerate_per_kw, struct amount_sat our_channel_reserve_satoshis, const u8 *shutdown_scriptpubkey, const struct channel_type *channel_type) -{ - u16 shutdown_len = tal_count(shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDER_REPLY); - towire_channel_config(&p, their_config); - towire_bitcoin_tx(&p, first_commit); - if (!pbase) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_penalty_base(&p, pbase); - } - towire_bitcoin_signature(&p, first_commit_sig); - towire_per_peer_state(&p, pps); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, their_per_commit_point); - towire_u32(&p, minimum_depth); - towire_pubkey(&p, remote_fundingkey); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_u32(&p, feerate_per_kw); - towire_amount_sat(&p, our_channel_reserve_satoshis); - towire_u16(&p, shutdown_len); - towire_u8_array(&p, shutdown_scriptpubkey, shutdown_len); - towire_channel_type(&p, channel_type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_funder_reply(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct per_peer_state **pps, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, u32 *minimum_depth, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *feerate_per_kw, struct amount_sat *our_channel_reserve_satoshis, u8 **shutdown_scriptpubkey, struct channel_type **channel_type) -{ - u16 shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDER_REPLY) - return false; - fromwire_channel_config(&cursor, &plen, their_config); - *first_commit = fromwire_bitcoin_tx(ctx, &cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *pbase = NULL; - else { - *pbase = tal(ctx, struct penalty_base); - fromwire_penalty_base(&cursor, &plen, *pbase); - } - fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, their_per_commit_point); - *minimum_depth = fromwire_u32(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, remote_fundingkey); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - *our_channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen); - shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case shutdown_scriptpubkey - *shutdown_scriptpubkey = shutdown_len ? tal_arr(ctx, u8, shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *shutdown_scriptpubkey, shutdown_len); - *channel_type = fromwire_channel_type(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDER_START */ -/* master->openingd: start channel establishment for a funding tx */ -u8 *towire_openingd_funder_start(const tal_t *ctx, struct amount_sat funding_satoshis, struct amount_msat push_msat, const u8 *upfront_shutdown_script, u32 feerate_per_kw, u8 channel_flags) -{ - u16 len_upfront = tal_count(upfront_shutdown_script); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDER_START); - towire_amount_sat(&p, funding_satoshis); - towire_amount_msat(&p, push_msat); - towire_u16(&p, len_upfront); - towire_u8_array(&p, upfront_shutdown_script, len_upfront); - towire_u32(&p, feerate_per_kw); - towire_u8(&p, channel_flags); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_funder_start(const tal_t *ctx, const void *p, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, u8 **upfront_shutdown_script, u32 *feerate_per_kw, u8 *channel_flags) -{ - u16 len_upfront; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDER_START) - return false; - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *push_msat = fromwire_amount_msat(&cursor, &plen); - len_upfront = fromwire_u16(&cursor, &plen); - // 2nd case upfront_shutdown_script - *upfront_shutdown_script = len_upfront ? tal_arr(ctx, u8, len_upfront) : NULL; - fromwire_u8_array(&cursor, &plen, *upfront_shutdown_script, len_upfront); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDER_START_REPLY */ -/* openingd->master: send back output script for 2-of-2 funding output */ -u8 *towire_openingd_funder_start_reply(const tal_t *ctx, const u8 *scriptpubkey, bool upfront_shutdown_negotiated, const struct channel_type *channel_type) -{ - u8 script_len = tal_count(scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDER_START_REPLY); - towire_u8(&p, script_len); - towire_u8_array(&p, scriptpubkey, script_len); - towire_bool(&p, upfront_shutdown_negotiated); - towire_channel_type(&p, channel_type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_funder_start_reply(const tal_t *ctx, const void *p, u8 **scriptpubkey, bool *upfront_shutdown_negotiated, struct channel_type **channel_type) -{ - u8 script_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDER_START_REPLY) - return false; - script_len = fromwire_u8(&cursor, &plen); - // 2nd case scriptpubkey - *scriptpubkey = script_len ? tal_arr(ctx, u8, script_len) : NULL; - fromwire_u8_array(&cursor, &plen, *scriptpubkey, script_len); - *upfront_shutdown_negotiated = fromwire_bool(&cursor, &plen); - *channel_type = fromwire_channel_type(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDER_COMPLETE */ -/* master->openingd: complete channel establishment for a funding */ -/* tx that will be paid for by an external wallet */ -/* response to this is a normal `openingd_funder_reply` ?? */ -u8 *towire_openingd_funder_complete(const tal_t *ctx, const struct bitcoin_txid *funding_txid, u16 funding_txout, const struct channel_type *channel_type) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDER_COMPLETE); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_channel_type(&p, channel_type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_funder_complete(const tal_t *ctx, const void *p, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct channel_type **channel_type) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDER_COMPLETE) - return false; - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *channel_type = fromwire_channel_type(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDER_CANCEL */ -/*master->openingd: cancel channel establishment for a funding */ -u8 *towire_openingd_funder_cancel(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDER_CANCEL); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_funder_cancel(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDER_CANCEL) - return false; - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDER_FAILED */ -/* Openingd->master: we failed to negotiation channel */ -u8 *towire_openingd_funder_failed(const tal_t *ctx, const wirestring *reason) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDER_FAILED); - towire_wirestring(&p, reason); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_funder_failed(const tal_t *ctx, const void *p, wirestring **reason) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDER_FAILED) - return false; - *reason = fromwire_wirestring(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_FUNDEE */ -/* Openingd->master: they offered channel. */ -/* This gives their txid and info */ -u8 *towire_openingd_fundee(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct per_peer_state *pps, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_msat push_msat, u8 channel_flags, u32 feerate_per_kw, const u8 *funding_signed_msg, struct amount_sat our_channel_reserve_satoshis, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, const struct channel_type *channel_type) -{ - u16 msglen = tal_count(funding_signed_msg); - u16 local_shutdown_len = tal_count(local_shutdown_scriptpubkey); - u16 remote_shutdown_len = tal_count(remote_shutdown_scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_FUNDEE); - towire_channel_config(&p, their_config); - towire_bitcoin_tx(&p, first_commit); - if (!pbase) - towire_bool(&p, false); - else { - towire_bool(&p, true); - towire_penalty_base(&p, pbase); - } - towire_bitcoin_signature(&p, first_commit_sig); - towire_per_peer_state(&p, pps); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, their_per_commit_point); - towire_pubkey(&p, remote_fundingkey); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_txout); - towire_amount_sat(&p, funding_satoshis); - towire_amount_msat(&p, push_msat); - towire_u8(&p, channel_flags); - towire_u32(&p, feerate_per_kw); - /* The funding signed message: send this and we're committed. */ - towire_u16(&p, msglen); - towire_u8_array(&p, funding_signed_msg, msglen); - towire_amount_sat(&p, our_channel_reserve_satoshis); - towire_u16(&p, local_shutdown_len); - towire_u8_array(&p, local_shutdown_scriptpubkey, local_shutdown_len); - towire_u16(&p, remote_shutdown_len); - towire_u8_array(&p, remote_shutdown_scriptpubkey, remote_shutdown_len); - towire_channel_type(&p, channel_type); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_fundee(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct per_peer_state **pps, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, u8 *channel_flags, u32 *feerate_per_kw, u8 **funding_signed_msg, struct amount_sat *our_channel_reserve_satoshis, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, struct channel_type **channel_type) -{ - u16 msglen; - u16 local_shutdown_len; - u16 remote_shutdown_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_FUNDEE) - return false; - fromwire_channel_config(&cursor, &plen, their_config); - *first_commit = fromwire_bitcoin_tx(ctx, &cursor, &plen); - if (!fromwire_bool(&cursor, &plen)) - *pbase = NULL; - else { - *pbase = tal(ctx, struct penalty_base); - fromwire_penalty_base(&cursor, &plen, *pbase); - } - fromwire_bitcoin_signature(&cursor, &plen, first_commit_sig); - *pps = fromwire_per_peer_state(ctx, &cursor, &plen); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, their_per_commit_point); - fromwire_pubkey(&cursor, &plen, remote_fundingkey); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_txout = fromwire_u16(&cursor, &plen); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *push_msat = fromwire_amount_msat(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - /* The funding signed message: send this and we're committed. */ - msglen = fromwire_u16(&cursor, &plen); - // 2nd case funding_signed_msg - *funding_signed_msg = msglen ? tal_arr(ctx, u8, msglen) : NULL; - fromwire_u8_array(&cursor, &plen, *funding_signed_msg, msglen); - *our_channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen); - local_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case local_shutdown_scriptpubkey - *local_shutdown_scriptpubkey = local_shutdown_len ? tal_arr(ctx, u8, local_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *local_shutdown_scriptpubkey, local_shutdown_len); - remote_shutdown_len = fromwire_u16(&cursor, &plen); - // 2nd case remote_shutdown_scriptpubkey - *remote_shutdown_scriptpubkey = remote_shutdown_len ? tal_arr(ctx, u8, remote_shutdown_len) : NULL; - fromwire_u8_array(&cursor, &plen, *remote_shutdown_scriptpubkey, remote_shutdown_len); - *channel_type = fromwire_channel_type(ctx, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPENINGD_DEV_MEMLEAK */ -/* master -> openingd: do you have a memleak? */ -u8 *towire_openingd_dev_memleak(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_DEV_MEMLEAK); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_dev_memleak(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_DEV_MEMLEAK) - return false; - return cursor != NULL; -} - -/* WIRE: OPENINGD_DEV_MEMLEAK_REPLY */ -u8 *towire_openingd_dev_memleak_reply(const tal_t *ctx, bool leak) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPENINGD_DEV_MEMLEAK_REPLY); - towire_bool(&p, leak); - - return memcheck(p, tal_count(p)); -} -bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPENINGD_DEV_MEMLEAK_REPLY) - return false; - *leak = fromwire_bool(&cursor, &plen); - return cursor != NULL; -} -// SHA256STAMP:728c4fe1f57fe55a1d7669ec138002ae1ffa61813549bddcc5a07a994ea7211f diff --git a/openingd/openingd_wiregen.h b/openingd/openingd_wiregen.h deleted file mode 100644 index 41c7fd1c3..000000000 --- a/openingd/openingd_wiregen.h +++ /dev/null @@ -1,132 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H -#define LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum openingd_wire { - WIRE_OPENINGD_INIT = 6000, - /* Openingd->master: they tried to reestablish a channel. */ - WIRE_OPENINGD_GOT_REESTABLISH = 6001, - /* Openingd->master: they offered channel */ - WIRE_OPENINGD_GOT_OFFER = 6005, - /* master->openingd: optional rejection message */ - WIRE_OPENINGD_GOT_OFFER_REPLY = 6105, - /* Openingd->master: we've successfully offered channel. */ - /* This gives their sig */ - WIRE_OPENINGD_FUNDER_REPLY = 6101, - /* master->openingd: start channel establishment for a funding tx */ - WIRE_OPENINGD_FUNDER_START = 6002, - /* openingd->master: send back output script for 2-of-2 funding output */ - WIRE_OPENINGD_FUNDER_START_REPLY = 6102, - /* master->openingd: complete channel establishment for a funding */ - /* tx that will be paid for by an external wallet */ - /* response to this is a normal `openingd_funder_reply` ?? */ - WIRE_OPENINGD_FUNDER_COMPLETE = 6012, - /* master->openingd: cancel channel establishment for a funding */ - WIRE_OPENINGD_FUNDER_CANCEL = 6013, - /* Openingd->master: we failed to negotiation channel */ - WIRE_OPENINGD_FUNDER_FAILED = 6004, - /* Openingd->master: they offered channel. */ - /* This gives their txid and info */ - WIRE_OPENINGD_FUNDEE = 6003, - /* master -> openingd: do you have a memleak? */ - WIRE_OPENINGD_DEV_MEMLEAK = 6033, - WIRE_OPENINGD_DEV_MEMLEAK_REPLY = 6133, -}; - -const char *openingd_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool openingd_wire_is_defined(u16 type); - - -/* WIRE: OPENINGD_INIT */ -u8 *towire_openingd_init(const tal_t *ctx, const struct chainparams *chainparams, const struct feature_set *our_features, const u8 *their_init_features, const struct channel_config *our_config, u32 max_to_self_delay, struct amount_msat min_effective_htlc_capacity_msat, const struct per_peer_state *pps, const struct basepoints *our_basepoints, const struct pubkey *our_funding_pubkey, u32 minimum_depth, u32 min_feerate, u32 max_feerate, const struct channel_id *dev_temporary_channel_id, bool dev_fast_gossip); -bool fromwire_openingd_init(const tal_t *ctx, const void *p, const struct chainparams **chainparams, struct feature_set **our_features, u8 **their_init_features, struct channel_config *our_config, u32 *max_to_self_delay, struct amount_msat *min_effective_htlc_capacity_msat, struct per_peer_state **pps, struct basepoints *our_basepoints, struct pubkey *our_funding_pubkey, u32 *minimum_depth, u32 *min_feerate, u32 *max_feerate, struct channel_id **dev_temporary_channel_id, bool *dev_fast_gossip); - -/* WIRE: OPENINGD_GOT_REESTABLISH */ -/* Openingd->master: they tried to reestablish a channel. */ -u8 *towire_openingd_got_reestablish(const tal_t *ctx, const struct channel_id *channel_id, const u8 *msg, const struct per_peer_state *pps); -bool fromwire_openingd_got_reestablish(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **msg, struct per_peer_state **pps); - -/* WIRE: OPENINGD_GOT_OFFER */ -/* Openingd->master: they offered channel */ -u8 *towire_openingd_got_offer(const tal_t *ctx, struct amount_sat funding_satoshis, struct amount_msat push_msat, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_sat channel_reserve_satoshis, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw, u16 to_self_delay, u16 max_accepted_htlcs, u8 channel_flags, const u8 *shutdown_scriptpubkey); -bool fromwire_openingd_got_offer(const tal_t *ctx, const void *p, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_sat *channel_reserve_satoshis, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw, u16 *to_self_delay, u16 *max_accepted_htlcs, u8 *channel_flags, u8 **shutdown_scriptpubkey); - -/* WIRE: OPENINGD_GOT_OFFER_REPLY */ -/* master->openingd: optional rejection message */ -u8 *towire_openingd_got_offer_reply(const tal_t *ctx, const wirestring *rejection, const u8 *our_shutdown_scriptpubkey); -bool fromwire_openingd_got_offer_reply(const tal_t *ctx, const void *p, wirestring **rejection, u8 **our_shutdown_scriptpubkey); - -/* WIRE: OPENINGD_FUNDER_REPLY */ -/* Openingd->master: we've successfully offered channel. */ -/* This gives their sig */ -u8 *towire_openingd_funder_reply(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct per_peer_state *pps, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, u32 minimum_depth, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, u32 feerate_per_kw, struct amount_sat our_channel_reserve_satoshis, const u8 *shutdown_scriptpubkey, const struct channel_type *channel_type); -bool fromwire_openingd_funder_reply(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct per_peer_state **pps, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, u32 *minimum_depth, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, u32 *feerate_per_kw, struct amount_sat *our_channel_reserve_satoshis, u8 **shutdown_scriptpubkey, struct channel_type **channel_type); - -/* WIRE: OPENINGD_FUNDER_START */ -/* master->openingd: start channel establishment for a funding tx */ -u8 *towire_openingd_funder_start(const tal_t *ctx, struct amount_sat funding_satoshis, struct amount_msat push_msat, const u8 *upfront_shutdown_script, u32 feerate_per_kw, u8 channel_flags); -bool fromwire_openingd_funder_start(const tal_t *ctx, const void *p, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, u8 **upfront_shutdown_script, u32 *feerate_per_kw, u8 *channel_flags); - -/* WIRE: OPENINGD_FUNDER_START_REPLY */ -/* openingd->master: send back output script for 2-of-2 funding output */ -u8 *towire_openingd_funder_start_reply(const tal_t *ctx, const u8 *scriptpubkey, bool upfront_shutdown_negotiated, const struct channel_type *channel_type); -bool fromwire_openingd_funder_start_reply(const tal_t *ctx, const void *p, u8 **scriptpubkey, bool *upfront_shutdown_negotiated, struct channel_type **channel_type); - -/* WIRE: OPENINGD_FUNDER_COMPLETE */ -/* master->openingd: complete channel establishment for a funding */ -/* tx that will be paid for by an external wallet */ -/* response to this is a normal `openingd_funder_reply` ?? */ -u8 *towire_openingd_funder_complete(const tal_t *ctx, const struct bitcoin_txid *funding_txid, u16 funding_txout, const struct channel_type *channel_type); -bool fromwire_openingd_funder_complete(const tal_t *ctx, const void *p, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct channel_type **channel_type); - -/* WIRE: OPENINGD_FUNDER_CANCEL */ -/* master->openingd: cancel channel establishment for a funding */ -u8 *towire_openingd_funder_cancel(const tal_t *ctx); -bool fromwire_openingd_funder_cancel(const void *p); - -/* WIRE: OPENINGD_FUNDER_FAILED */ -/* Openingd->master: we failed to negotiation channel */ -u8 *towire_openingd_funder_failed(const tal_t *ctx, const wirestring *reason); -bool fromwire_openingd_funder_failed(const tal_t *ctx, const void *p, wirestring **reason); - -/* WIRE: OPENINGD_FUNDEE */ -/* Openingd->master: they offered channel. */ -/* This gives their txid and info */ -u8 *towire_openingd_fundee(const tal_t *ctx, const struct channel_config *their_config, const struct bitcoin_tx *first_commit, const struct penalty_base *pbase, const struct bitcoin_signature *first_commit_sig, const struct per_peer_state *pps, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *their_per_commit_point, const struct pubkey *remote_fundingkey, const struct bitcoin_txid *funding_txid, u16 funding_txout, struct amount_sat funding_satoshis, struct amount_msat push_msat, u8 channel_flags, u32 feerate_per_kw, const u8 *funding_signed_msg, struct amount_sat our_channel_reserve_satoshis, const u8 *local_shutdown_scriptpubkey, const u8 *remote_shutdown_scriptpubkey, const struct channel_type *channel_type); -bool fromwire_openingd_fundee(const tal_t *ctx, const void *p, struct channel_config *their_config, struct bitcoin_tx **first_commit, struct penalty_base **pbase, struct bitcoin_signature *first_commit_sig, struct per_peer_state **pps, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *their_per_commit_point, struct pubkey *remote_fundingkey, struct bitcoin_txid *funding_txid, u16 *funding_txout, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, u8 *channel_flags, u32 *feerate_per_kw, u8 **funding_signed_msg, struct amount_sat *our_channel_reserve_satoshis, u8 **local_shutdown_scriptpubkey, u8 **remote_shutdown_scriptpubkey, struct channel_type **channel_type); - -/* WIRE: OPENINGD_DEV_MEMLEAK */ -/* master -> openingd: do you have a memleak? */ -u8 *towire_openingd_dev_memleak(const tal_t *ctx); -bool fromwire_openingd_dev_memleak(const void *p); - -/* WIRE: OPENINGD_DEV_MEMLEAK_REPLY */ -u8 *towire_openingd_dev_memleak_reply(const tal_t *ctx, bool leak); -bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak); - - -#endif /* LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H */ -// SHA256STAMP:728c4fe1f57fe55a1d7669ec138002ae1ffa61813549bddcc5a07a994ea7211f diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c deleted file mode 100644 index e99f50667..000000000 --- a/wallet/db_postgres_sqlgen.c +++ /dev/null @@ -1,2071 +0,0 @@ -#ifndef LIGHTNINGD_WALLET_GEN_DB_POSTGRES -#define LIGHTNINGD_WALLET_GEN_DB_POSTGRES - -#include -#include - -#if HAVE_POSTGRES - -struct db_query db_postgres_queries[] = { - - { - .name = "CREATE TABLE version (version INTEGER)", - .query = "CREATE TABLE version (version INTEGER)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO version VALUES (1)", - .query = "INSERT INTO version VALUES (1)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE outputs ( prev_out_tx BLOB, prev_out_index INTEGER, value BIGINT, type INTEGER, status INTEGER, keyindex INTEGER, PRIMARY KEY (prev_out_tx, prev_out_index));", - .query = "CREATE TABLE outputs ( prev_out_tx BYTEA, prev_out_index INTEGER, value BIGINT, type INTEGER, status INTEGER, keyindex INTEGER, PRIMARY KEY (prev_out_tx, prev_out_index));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE vars ( name VARCHAR(32), val VARCHAR(255), PRIMARY KEY (name));", - .query = "CREATE TABLE vars ( name VARCHAR(32), val VARCHAR(255), PRIMARY KEY (name));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE shachains ( id BIGSERIAL, min_index BIGINT, num_valid BIGINT, PRIMARY KEY (id));", - .query = "CREATE TABLE shachains ( id BIGSERIAL, min_index BIGINT, num_valid BIGINT, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE shachain_known ( shachain_id BIGINT REFERENCES shachains(id) ON DELETE CASCADE, pos INTEGER, idx BIGINT, hash BLOB, PRIMARY KEY (shachain_id, pos));", - .query = "CREATE TABLE shachain_known ( shachain_id BIGINT REFERENCES shachains(id) ON DELETE CASCADE, pos INTEGER, idx BIGINT, hash BYTEA, PRIMARY KEY (shachain_id, pos));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE peers ( id BIGSERIAL, node_id BLOB UNIQUE, address TEXT, PRIMARY KEY (id));", - .query = "CREATE TABLE peers ( id BIGSERIAL, node_id BYTEA UNIQUE, address TEXT, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channels ( id BIGSERIAL, peer_id BIGINT REFERENCES peers(id) ON DELETE CASCADE, short_channel_id TEXT, channel_config_local BIGINT, channel_config_remote BIGINT, state INTEGER, funder INTEGER, channel_flags INTEGER, minimum_depth INTEGER, next_index_local BIGINT, next_index_remote BIGINT, next_htlc_id BIGINT, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_satoshi BIGINT, funding_locked_remote INTEGER, push_msatoshi BIGINT, msatoshi_local BIGINT, fundingkey_remote BLOB, revocation_basepoint_remote BLOB, payment_basepoint_remote BLOB, htlc_basepoint_remote BLOB, delayed_payment_basepoint_remote BLOB, per_commit_remote BLOB, old_per_commit_remote BLOB, local_feerate_per_kw INTEGER, remote_feerate_per_kw INTEGER, shachain_remote_id BIGINT, shutdown_scriptpubkey_remote BLOB, shutdown_keyidx_local BIGINT, last_sent_commit_state BIGINT, last_sent_commit_id INTEGER, last_tx BLOB, last_sig BLOB, closing_fee_received INTEGER, closing_sig_received BLOB, PRIMARY KEY (id));", - .query = "CREATE TABLE channels ( id BIGSERIAL, peer_id BIGINT REFERENCES peers(id) ON DELETE CASCADE, short_channel_id TEXT, channel_config_local BIGINT, channel_config_remote BIGINT, state INTEGER, funder INTEGER, channel_flags INTEGER, minimum_depth INTEGER, next_index_local BIGINT, next_index_remote BIGINT, next_htlc_id BIGINT, funding_tx_id BYTEA, funding_tx_outnum INTEGER, funding_satoshi BIGINT, funding_locked_remote INTEGER, push_msatoshi BIGINT, msatoshi_local BIGINT, fundingkey_remote BYTEA, revocation_basepoint_remote BYTEA, payment_basepoint_remote BYTEA, htlc_basepoint_remote BYTEA, delayed_payment_basepoint_remote BYTEA, per_commit_remote BYTEA, old_per_commit_remote BYTEA, local_feerate_per_kw INTEGER, remote_feerate_per_kw INTEGER, shachain_remote_id BIGINT, shutdown_scriptpubkey_remote BYTEA, shutdown_keyidx_local BIGINT, last_sent_commit_state BIGINT, last_sent_commit_id INTEGER, last_tx BYTEA, last_sig BYTEA, closing_fee_received INTEGER, closing_sig_received BYTEA, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_configs ( id BIGSERIAL, dust_limit_satoshis BIGINT, max_htlc_value_in_flight_msat BIGINT, channel_reserve_satoshis BIGINT, htlc_minimum_msat BIGINT, to_self_delay INTEGER, max_accepted_htlcs INTEGER, PRIMARY KEY (id));", - .query = "CREATE TABLE channel_configs ( id BIGSERIAL, dust_limit_satoshis BIGINT, max_htlc_value_in_flight_msat BIGINT, channel_reserve_satoshis BIGINT, htlc_minimum_msat BIGINT, to_self_delay INTEGER, max_accepted_htlcs INTEGER, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_htlcs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, channel_htlc_id BIGINT, direction INTEGER, origin_htlc BIGINT, msatoshi BIGINT, cltv_expiry INTEGER, payment_hash BLOB, payment_key BLOB, routing_onion BLOB, failuremsg BLOB, malformed_onion INTEGER, hstate INTEGER, shared_secret BLOB, PRIMARY KEY (id), UNIQUE (channel_id, channel_htlc_id, direction));", - .query = "CREATE TABLE channel_htlcs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, channel_htlc_id BIGINT, direction INTEGER, origin_htlc BIGINT, msatoshi BIGINT, cltv_expiry INTEGER, payment_hash BYTEA, payment_key BYTEA, routing_onion BYTEA, failuremsg BYTEA, malformed_onion INTEGER, hstate INTEGER, shared_secret BYTEA, PRIMARY KEY (id), UNIQUE (channel_id, channel_htlc_id, direction));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE invoices ( id BIGSERIAL, state INTEGER, msatoshi BIGINT, payment_hash BLOB, payment_key BLOB, label TEXT, PRIMARY KEY (id), UNIQUE (label), UNIQUE (payment_hash));", - .query = "CREATE TABLE invoices ( id BIGSERIAL, state INTEGER, msatoshi BIGINT, payment_hash BYTEA, payment_key BYTEA, label TEXT, PRIMARY KEY (id), UNIQUE (label), UNIQUE (payment_hash));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, direction INTEGER, destination BLOB, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));", - .query = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BYTEA, direction INTEGER, destination BYTEA, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD expiry_time BIGINT;", - .query = "ALTER TABLE invoices ADD expiry_time BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET expiry_time=9223372036854775807;", - .query = "UPDATE invoices SET expiry_time=9223372036854775807;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD pay_index BIGINT;", - .query = "ALTER TABLE invoices ADD pay_index BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE UNIQUE INDEX invoices_pay_index ON invoices(pay_index);", - .query = "CREATE UNIQUE INDEX invoices_pay_index ON invoices(pay_index);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET pay_index=id WHERE state=1;", - .query = "UPDATE invoices SET pay_index=id WHERE state=1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO vars(name, val) VALUES('next_pay_index', COALESCE((SELECT MAX(pay_index) FROM invoices WHERE state=1), 0) + 1 );", - .query = "INSERT INTO vars(name, val) VALUES('next_pay_index', COALESCE((SELECT MAX(pay_index) FROM invoices WHERE state=1), 0) + 1 );", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD first_blocknum BIGINT;", - .query = "ALTER TABLE channels ADD first_blocknum BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET first_blocknum=1 WHERE short_channel_id IS NOT NULL;", - .query = "UPDATE channels SET first_blocknum=1 WHERE short_channel_id IS NOT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN channel_id BIGINT;", - .query = "ALTER TABLE outputs ADD COLUMN channel_id BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN peer_id BLOB;", - .query = "ALTER TABLE outputs ADD COLUMN peer_id BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN commitment_point BLOB;", - .query = "ALTER TABLE outputs ADD COLUMN commitment_point BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD COLUMN msatoshi_received BIGINT;", - .query = "ALTER TABLE invoices ADD COLUMN msatoshi_received BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET msatoshi_received=0 WHERE state=1;", - .query = "UPDATE invoices SET msatoshi_received=0 WHERE state=1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD COLUMN last_was_revoke INTEGER;", - .query = "ALTER TABLE channels ADD COLUMN last_was_revoke INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments RENAME TO temp_payments;", - .query = "ALTER TABLE payments RENAME TO temp_payments;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));", - .query = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BYTEA, destination BYTEA, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO payments SELECT id, timestamp, status, payment_hash, destination, msatoshi FROM temp_payments WHERE direction=1;", - .query = "INSERT INTO payments SELECT id, timestamp, status, payment_hash, destination, msatoshi FROM temp_payments WHERE direction=1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DROP TABLE temp_payments;", - .query = "DROP TABLE temp_payments;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN payment_preimage BLOB;", - .query = "ALTER TABLE payments ADD COLUMN payment_preimage BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN path_secrets BLOB;", - .query = "ALTER TABLE payments ADD COLUMN path_secrets BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD paid_timestamp BIGINT;", - .query = "ALTER TABLE invoices ADD paid_timestamp BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET paid_timestamp = CURRENT_TIMESTAMP() WHERE state = 1;", - .query = "UPDATE invoices SET paid_timestamp = EXTRACT(epoch FROM now()) WHERE state = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN route_nodes BLOB;", - .query = "ALTER TABLE payments ADD COLUMN route_nodes BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN route_channels BLOB;", - .query = "ALTER TABLE payments ADD COLUMN route_channels BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE htlc_sigs (channelid INTEGER REFERENCES channels(id) ON DELETE CASCADE, signature BLOB);", - .query = "CREATE TABLE htlc_sigs (channelid INTEGER REFERENCES channels(id) ON DELETE CASCADE, signature BYTEA);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX channel_idx ON htlc_sigs (channelid)", - .query = "CREATE INDEX channel_idx ON htlc_sigs (channelid)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM channels WHERE state=1", - .query = "DELETE FROM channels WHERE state=1", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE db_upgrades (upgrade_from INTEGER, lightning_version TEXT);", - .query = "CREATE TABLE db_upgrades (upgrade_from INTEGER, lightning_version TEXT);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);", - .query = "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET STATE = 8 WHERE state > 8;", - .query = "UPDATE channels SET STATE = 8 WHERE state > 8;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD bolt11 TEXT;", - .query = "ALTER TABLE invoices ADD bolt11 TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE blocks (height INT, hash BLOB, prev_hash BLOB, UNIQUE(height));", - .query = "CREATE TABLE blocks (height INT, hash BYTEA, prev_hash BYTEA, UNIQUE(height));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .query = "ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .query = "ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);", - .query = "CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE utxoset ( txid BLOB, outnum INT, blockheight INT REFERENCES blocks(height) ON DELETE CASCADE, spendheight INT REFERENCES blocks(height) ON DELETE SET NULL, txindex INT, scriptpubkey BLOB, satoshis BIGINT, PRIMARY KEY(txid, outnum));", - .query = "CREATE TABLE utxoset ( txid BYTEA, outnum INT, blockheight INT REFERENCES blocks(height) ON DELETE CASCADE, spendheight INT REFERENCES blocks(height) ON DELETE SET NULL, txindex INT, scriptpubkey BYTEA, satoshis BIGINT, PRIMARY KEY(txid, outnum));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)", - .query = "CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX utxoset_spend ON utxoset (spendheight)", - .query = "CREATE INDEX utxoset_spend ON utxoset (spendheight)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET shutdown_keyidx_local=0 WHERE shutdown_keyidx_local = -1;", - .query = "UPDATE channels SET shutdown_keyidx_local=0 WHERE shutdown_keyidx_local = -1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failonionreply BLOB;", - .query = "ALTER TABLE payments ADD failonionreply BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD faildestperm INTEGER;", - .query = "ALTER TABLE payments ADD faildestperm INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failindex INTEGER;", - .query = "ALTER TABLE payments ADD failindex INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failcode INTEGER;", - .query = "ALTER TABLE payments ADD failcode INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failnode BLOB;", - .query = "ALTER TABLE payments ADD failnode BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failchannel TEXT;", - .query = "ALTER TABLE payments ADD failchannel TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failupdate BLOB;", - .query = "ALTER TABLE payments ADD failupdate BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE status <> 0;", - .query = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE status <> 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_payments_offered INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_payments_offered INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_payments_fulfilled INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_payments_fulfilled INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_msatoshi_offered BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_msatoshi_offered BIGINT DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_msatoshi_fulfilled BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_msatoshi_fulfilled BIGINT DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_payments_offered INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_payments_offered INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_payments_fulfilled INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_payments_fulfilled INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_msatoshi_offered BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_msatoshi_offered BIGINT DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_msatoshi_fulfilled BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_msatoshi_fulfilled BIGINT DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET in_payments_offered = 0, in_payments_fulfilled = 0 , in_msatoshi_offered = 0, in_msatoshi_fulfilled = 0 , out_payments_offered = 0, out_payments_fulfilled = 0 , out_msatoshi_offered = 0, out_msatoshi_fulfilled = 0 ;", - .query = "UPDATE channels SET in_payments_offered = 0, in_payments_fulfilled = 0 , in_msatoshi_offered = 0, in_msatoshi_fulfilled = 0 , out_payments_offered = 0, out_payments_fulfilled = 0 , out_msatoshi_offered = 0, out_msatoshi_fulfilled = 0 ;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD msatoshi_sent BIGINT;", - .query = "ALTER TABLE payments ADD msatoshi_sent BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET msatoshi_sent = msatoshi;", - .query = "UPDATE payments SET msatoshi_sent = msatoshi;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM utxoset WHERE blockheight IN ( SELECT DISTINCT(blockheight) FROM utxoset LEFT OUTER JOIN blocks on (blockheight = blocks.height) WHERE blocks.hash IS NULL);", - .query = "DELETE FROM utxoset WHERE blockheight IN ( SELECT DISTINCT(blockheight) FROM utxoset LEFT OUTER JOIN blocks on (blockheight = blocks.height) WHERE blocks.hash IS NULL);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD min_possible_feerate INTEGER;", - .query = "ALTER TABLE channels ADD min_possible_feerate INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD max_possible_feerate INTEGER;", - .query = "ALTER TABLE channels ADD max_possible_feerate INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET min_possible_feerate=0, max_possible_feerate=250000;", - .query = "UPDATE channels SET min_possible_feerate=0, max_possible_feerate=250000;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD msatoshi_to_us_min BIGINT;", - .query = "ALTER TABLE channels ADD msatoshi_to_us_min BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD msatoshi_to_us_max BIGINT;", - .query = "ALTER TABLE channels ADD msatoshi_to_us_max BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET msatoshi_to_us_min = msatoshi_local , msatoshi_to_us_max = msatoshi_local ;", - .query = "UPDATE channels SET msatoshi_to_us_min = msatoshi_local , msatoshi_to_us_max = msatoshi_local ;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE transactions ( id BLOB, blockheight INTEGER REFERENCES blocks(height) ON DELETE SET NULL, txindex INTEGER, rawtx BLOB, PRIMARY KEY (id));", - .query = "CREATE TABLE transactions ( id BYTEA, blockheight INTEGER REFERENCES blocks(height) ON DELETE SET NULL, txindex INTEGER, rawtx BYTEA, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD faildetail TEXT;", - .query = "ALTER TABLE payments ADD faildetail TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET faildetail = 'unspecified payment failure reason' WHERE status = 2;", - .query = "UPDATE payments SET faildetail = 'unspecified payment failure reason' WHERE status = 2;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channeltxs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, type INTEGER, transaction_id BLOB REFERENCES transactions(id) ON DELETE CASCADE, input_num INTEGER, blockheight INTEGER REFERENCES blocks(height) ON DELETE CASCADE, PRIMARY KEY(id));", - .query = "CREATE TABLE channeltxs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, type INTEGER, transaction_id BYTEA REFERENCES transactions(id) ON DELETE CASCADE, input_num INTEGER, blockheight INTEGER REFERENCES blocks(height) ON DELETE CASCADE, PRIMARY KEY(id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM blocks WHERE height > (SELECT MIN(first_blocknum) FROM channels);", - .query = "DELETE FROM blocks WHERE height > (SELECT MIN(first_blocknum) FROM channels);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO blocks (height) VALUES ((SELECT MIN(first_blocknum) FROM channels)) ON CONFLICT(height) DO NOTHING;", - .query = "INSERT INTO blocks (height) VALUES ((SELECT MIN(first_blocknum) FROM channels)) ON CONFLICT(height) DO NOTHING;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM blocks WHERE height IS NULL;", - .query = "DELETE FROM blocks WHERE height IS NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD description TEXT;", - .query = "ALTER TABLE invoices ADD description TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD description TEXT;", - .query = "ALTER TABLE payments ADD description TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD future_per_commitment_point BLOB;", - .query = "ALTER TABLE channels ADD future_per_commitment_point BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD last_sent_commit BLOB;", - .query = "ALTER TABLE channels ADD last_sent_commit BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE forwarded_payments ( in_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, out_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, in_channel_scid BIGINT, out_channel_scid BIGINT, in_msatoshi BIGINT, out_msatoshi BIGINT, state INTEGER, UNIQUE(in_htlc_id, out_htlc_id));", - .query = "CREATE TABLE forwarded_payments ( in_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, out_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, in_channel_scid BIGINT, out_channel_scid BIGINT, in_msatoshi BIGINT, out_msatoshi BIGINT, state INTEGER, UNIQUE(in_htlc_id, out_htlc_id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD faildirection INTEGER;", - .query = "ALTER TABLE payments ADD faildirection INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD scriptpubkey BLOB;", - .query = "ALTER TABLE outputs ADD scriptpubkey BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD bolt11 TEXT;", - .query = "ALTER TABLE payments ADD bolt11 TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD feerate_base INTEGER;", - .query = "ALTER TABLE channels ADD feerate_base INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD feerate_ppm INTEGER;", - .query = "ALTER TABLE channels ADD feerate_ppm INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD received_time BIGINT", - .query = "ALTER TABLE channel_htlcs ADD received_time BIGINT", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE forwarded_payments ADD received_time BIGINT", - .query = "ALTER TABLE forwarded_payments ADD received_time BIGINT", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE forwarded_payments ADD resolved_time BIGINT", - .query = "ALTER TABLE forwarded_payments ADD resolved_time BIGINT", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_upfront_shutdown_script BLOB;", - .query = "ALTER TABLE channels ADD remote_upfront_shutdown_script BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE forwarded_payments ADD failcode INTEGER;", - .query = "ALTER TABLE forwarded_payments ADD failcode INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_ann_node_sig BLOB;", - .query = "ALTER TABLE channels ADD remote_ann_node_sig BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_ann_bitcoin_sig BLOB;", - .query = "ALTER TABLE channels ADD remote_ann_bitcoin_sig BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE transactions ADD type BIGINT;", - .query = "ALTER TABLE transactions ADD type BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE transactions ADD channel_id BIGINT;", - .query = "ALTER TABLE transactions ADD channel_id BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET short_channel_id = REPLACE(short_channel_id, ':', 'x') WHERE short_channel_id IS NOT NULL;", - .query = "UPDATE channels SET short_channel_id = REPLACE(short_channel_id, ':', 'x') WHERE short_channel_id IS NOT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET failchannel = REPLACE(failchannel, ':', 'x') WHERE failchannel IS NOT NULL;", - .query = "UPDATE payments SET failchannel = REPLACE(failchannel, ':', 'x') WHERE failchannel IS NOT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD COLUMN option_static_remotekey INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD COLUMN option_static_remotekey INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE vars ADD COLUMN intval INTEGER", - .query = "ALTER TABLE vars ADD COLUMN intval INTEGER", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE vars ADD COLUMN blobval BLOB", - .query = "ALTER TABLE vars ADD COLUMN blobval BYTEA", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE vars SET intval = CAST(val AS INTEGER) WHERE name IN ('bip32_max_index', 'last_processed_block', 'next_pay_index')", - .query = "UPDATE vars SET intval = CAST(val AS INTEGER) WHERE name IN ('bip32_max_index', 'last_processed_block', 'next_pay_index')", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE vars SET blobval = CAST(val AS BLOB) WHERE name = 'genesis_hash'", - .query = "UPDATE vars SET blobval = CAST(val AS BYTEA) WHERE name = 'genesis_hash'", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE transaction_annotations ( txid BLOB, idx INTEGER, location INTEGER, type INTEGER, channel BIGINT REFERENCES channels(id), UNIQUE(txid, idx));", - .query = "CREATE TABLE transaction_annotations ( txid BYTEA, idx INTEGER, location INTEGER, type INTEGER, channel BIGINT REFERENCES channels(id), UNIQUE(txid, idx));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD shutdown_scriptpubkey_local BLOB;", - .query = "ALTER TABLE channels ADD shutdown_scriptpubkey_local BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;", - .query = "UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD COLUMN features BLOB DEFAULT '';", - .query = "ALTER TABLE invoices ADD COLUMN features BYTEA DEFAULT '';", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi BIGINT, payment_preimage BLOB, path_secrets BLOB, route_nodes BLOB, route_channels BLOB, failonionreply BLOB, faildestperm INTEGER, failindex INTEGER, failcode INTEGER, failnode BLOB, failchannel TEXT, failupdate BLOB, msatoshi_sent BIGINT, faildetail TEXT, description TEXT, faildirection INTEGER, bolt11 TEXT, total_msat BIGINT, partid BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash, partid))", - .query = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BYTEA, destination BYTEA, msatoshi BIGINT, payment_preimage BYTEA, path_secrets BYTEA, route_nodes BYTEA, route_channels BYTEA, failonionreply BYTEA, faildestperm INTEGER, failindex INTEGER, failcode INTEGER, failnode BYTEA, failchannel TEXT, failupdate BYTEA, msatoshi_sent BIGINT, faildetail TEXT, description TEXT, faildirection INTEGER, bolt11 TEXT, total_msat BIGINT, partid BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash, partid))", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO payments (id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11)SELECT id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11 FROM temp_payments;", - .query = "INSERT INTO payments (id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11)SELECT id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11 FROM temp_payments;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET total_msat = msatoshi;", - .query = "UPDATE payments SET total_msat = msatoshi;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET partid = 0;", - .query = "UPDATE payments SET partid = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD partid BIGINT;", - .query = "ALTER TABLE channel_htlcs ADD partid BIGINT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET partid = 0;", - .query = "UPDATE channel_htlcs SET partid = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_feerates ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, feerate_per_kw INTEGER, UNIQUE (channel_id, hstate));", - .query = "CREATE TABLE channel_feerates ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, feerate_per_kw INTEGER, UNIQUE (channel_id, hstate));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 4, local_feerate_per_kw FROM channels WHERE funder = 0;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 4, local_feerate_per_kw FROM channels WHERE funder = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 1, remote_feerate_per_kw FROM channels WHERE funder = 0 and local_feerate_per_kw != remote_feerate_per_kw;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 1, remote_feerate_per_kw FROM channels WHERE funder = 0 and local_feerate_per_kw != remote_feerate_per_kw;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 14, remote_feerate_per_kw FROM channels WHERE funder = 1;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 14, remote_feerate_per_kw FROM channels WHERE funder = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 11, local_feerate_per_kw FROM channels WHERE funder = 1 and local_feerate_per_kw != remote_feerate_per_kw;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 11, local_feerate_per_kw FROM channels WHERE funder = 1 and local_feerate_per_kw != remote_feerate_per_kw;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO vars (name, intval) VALUES ('data_version', 0);", - .query = "INSERT INTO vars (name, intval) VALUES ('data_version', 0);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD localfailmsg BLOB;", - .query = "ALTER TABLE channel_htlcs ADD localfailmsg BYTEA;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET localfailmsg=decode('2002', 'hex') WHERE malformed_onion != 0 AND direction = 1;", - .query = "UPDATE channel_htlcs SET localfailmsg=decode('2002', 'hex') WHERE malformed_onion != 0 AND direction = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD our_funding_satoshi BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD our_funding_satoshi BIGINT DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE penalty_bases ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, commitnum BIGINT, txid BLOB, outnum INTEGER, amount BIGINT, PRIMARY KEY (channel_id, commitnum));", - .query = "CREATE TABLE penalty_bases ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, commitnum BIGINT, txid BYTEA, outnum INTEGER, amount BIGINT, PRIMARY KEY (channel_id, commitnum));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD we_filled INTEGER;", - .query = "ALTER TABLE channel_htlcs ADD we_filled INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO vars (name, intval) VALUES ('coin_moves_count', 0);", - .query = "INSERT INTO vars (name, intval) VALUES ('coin_moves_count', 0);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD reserved_til INTEGER DEFAULT NULL;", - .query = "ALTER TABLE outputs ADD reserved_til INTEGER DEFAULT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD COLUMN option_anchor_outputs INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD COLUMN option_anchor_outputs INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD option_anchor_outputs INTEGER DEFAULT 0;", - .query = "ALTER TABLE outputs ADD option_anchor_outputs INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD full_channel_id BLOB DEFAULT NULL;", - .query = "ALTER TABLE channels ADD full_channel_id BYTEA DEFAULT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD funding_psbt BLOB DEFAULT NULL;", - .query = "ALTER TABLE channels ADD funding_psbt BYTEA DEFAULT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD closer INTEGER DEFAULT 2;", - .query = "ALTER TABLE channels ADD closer INTEGER DEFAULT 2;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD state_change_reason INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD state_change_reason INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_state_changes ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, timestamp BIGINT, old_state INTEGER, new_state INTEGER, cause INTEGER, message TEXT);", - .query = "CREATE TABLE channel_state_changes ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, timestamp BIGINT, old_state INTEGER, new_state INTEGER, cause INTEGER, message TEXT);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE offers ( offer_id BLOB, bolt12 TEXT, label TEXT, status INTEGER, PRIMARY KEY (offer_id));", - .query = "CREATE TABLE offers ( offer_id BYTEA, bolt12 TEXT, label TEXT, status INTEGER, PRIMARY KEY (offer_id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);", - .query = "ALTER TABLE invoices ADD COLUMN local_offer_id BYTEA DEFAULT NULL REFERENCES offers(offer_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);", - .query = "ALTER TABLE payments ADD COLUMN local_offer_id BYTEA DEFAULT NULL REFERENCES offers(offer_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX forwarded_payments_out_htlc_id ON forwarded_payments (out_htlc_id);", - .query = "CREATE INDEX forwarded_payments_out_htlc_id ON forwarded_payments (out_htlc_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL", - .query = "UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)", - .query = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_funding_inflights ( channel_id BIGSERIAL REFERENCES channels(id) ON DELETE CASCADE, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_feerate INTEGER, funding_satoshi BIGINT, our_funding_satoshi BIGINT, funding_psbt BLOB, last_tx BLOB, last_sig BLOB, funding_tx_remote_sigs_received INTEGER, PRIMARY KEY (channel_id, funding_tx_id));", - .query = "CREATE TABLE channel_funding_inflights ( channel_id BIGSERIAL REFERENCES channels(id) ON DELETE CASCADE, funding_tx_id BYTEA, funding_tx_outnum INTEGER, funding_feerate INTEGER, funding_satoshi BIGINT, our_funding_satoshi BIGINT, funding_psbt BYTEA, last_tx BYTEA, last_sig BYTEA, funding_tx_remote_sigs_received INTEGER, PRIMARY KEY (channel_id, funding_tx_id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD revocation_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD revocation_basepoint_local BYTEA", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD payment_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD payment_basepoint_local BYTEA", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD htlc_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD htlc_basepoint_local BYTEA", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD delayed_payment_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD delayed_payment_basepoint_local BYTEA", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD funding_pubkey_local BLOB", - .query = "ALTER TABLE channels ADD funding_pubkey_local BYTEA", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL", - .query = "ALTER TABLE channels ADD shutdown_wrong_txid BYTEA DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL", - .query = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0", - .query = "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0", - .query = "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0", - .query = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL", - .query = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BYTEA DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL", - .query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0", - .query = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_blockheight_start INTEGER DEFAULT 0", - .query = "ALTER TABLE channel_funding_inflights ADD lease_blockheight_start INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL", - .query = "ALTER TABLE channels ADD lease_commit_sig BYTEA DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL", - .query = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .query = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0", - .query = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_blockheights ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, blockheight INTEGER, UNIQUE (channel_id, hstate));", - .query = "CREATE TABLE channel_blockheights ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, blockheight INTEGER, UNIQUE (channel_id, hstate));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD csv_lock INTEGER DEFAULT 1;", - .query = "ALTER TABLE outputs ADD csv_lock INTEGER DEFAULT 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE datastore ( key BLOB, data BLOB, generation BIGINT, PRIMARY KEY (key));", - .query = "CREATE TABLE datastore ( key BYTEA, data BYTEA, generation BIGINT, PRIMARY KEY (key));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX channel_state_changes_channel_id ON channel_state_changes (channel_id);", - .query = "CREATE INDEX channel_state_changes_channel_id ON channel_state_changes (channel_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?", - .query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT version FROM version LIMIT 1", - .query = "SELECT version FROM version LIMIT 1", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE version SET version=?;", - .query = "UPDATE version SET version=$1;", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO db_upgrades VALUES (?, ?);", - .query = "INSERT INTO db_upgrades VALUES ($1, $2);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT intval FROM vars WHERE name = 'data_version'", - .query = "SELECT intval FROM vars WHERE name = 'data_version'", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT intval FROM vars WHERE name= ? LIMIT 1", - .query = "SELECT intval FROM vars WHERE name= $1 LIMIT 1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE vars SET intval=? WHERE name=?;", - .query = "UPDATE vars SET intval=$1 WHERE name=$2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO vars (name, intval) VALUES (?, ?);", - .query = "INSERT INTO vars (name, intval) VALUES ($1, $2);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;", - .query = "UPDATE channels SET feerate_base = $1, feerate_ppm = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;", - .query = "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;", - .query = "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?", - .query = "UPDATE outputs SET scriptpubkey = $1 WHERE prev_out_tx = $2 AND prev_out_index = $3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;", - .query = "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channels SET full_channel_id = ? WHERE id = ?;", - .query = "UPDATE channels SET full_channel_id = $1 WHERE id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)", - .query = "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channels SET revocation_basepoint_local = ?, payment_basepoint_local = ?, htlc_basepoint_local = ?, delayed_payment_basepoint_local = ?, funding_pubkey_local = ? WHERE id = ?;", - .query = "UPDATE channels SET revocation_basepoint_local = $1, payment_basepoint_local = $2, htlc_basepoint_local = $3, delayed_payment_basepoint_local = $4, funding_pubkey_local = $5 WHERE id = $6;", - .placeholders = 6, - .readonly = false, - }, - { - .name = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 4, 0 FROM channels WHERE funder = 0;", - .query = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 4, 0 FROM channels WHERE funder = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 14, 0 FROM channels WHERE funder = 1;", - .query = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 14, 0 FROM channels WHERE funder = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "SELECT c.id, p.node_id, c.fundingkey_remote, inflight.last_tx, inflight.last_sig, inflight.funding_satoshi, inflight.funding_tx_id FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id LEFT OUTER JOIN channel_funding_inflights inflight ON c.id = inflight.channel_id WHERE inflight.last_tx IS NOT NULL;", - .query = "SELECT c.id, p.node_id, c.fundingkey_remote, inflight.last_tx, inflight.last_sig, inflight.funding_satoshi, inflight.funding_tx_id FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id LEFT OUTER JOIN channel_funding_inflights inflight ON c.id = inflight.channel_id WHERE inflight.last_tx IS NOT NULL;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;", - .query = "UPDATE channel_funding_inflights SET last_tx = $1 WHERE channel_id = $2 AND funding_tx_id = $3;", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;", - .query = "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channels SET last_tx = ? WHERE id = ?;", - .query = "UPDATE channels SET last_tx = $1 WHERE id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE invoices SET state = ? WHERE state = ? AND expiry_time <= ?;", - .query = "UPDATE invoices SET state = $1 WHERE state = $2 AND expiry_time <= $3;", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT id FROM invoices WHERE state = ? AND expiry_time <= ?", - .query = "SELECT id FROM invoices WHERE state = $1 AND expiry_time <= $2", - .placeholders = 2, - .readonly = true, - }, - { - .name = "SELECT MIN(expiry_time) FROM invoices WHERE state = ?;", - .query = "SELECT MIN(expiry_time) FROM invoices WHERE state = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO invoices ( payment_hash, payment_key, state , msatoshi, label, expiry_time , pay_index, msatoshi_received , paid_timestamp, bolt11, description, features, local_offer_id) VALUES ( ?, ?, ? , ?, ?, ? , NULL, NULL , NULL, ?, ?, ?, ?);", - .query = "INSERT INTO invoices ( payment_hash, payment_key, state , msatoshi, label, expiry_time , pay_index, msatoshi_received , paid_timestamp, bolt11, description, features, local_offer_id) VALUES ( $1, $2, $3 , $4, $5, $6 , NULL, NULL , NULL, $7, $8, $9, $10);", - .placeholders = 10, - .readonly = false, - }, - { - .name = "SELECT id FROM invoices WHERE label = ?;", - .query = "SELECT id FROM invoices WHERE label = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM invoices WHERE payment_hash = ?;", - .query = "SELECT id FROM invoices WHERE payment_hash = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM invoices WHERE payment_hash = ? AND state = ?;", - .query = "SELECT id FROM invoices WHERE payment_hash = $1 AND state = $2;", - .placeholders = 2, - .readonly = true, - }, - { - .name = "DELETE FROM invoices WHERE id=?;", - .query = "DELETE FROM invoices WHERE id=$1;", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM invoices WHERE state = ? AND expiry_time <= ?;", - .query = "DELETE FROM invoices WHERE state = $1 AND expiry_time <= $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;", - .query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT state FROM invoices WHERE id = ?;", - .query = "SELECT state FROM invoices WHERE id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT local_offer_id FROM invoices WHERE id = ?;", - .query = "SELECT local_offer_id FROM invoices WHERE id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE invoices SET state=? , pay_index=? , msatoshi_received=? , paid_timestamp=? WHERE id=?;", - .query = "UPDATE invoices SET state=$1 , pay_index=$2 , msatoshi_received=$3 , paid_timestamp=$4 WHERE id=$5;", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT id FROM invoices WHERE pay_index IS NOT NULL AND pay_index > ? ORDER BY pay_index ASC LIMIT 1;", - .query = "SELECT id FROM invoices WHERE pay_index IS NOT NULL AND pay_index > $1 ORDER BY pay_index ASC LIMIT 1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices WHERE id = ?;", - .query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices WHERE id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT txid, outnum FROM utxoset WHERE spendheight is NULL", - .query = "SELECT txid, outnum FROM utxoset WHERE spendheight is NULL", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT * from outputs WHERE prev_out_tx=? AND prev_out_index=?", - .query = "SELECT * from outputs WHERE prev_out_tx=$1 AND prev_out_index=$2", - .placeholders = 2, - .readonly = true, - }, - { - .name = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13);", - .placeholders = 13, - .readonly = false, - }, - { - .name = "UPDATE outputs SET status=? WHERE status=? AND prev_out_tx=? AND prev_out_index=?", - .query = "UPDATE outputs SET status=$1 WHERE status=$2 AND prev_out_tx=$3 AND prev_out_index=$4", - .placeholders = 4, - .readonly = false, - }, - { - .name = "UPDATE outputs SET status=? WHERE prev_out_tx=? AND prev_out_index=?", - .query = "UPDATE outputs SET status=$1 WHERE prev_out_tx=$2 AND prev_out_index=$3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs WHERE status= ? ", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs WHERE status= $1 ", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE channel_id IS NOT NULL AND confirmation_height IS NULL", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE channel_id IS NOT NULL AND confirmation_height IS NULL", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE prev_out_tx = ? AND prev_out_index = ?", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE prev_out_tx = $1 AND prev_out_index = $2", - .placeholders = 2, - .readonly = true, - }, - { - .name = "UPDATE outputs SET status=?, reserved_til=? WHERE prev_out_tx=? AND prev_out_index=?", - .query = "UPDATE outputs SET status=$1, reserved_til=$2 WHERE prev_out_tx=$3 AND prev_out_index=$4", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til, csv_lock FROM outputs WHERE status = ? OR (status = ? AND reserved_til <= ?)ORDER BY RANDOM();", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til, csv_lock FROM outputs WHERE status = $1 OR (status = $2 AND reserved_til <= $3)ORDER BY RANDOM();", - .placeholders = 3, - .readonly = true, - }, - { - .name = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, csv_lock) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, csv_lock) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14);", - .placeholders = 14, - .readonly = false, - }, - { - .name = "INSERT INTO shachains (min_index, num_valid) VALUES (?, 0);", - .query = "INSERT INTO shachains (min_index, num_valid) VALUES ($1, 0);", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE shachains SET num_valid=?, min_index=? WHERE id=?", - .query = "UPDATE shachains SET num_valid=$1, min_index=$2 WHERE id=$3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE shachain_known SET idx=?, hash=? WHERE shachain_id=? AND pos=?", - .query = "UPDATE shachain_known SET idx=$1, hash=$2 WHERE shachain_id=$3 AND pos=$4", - .placeholders = 4, - .readonly = false, - }, - { - .name = "INSERT INTO shachain_known (shachain_id, pos, idx, hash) VALUES (?, ?, ?, ?);", - .query = "INSERT INTO shachain_known (shachain_id, pos, idx, hash) VALUES ($1, $2, $3, $4);", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT min_index, num_valid FROM shachains WHERE id=?", - .query = "SELECT min_index, num_valid FROM shachains WHERE id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT idx, hash, pos FROM shachain_known WHERE shachain_id=?", - .query = "SELECT idx, hash, pos FROM shachain_known WHERE shachain_id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id, node_id, address FROM peers WHERE id=?;", - .query = "SELECT id, node_id, address FROM peers WHERE id=$1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT signature FROM htlc_sigs WHERE channelid = ?", - .query = "SELECT signature FROM htlc_sigs WHERE channelid = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT remote_ann_node_sig, remote_ann_bitcoin_sig FROM channels WHERE id = ?", - .query = "SELECT remote_ann_node_sig, remote_ann_bitcoin_sig FROM channels WHERE id = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = ?", - .query = "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT hstate, blockheight FROM channel_blockheights WHERE channel_id = ?", - .query = "SELECT hstate, blockheight FROM channel_blockheights WHERE channel_id = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO channel_funding_inflights ( channel_id, funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_expiry, lease_blockheight_start) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channel_funding_inflights ( channel_id, funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_expiry, lease_blockheight_start) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14);", - .placeholders = 14, - .readonly = false, - }, - { - .name = "UPDATE channel_funding_inflights SET funding_psbt=?, funding_tx_remote_sigs_received=? WHERE channel_id=? AND funding_tx_id=? AND funding_tx_outnum=?", - .query = "UPDATE channel_funding_inflights SET funding_psbt=$1, funding_tx_remote_sigs_received=$2 WHERE channel_id=$3 AND funding_tx_id=$4 AND funding_tx_outnum=$5", - .placeholders = 5, - .readonly = false, - }, - { - .name = "DELETE FROM channel_funding_inflights WHERE channel_id = ?", - .query = "DELETE FROM channel_funding_inflights WHERE channel_id = $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_blockheight_start FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate", - .query = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_blockheight_start FROM channel_funding_inflights WHERE channel_id = $1 ORDER BY funding_feerate", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM channels ORDER BY id DESC LIMIT 1;", - .query = "SELECT id FROM channels ORDER BY id DESC LIMIT 1;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, local_static_remotekey_start, remote_static_remotekey_start, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;", - .query = "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, local_static_remotekey_start, remote_static_remotekey_start, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE channels SET in_payments_offered = COALESCE(in_payments_offered, 0) + 1 , in_msatoshi_offered = COALESCE(in_msatoshi_offered, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET in_payments_offered = COALESCE(in_payments_offered, 0) + 1 , in_msatoshi_offered = COALESCE(in_msatoshi_offered, 0) + $1 WHERE id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET in_payments_fulfilled = COALESCE(in_payments_fulfilled, 0) + 1 , in_msatoshi_fulfilled = COALESCE(in_msatoshi_fulfilled, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET in_payments_fulfilled = COALESCE(in_payments_fulfilled, 0) + 1 , in_msatoshi_fulfilled = COALESCE(in_msatoshi_fulfilled, 0) + $1 WHERE id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET out_payments_offered = COALESCE(out_payments_offered, 0) + 1 , out_msatoshi_offered = COALESCE(out_msatoshi_offered, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET out_payments_offered = COALESCE(out_payments_offered, 0) + 1 , out_msatoshi_offered = COALESCE(out_msatoshi_offered, 0) + $1 WHERE id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET out_payments_fulfilled = COALESCE(out_payments_fulfilled, 0) + 1 , out_msatoshi_fulfilled = COALESCE(out_msatoshi_fulfilled, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET out_payments_fulfilled = COALESCE(out_payments_fulfilled, 0) + 1 , out_msatoshi_fulfilled = COALESCE(out_msatoshi_fulfilled, 0) + $1 WHERE id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT in_payments_offered, in_payments_fulfilled, in_msatoshi_offered, in_msatoshi_fulfilled, out_payments_offered, out_payments_fulfilled, out_msatoshi_offered, out_msatoshi_fulfilled FROM channels WHERE id = ?", - .query = "SELECT in_payments_offered, in_payments_fulfilled, in_msatoshi_offered, in_msatoshi_fulfilled, out_payments_offered, out_payments_fulfilled, out_msatoshi_offered, out_msatoshi_fulfilled FROM channels WHERE id = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT MIN(height), MAX(height) FROM blocks;", - .query = "SELECT MIN(height), MAX(height) FROM blocks;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "INSERT INTO channel_configs DEFAULT VALUES;", - .query = "INSERT INTO channel_configs DEFAULT VALUES;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_configs SET dust_limit_satoshis=?, max_htlc_value_in_flight_msat=?, channel_reserve_satoshis=?, htlc_minimum_msat=?, to_self_delay=?, max_accepted_htlcs=? WHERE id=?;", - .query = "UPDATE channel_configs SET dust_limit_satoshis=$1, max_htlc_value_in_flight_msat=$2, channel_reserve_satoshis=$3, htlc_minimum_msat=$4, to_self_delay=$5, max_accepted_htlcs=$6 WHERE id=$7;", - .placeholders = 7, - .readonly = false, - }, - { - .name = "SELECT id, dust_limit_satoshis, max_htlc_value_in_flight_msat, channel_reserve_satoshis, htlc_minimum_msat, to_self_delay, max_accepted_htlcs FROM channel_configs WHERE id= ? ;", - .query = "SELECT id, dust_limit_satoshis, max_htlc_value_in_flight_msat, channel_reserve_satoshis, htlc_minimum_msat, to_self_delay, max_accepted_htlcs FROM channel_configs WHERE id= $1 ;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?", - .query = "UPDATE channels SET remote_ann_node_sig=$1, remote_ann_bitcoin_sig=$2 WHERE id=$3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?", - .query = "UPDATE channels SET shachain_remote_id=$1, short_channel_id=$2, full_channel_id=$3, state=$4, funder=$5, channel_flags=$6, minimum_depth=$7, next_index_local=$8, next_index_remote=$9, next_htlc_id=$10, funding_tx_id=$11, funding_tx_outnum=$12, funding_satoshi=$13, our_funding_satoshi=$14, funding_locked_remote=$15, push_msatoshi=$16, msatoshi_local=$17, shutdown_scriptpubkey_remote=$18, shutdown_keyidx_local=$19, channel_config_local=$20, last_tx=$21, last_sig=$22, last_was_revoke=$23, min_possible_feerate=$24, max_possible_feerate=$25, msatoshi_to_us_min=$26, msatoshi_to_us_max=$27, feerate_base=$28, feerate_ppm=$29, remote_upfront_shutdown_script=$30, local_static_remotekey_start=$31, remote_static_remotekey_start=$32, option_anchor_outputs=$33, shutdown_scriptpubkey_local=$34, closer=$35, state_change_reason=$36, shutdown_wrong_txid=$37, shutdown_wrong_outnum=$38, lease_expiry=$39, lease_commit_sig=$40, lease_chan_max_msat=$41, lease_chan_max_ppt=$42 WHERE id=$43", - .placeholders = 43, - .readonly = false, - }, - { - .name = "UPDATE channels SET fundingkey_remote=?, revocation_basepoint_remote=?, payment_basepoint_remote=?, htlc_basepoint_remote=?, delayed_payment_basepoint_remote=?, per_commit_remote=?, old_per_commit_remote=?, channel_config_remote=?, future_per_commitment_point=? WHERE id=?", - .query = "UPDATE channels SET fundingkey_remote=$1, revocation_basepoint_remote=$2, payment_basepoint_remote=$3, htlc_basepoint_remote=$4, delayed_payment_basepoint_remote=$5, per_commit_remote=$6, old_per_commit_remote=$7, channel_config_remote=$8, future_per_commitment_point=$9 WHERE id=$10", - .placeholders = 10, - .readonly = false, - }, - { - .name = "DELETE FROM channel_feerates WHERE channel_id=?", - .query = "DELETE FROM channel_feerates WHERE channel_id=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates VALUES(?, ?, ?)", - .query = "INSERT INTO channel_feerates VALUES($1, $2, $3)", - .placeholders = 3, - .readonly = false, - }, - { - .name = "DELETE FROM channel_blockheights WHERE channel_id=?", - .query = "DELETE FROM channel_blockheights WHERE channel_id=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO channel_blockheights VALUES(?, ?, ?)", - .query = "INSERT INTO channel_blockheights VALUES($1, $2, $3)", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE channels SET last_sent_commit=? WHERE id=?", - .query = "UPDATE channels SET last_sent_commit=$1 WHERE id=$2", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES ($1, $2, $3, $4, $5, $6);", - .placeholders = 6, - .readonly = false, - }, - { - .name = "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;", - .query = "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = $1 ORDER BY timestamp ASC;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM peers WHERE node_id = ?", - .query = "SELECT id FROM peers WHERE node_id = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE peers SET address = ? WHERE id = ?", - .query = "UPDATE peers SET address = $1 WHERE id = $2", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO peers (node_id, address) VALUES (?, ?);", - .query = "INSERT INTO peers (node_id, address) VALUES ($1, $2);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local) VALUES ($1, $2, $3, $4, $5, $6, $7, $8);", - .placeholders = 8, - .readonly = false, - }, - { - .name = "DELETE FROM channel_htlcs WHERE channel_id=?", - .query = "DELETE FROM channel_htlcs WHERE channel_id=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM htlc_sigs WHERE channelid=?", - .query = "DELETE FROM htlc_sigs WHERE channelid=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM channeltxs WHERE channel_id=?", - .query = "DELETE FROM channeltxs WHERE channel_id=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM channel_funding_inflights WHERE channel_id=?", - .query = "DELETE FROM channel_funding_inflights WHERE channel_id=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)", - .query = "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=$1)", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?", - .query = "UPDATE channels SET state=$1, peer_id=$2 WHERE channels.id=$3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT * FROM channels WHERE peer_id = ?;", - .query = "SELECT * FROM channels WHERE peer_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM peers WHERE id=?", - .query = "DELETE FROM peers WHERE id=$1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?", - .query = "UPDATE outputs SET confirmation_height = $1 WHERE prev_out_tx = $2", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, shared_secret, routing_onion, received_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, shared_secret, routing_onion, received_time) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11);", - .placeholders = 11, - .readonly = false, - }, - { - .name = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, malformed_onion, partid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?);", - .query = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, malformed_onion, partid) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, 0, $11);", - .placeholders = 11, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?", - .query = "UPDATE channel_htlcs SET hstate=$1, payment_key=$2, malformed_onion=$3, failuremsg=$4, localfailmsg=$5, we_filled=$6 WHERE id=$7", - .placeholders = 7, - .readonly = false, - }, - { - .name = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, we_filled FROM channel_htlcs WHERE direction= ? AND channel_id= ? AND hstate != ?", - .query = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, we_filled FROM channel_htlcs WHERE direction= $1 AND channel_id= $2 AND hstate != $3", - .placeholders = 3, - .readonly = true, - }, - { - .name = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, partid, localfailmsg FROM channel_htlcs WHERE direction = ? AND channel_id = ? AND hstate != ?", - .query = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, partid, localfailmsg FROM channel_htlcs WHERE direction = $1 AND channel_id = $2 AND hstate != $3", - .placeholders = 3, - .readonly = true, - }, - { - .name = "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;", - .query = "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;", - .query = "DELETE FROM channel_htlcs WHERE direction = $1 AND origin_htlc = $2 AND payment_hash = $3 AND partid = $4;", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;", - .query = "SELECT status FROM payments WHERE payment_hash=$1 AND partid = $2;", - .placeholders = 2, - .readonly = true, - }, - { - .name = "INSERT INTO payments ( status, payment_hash, destination, msatoshi, timestamp, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, total_msat, partid, local_offer_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO payments ( status, payment_hash, destination, msatoshi, timestamp, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, total_msat, partid, local_offer_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11, $12, $13, $14);", - .placeholders = 14, - .readonly = false, - }, - { - .name = "DELETE FROM payments WHERE payment_hash = ? AND partid = ?", - .query = "DELETE FROM payments WHERE payment_hash = $1 AND partid = $2", - .placeholders = 2, - .readonly = false, - }, - { - .name = "DELETE FROM payments WHERE payment_hash = ?", - .query = "DELETE FROM payments WHERE payment_hash = $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = ? AND partid = ?", - .query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = $1 AND partid = $2", - .placeholders = 2, - .readonly = true, - }, - { - .name = "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?", - .query = "UPDATE payments SET status=$1 WHERE payment_hash=$2 AND partid=$3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?", - .query = "UPDATE payments SET payment_preimage=$1 WHERE payment_hash=$2 AND partid=$3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;", - .query = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = $1 AND partid = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;", - .query = "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=$1 AND partid=$2;", - .placeholders = 2, - .readonly = true, - }, - { - .name = "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;", - .query = "UPDATE payments SET failonionreply=$1 , faildestperm=$2 , failindex=$3 , failcode=$4 , failnode=$5 , failchannel=$6 , failupdate=$7 , faildetail=$8 , faildirection=$9 WHERE payment_hash=$10 AND partid=$11;", - .placeholders = 11, - .readonly = false, - }, - { - .name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE (payment_hash = ? OR ?) AND (status = ? OR ?) ORDER BY id;", - .query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE (payment_hash = $1 OR $2) AND (status = $3 OR $4) ORDER BY id;", - .placeholders = 4, - .readonly = true, - }, - { - .name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE local_offer_id = ?;", - .query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE local_offer_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM htlc_sigs WHERE channelid = ?", - .query = "DELETE FROM htlc_sigs WHERE channelid = $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)", - .query = "INSERT INTO htlc_sigs (channelid, signature) VALUES ($1, $2)", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT blobval FROM vars WHERE name='genesis_hash'", - .query = "SELECT blobval FROM vars WHERE name='genesis_hash'", - .placeholders = 0, - .readonly = true, - }, - { - .name = "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);", - .query = "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', $1);", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT txid, outnum FROM utxoset WHERE spendheight < ?", - .query = "SELECT txid, outnum FROM utxoset WHERE spendheight < $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM utxoset WHERE spendheight < ?", - .query = "DELETE FROM utxoset WHERE spendheight < $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);", - .query = "INSERT INTO blocks (height, hash, prev_hash) VALUES ($1, $2, $3);", - .placeholders = 3, - .readonly = false, - }, - { - .name = "DELETE FROM blocks WHERE hash = ?", - .query = "DELETE FROM blocks WHERE hash = $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT * FROM blocks WHERE height >= ?;", - .query = "SELECT * FROM blocks WHERE height >= $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM blocks WHERE height > ?", - .query = "DELETE FROM blocks WHERE height > $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?", - .query = "UPDATE outputs SET spend_height = $1, status = $2 WHERE prev_out_tx = $3 AND prev_out_index = $4", - .placeholders = 4, - .readonly = false, - }, - { - .name = "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?", - .query = "UPDATE utxoset SET spendheight = $1 WHERE txid = $2 AND outnum = $3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES($1, $2, $3, $4, $5, $6, $7);", - .placeholders = 7, - .readonly = false, - }, - { - .name = "SELECT height FROM blocks WHERE height = ?", - .query = "SELECT height FROM blocks WHERE height = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL", - .query = "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = $1 AND txindex = $2 AND outnum = $3 AND spendheight IS NULL", - .placeholders = 3, - .readonly = true, - }, - { - .name = "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?", - .query = "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT blockheight, txindex, outnum FROM utxoset WHERE blockheight = ?", - .query = "SELECT blockheight, txindex, outnum FROM utxoset WHERE blockheight = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT blockheight FROM transactions WHERE id=?", - .query = "SELECT blockheight FROM transactions WHERE id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);", - .query = "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES ($1, $2, $3, $4);", - .placeholders = 4, - .readonly = false, - }, - { - .name = "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?", - .query = "UPDATE transactions SET blockheight = $1, txindex = $2 WHERE id = $3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;", - .query = "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES ($1, $2, $3, $4, $5) ON CONFLICT(txid,idx) DO NOTHING;", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT type, channel_id FROM transactions WHERE id=?", - .query = "SELECT type, channel_id FROM transactions WHERE id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?", - .query = "UPDATE transactions SET type = $1, channel_id = $2 WHERE id = $3", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT type FROM transactions WHERE id=?", - .query = "SELECT type FROM transactions WHERE id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT rawtx FROM transactions WHERE id=?", - .query = "SELECT rawtx FROM transactions WHERE id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT blockheight, txindex FROM transactions WHERE id=?", - .query = "SELECT blockheight, txindex FROM transactions WHERE id=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM transactions WHERE blockheight=?", - .query = "SELECT id FROM transactions WHERE blockheight=$1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);", - .query = "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES ($1, $2, $3, $4, $5);", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;", - .query = "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT c.type, c.blockheight, t.rawtx, c.input_num, c.blockheight - t.blockheight + 1 AS depth, t.id as txid FROM channeltxs c JOIN transactions t ON t.id = c.transaction_id WHERE c.channel_id = ? ORDER BY c.id ASC;", - .query = "SELECT c.type, c.blockheight, t.rawtx, c.input_num, c.blockheight - t.blockheight + 1 AS depth, t.id as txid FROM channeltxs c JOIN transactions t ON t.id = c.transaction_id WHERE c.channel_id = $1 ORDER BY c.id ASC;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?", - .query = "UPDATE forwarded_payments SET in_msatoshi=$1, out_msatoshi=$2, state=$3, resolved_time=$4, failcode=$5 WHERE in_htlc_id=$6", - .placeholders = 6, - .readonly = false, - }, - { - .name = "INSERT INTO forwarded_payments ( in_htlc_id, out_htlc_id, in_channel_scid, out_channel_scid, in_msatoshi, out_msatoshi, state, received_time, resolved_time, failcode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO forwarded_payments ( in_htlc_id, out_htlc_id, in_channel_scid, out_channel_scid, in_msatoshi, out_msatoshi, state, received_time, resolved_time, failcode) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10);", - .placeholders = 10, - .readonly = false, - }, - { - .name = "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;", - .query = "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT f.state, in_msatoshi, out_msatoshi, hin.payment_hash as payment_hash, in_channel_scid, out_channel_scid, f.received_time, f.resolved_time, f.failcode FROM forwarded_payments f LEFT JOIN channel_htlcs hin ON (f.in_htlc_id = hin.id) WHERE (1 = ? OR f.state = ?) AND (1 = ? OR f.in_channel_scid = ?) AND (1 = ? OR f.out_channel_scid = ?)", - .query = "SELECT f.state, in_msatoshi, out_msatoshi, hin.payment_hash as payment_hash, in_channel_scid, out_channel_scid, f.received_time, f.resolved_time, f.failcode FROM forwarded_payments f LEFT JOIN channel_htlcs hin ON (f.in_htlc_id = hin.id) WHERE (1 = $1 OR f.state = $2) AND (1 = $3 OR f.in_channel_scid = $4) AND (1 = $5 OR f.out_channel_scid = $6)", - .placeholders = 6, - .readonly = true, - }, - { - .name = "SELECT t.id, t.rawtx, t.blockheight, t.txindex, t.type as txtype, c2.short_channel_id as txchan, a.location, a.idx as ann_idx, a.type as annotation_type, c.short_channel_id FROM transactions t LEFT JOIN transaction_annotations a ON (a.txid = t.id) LEFT JOIN channels c ON (a.channel = c.id) LEFT JOIN channels c2 ON (t.channel_id = c2.id) ORDER BY t.blockheight, t.txindex ASC", - .query = "SELECT t.id, t.rawtx, t.blockheight, t.txindex, t.type as txtype, c2.short_channel_id as txchan, a.location, a.idx as ann_idx, a.type as annotation_type, c.short_channel_id FROM transactions t LEFT JOIN transaction_annotations a ON (a.txid = t.id) LEFT JOIN channels c ON (a.channel = c.id) LEFT JOIN channels c2 ON (t.channel_id = c2.id) ORDER BY t.blockheight, t.txindex ASC", - .placeholders = 0, - .readonly = true, - }, - { - .name = "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);", - .query = "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES ($1, $2, $3, $4, $5);", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?", - .query = "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = $1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?", - .query = "DELETE FROM penalty_bases WHERE channel_id = $1 AND commitnum = $2", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT 1 FROM offers WHERE offer_id = ?;", - .query = "SELECT 1 FROM offers WHERE offer_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);", - .query = "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES ($1, $2, $3, $4);", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;", - .query = "SELECT bolt12, label, status FROM offers WHERE offer_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT offer_id FROM offers;", - .query = "SELECT offer_id FROM offers;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE offers SET status=? WHERE offer_id = ?;", - .query = "UPDATE offers SET status=$1 WHERE offer_id = $2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;", - .query = "UPDATE invoices SET state=$1 WHERE state=$2 AND local_offer_id = $3;", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT status FROM offers WHERE offer_id = ?;", - .query = "SELECT status FROM offers WHERE offer_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE datastore SET data=?, generation=generation+1 WHERE key=?;", - .query = "UPDATE datastore SET data=$1, generation=generation+1 WHERE key=$2;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO datastore VALUES (?, ?, 0);", - .query = "INSERT INTO datastore VALUES ($1, $2, 0);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "DELETE FROM datastore WHERE key = ?", - .query = "DELETE FROM datastore WHERE key = $1", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT key, data, generation FROM datastore WHERE key >= ? ORDER BY key;", - .query = "SELECT key, data, generation FROM datastore WHERE key >= $1 ORDER BY key;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT key, data, generation FROM datastore ORDER BY key;", - .query = "SELECT key, data, generation FROM datastore ORDER BY key;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT name FROM sqlite_master WHERE type='table';", - .query = "SELECT name FROM sqlite_master WHERE type='table';", - .placeholders = 0, - .readonly = true, - }, - { - .name = "not a valid SQL statement", - .query = "not a valid SQL statement", - .placeholders = 0, - .readonly = false, - }, - { - .name = "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;", - .query = "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = $1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO channels (id) VALUES (1);", - .query = "INSERT INTO channels (id) VALUES (1);", - .placeholders = 0, - .readonly = false, - }, -}; - -#define DB_POSTGRES_QUERY_COUNT 342 - -#endif /* HAVE_POSTGRES */ - -#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ - -// SHA256STAMP:e9f02b73335ca1a0b3308fba7c97f45bafe6fd773c42a915f07fb9679ca51b81 diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c deleted file mode 100644 index ab3f24493..000000000 --- a/wallet/db_sqlite3_sqlgen.c +++ /dev/null @@ -1,2071 +0,0 @@ -#ifndef LIGHTNINGD_WALLET_GEN_DB_SQLITE3 -#define LIGHTNINGD_WALLET_GEN_DB_SQLITE3 - -#include -#include - -#if HAVE_SQLITE3 - -struct db_query db_sqlite3_queries[] = { - - { - .name = "CREATE TABLE version (version INTEGER)", - .query = "CREATE TABLE version (version INTEGER)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO version VALUES (1)", - .query = "INSERT INTO version VALUES (1)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE outputs ( prev_out_tx BLOB, prev_out_index INTEGER, value BIGINT, type INTEGER, status INTEGER, keyindex INTEGER, PRIMARY KEY (prev_out_tx, prev_out_index));", - .query = "CREATE TABLE outputs ( prev_out_tx BLOB, prev_out_index INTEGER, value INTEGER, type INTEGER, status INTEGER, keyindex INTEGER, PRIMARY KEY (prev_out_tx, prev_out_index));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE vars ( name VARCHAR(32), val VARCHAR(255), PRIMARY KEY (name));", - .query = "CREATE TABLE vars ( name VARCHAR(32), val VARCHAR(255), PRIMARY KEY (name));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE shachains ( id BIGSERIAL, min_index BIGINT, num_valid BIGINT, PRIMARY KEY (id));", - .query = "CREATE TABLE shachains ( id INTEGER, min_index INTEGER, num_valid INTEGER, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE shachain_known ( shachain_id BIGINT REFERENCES shachains(id) ON DELETE CASCADE, pos INTEGER, idx BIGINT, hash BLOB, PRIMARY KEY (shachain_id, pos));", - .query = "CREATE TABLE shachain_known ( shachain_id INTEGER REFERENCES shachains(id) ON DELETE CASCADE, pos INTEGER, idx INTEGER, hash BLOB, PRIMARY KEY (shachain_id, pos));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE peers ( id BIGSERIAL, node_id BLOB UNIQUE, address TEXT, PRIMARY KEY (id));", - .query = "CREATE TABLE peers ( id INTEGER, node_id BLOB UNIQUE, address TEXT, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channels ( id BIGSERIAL, peer_id BIGINT REFERENCES peers(id) ON DELETE CASCADE, short_channel_id TEXT, channel_config_local BIGINT, channel_config_remote BIGINT, state INTEGER, funder INTEGER, channel_flags INTEGER, minimum_depth INTEGER, next_index_local BIGINT, next_index_remote BIGINT, next_htlc_id BIGINT, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_satoshi BIGINT, funding_locked_remote INTEGER, push_msatoshi BIGINT, msatoshi_local BIGINT, fundingkey_remote BLOB, revocation_basepoint_remote BLOB, payment_basepoint_remote BLOB, htlc_basepoint_remote BLOB, delayed_payment_basepoint_remote BLOB, per_commit_remote BLOB, old_per_commit_remote BLOB, local_feerate_per_kw INTEGER, remote_feerate_per_kw INTEGER, shachain_remote_id BIGINT, shutdown_scriptpubkey_remote BLOB, shutdown_keyidx_local BIGINT, last_sent_commit_state BIGINT, last_sent_commit_id INTEGER, last_tx BLOB, last_sig BLOB, closing_fee_received INTEGER, closing_sig_received BLOB, PRIMARY KEY (id));", - .query = "CREATE TABLE channels ( id INTEGER, peer_id INTEGER REFERENCES peers(id) ON DELETE CASCADE, short_channel_id TEXT, channel_config_local INTEGER, channel_config_remote INTEGER, state INTEGER, funder INTEGER, channel_flags INTEGER, minimum_depth INTEGER, next_index_local INTEGER, next_index_remote INTEGER, next_htlc_id INTEGER, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_satoshi INTEGER, funding_locked_remote INTEGER, push_msatoshi INTEGER, msatoshi_local INTEGER, fundingkey_remote BLOB, revocation_basepoint_remote BLOB, payment_basepoint_remote BLOB, htlc_basepoint_remote BLOB, delayed_payment_basepoint_remote BLOB, per_commit_remote BLOB, old_per_commit_remote BLOB, local_feerate_per_kw INTEGER, remote_feerate_per_kw INTEGER, shachain_remote_id INTEGER, shutdown_scriptpubkey_remote BLOB, shutdown_keyidx_local INTEGER, last_sent_commit_state INTEGER, last_sent_commit_id INTEGER, last_tx BLOB, last_sig BLOB, closing_fee_received INTEGER, closing_sig_received BLOB, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_configs ( id BIGSERIAL, dust_limit_satoshis BIGINT, max_htlc_value_in_flight_msat BIGINT, channel_reserve_satoshis BIGINT, htlc_minimum_msat BIGINT, to_self_delay INTEGER, max_accepted_htlcs INTEGER, PRIMARY KEY (id));", - .query = "CREATE TABLE channel_configs ( id INTEGER, dust_limit_satoshis INTEGER, max_htlc_value_in_flight_msat INTEGER, channel_reserve_satoshis INTEGER, htlc_minimum_msat INTEGER, to_self_delay INTEGER, max_accepted_htlcs INTEGER, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_htlcs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, channel_htlc_id BIGINT, direction INTEGER, origin_htlc BIGINT, msatoshi BIGINT, cltv_expiry INTEGER, payment_hash BLOB, payment_key BLOB, routing_onion BLOB, failuremsg BLOB, malformed_onion INTEGER, hstate INTEGER, shared_secret BLOB, PRIMARY KEY (id), UNIQUE (channel_id, channel_htlc_id, direction));", - .query = "CREATE TABLE channel_htlcs ( id INTEGER, channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, channel_htlc_id INTEGER, direction INTEGER, origin_htlc INTEGER, msatoshi INTEGER, cltv_expiry INTEGER, payment_hash BLOB, payment_key BLOB, routing_onion BLOB, failuremsg BLOB, malformed_onion INTEGER, hstate INTEGER, shared_secret BLOB, PRIMARY KEY (id), UNIQUE (channel_id, channel_htlc_id, direction));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE invoices ( id BIGSERIAL, state INTEGER, msatoshi BIGINT, payment_hash BLOB, payment_key BLOB, label TEXT, PRIMARY KEY (id), UNIQUE (label), UNIQUE (payment_hash));", - .query = "CREATE TABLE invoices ( id INTEGER, state INTEGER, msatoshi INTEGER, payment_hash BLOB, payment_key BLOB, label TEXT, PRIMARY KEY (id), UNIQUE (label), UNIQUE (payment_hash));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, direction INTEGER, destination BLOB, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));", - .query = "CREATE TABLE payments ( id INTEGER, timestamp INTEGER, status INTEGER, payment_hash BLOB, direction INTEGER, destination BLOB, msatoshi INTEGER, PRIMARY KEY (id), UNIQUE (payment_hash));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD expiry_time BIGINT;", - .query = "ALTER TABLE invoices ADD expiry_time INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET expiry_time=9223372036854775807;", - .query = "UPDATE invoices SET expiry_time=9223372036854775807;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD pay_index BIGINT;", - .query = "ALTER TABLE invoices ADD pay_index INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE UNIQUE INDEX invoices_pay_index ON invoices(pay_index);", - .query = "CREATE UNIQUE INDEX invoices_pay_index ON invoices(pay_index);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET pay_index=id WHERE state=1;", - .query = "UPDATE invoices SET pay_index=id WHERE state=1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO vars(name, val) VALUES('next_pay_index', COALESCE((SELECT MAX(pay_index) FROM invoices WHERE state=1), 0) + 1 );", - .query = "INSERT INTO vars(name, val) VALUES('next_pay_index', COALESCE((SELECT MAX(pay_index) FROM invoices WHERE state=1), 0) + 1 );", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD first_blocknum BIGINT;", - .query = "ALTER TABLE channels ADD first_blocknum INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET first_blocknum=1 WHERE short_channel_id IS NOT NULL;", - .query = "UPDATE channels SET first_blocknum=1 WHERE short_channel_id IS NOT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN channel_id BIGINT;", - .query = "ALTER TABLE outputs ADD COLUMN channel_id INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN peer_id BLOB;", - .query = "ALTER TABLE outputs ADD COLUMN peer_id BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN commitment_point BLOB;", - .query = "ALTER TABLE outputs ADD COLUMN commitment_point BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD COLUMN msatoshi_received BIGINT;", - .query = "ALTER TABLE invoices ADD COLUMN msatoshi_received INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET msatoshi_received=0 WHERE state=1;", - .query = "UPDATE invoices SET msatoshi_received=0 WHERE state=1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD COLUMN last_was_revoke INTEGER;", - .query = "ALTER TABLE channels ADD COLUMN last_was_revoke INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments RENAME TO temp_payments;", - .query = "ALTER TABLE payments RENAME TO temp_payments;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));", - .query = "CREATE TABLE payments ( id INTEGER, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi INTEGER, PRIMARY KEY (id), UNIQUE (payment_hash));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO payments SELECT id, timestamp, status, payment_hash, destination, msatoshi FROM temp_payments WHERE direction=1;", - .query = "INSERT INTO payments SELECT id, timestamp, status, payment_hash, destination, msatoshi FROM temp_payments WHERE direction=1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DROP TABLE temp_payments;", - .query = "DROP TABLE temp_payments;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN payment_preimage BLOB;", - .query = "ALTER TABLE payments ADD COLUMN payment_preimage BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN path_secrets BLOB;", - .query = "ALTER TABLE payments ADD COLUMN path_secrets BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD paid_timestamp BIGINT;", - .query = "ALTER TABLE invoices ADD paid_timestamp INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE invoices SET paid_timestamp = CURRENT_TIMESTAMP() WHERE state = 1;", - .query = "UPDATE invoices SET paid_timestamp = strftime('%s', 'now') WHERE state = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN route_nodes BLOB;", - .query = "ALTER TABLE payments ADD COLUMN route_nodes BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN route_channels BLOB;", - .query = "ALTER TABLE payments ADD COLUMN route_channels BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE htlc_sigs (channelid INTEGER REFERENCES channels(id) ON DELETE CASCADE, signature BLOB);", - .query = "CREATE TABLE htlc_sigs (channelid INTEGER REFERENCES channels(id) ON DELETE CASCADE, signature BLOB);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX channel_idx ON htlc_sigs (channelid)", - .query = "CREATE INDEX channel_idx ON htlc_sigs (channelid)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM channels WHERE state=1", - .query = "DELETE FROM channels WHERE state=1", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE db_upgrades (upgrade_from INTEGER, lightning_version TEXT);", - .query = "CREATE TABLE db_upgrades (upgrade_from INTEGER, lightning_version TEXT);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);", - .query = "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET STATE = 8 WHERE state > 8;", - .query = "UPDATE channels SET STATE = 8 WHERE state > 8;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD bolt11 TEXT;", - .query = "ALTER TABLE invoices ADD bolt11 TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE blocks (height INT, hash BLOB, prev_hash BLOB, UNIQUE(height));", - .query = "CREATE TABLE blocks (height INT, hash BLOB, prev_hash BLOB, UNIQUE(height));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .query = "ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .query = "ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);", - .query = "CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE utxoset ( txid BLOB, outnum INT, blockheight INT REFERENCES blocks(height) ON DELETE CASCADE, spendheight INT REFERENCES blocks(height) ON DELETE SET NULL, txindex INT, scriptpubkey BLOB, satoshis BIGINT, PRIMARY KEY(txid, outnum));", - .query = "CREATE TABLE utxoset ( txid BLOB, outnum INT, blockheight INT REFERENCES blocks(height) ON DELETE CASCADE, spendheight INT REFERENCES blocks(height) ON DELETE SET NULL, txindex INT, scriptpubkey BLOB, satoshis INTEGER, PRIMARY KEY(txid, outnum));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)", - .query = "CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX utxoset_spend ON utxoset (spendheight)", - .query = "CREATE INDEX utxoset_spend ON utxoset (spendheight)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET shutdown_keyidx_local=0 WHERE shutdown_keyidx_local = -1;", - .query = "UPDATE channels SET shutdown_keyidx_local=0 WHERE shutdown_keyidx_local = -1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failonionreply BLOB;", - .query = "ALTER TABLE payments ADD failonionreply BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD faildestperm INTEGER;", - .query = "ALTER TABLE payments ADD faildestperm INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failindex INTEGER;", - .query = "ALTER TABLE payments ADD failindex INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failcode INTEGER;", - .query = "ALTER TABLE payments ADD failcode INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failnode BLOB;", - .query = "ALTER TABLE payments ADD failnode BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failchannel TEXT;", - .query = "ALTER TABLE payments ADD failchannel TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD failupdate BLOB;", - .query = "ALTER TABLE payments ADD failupdate BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE status <> 0;", - .query = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE status <> 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_payments_offered INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_payments_offered INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_payments_fulfilled INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_payments_fulfilled INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_msatoshi_offered BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_msatoshi_offered INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD in_msatoshi_fulfilled BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD in_msatoshi_fulfilled INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_payments_offered INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_payments_offered INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_payments_fulfilled INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_payments_fulfilled INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_msatoshi_offered BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_msatoshi_offered INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD out_msatoshi_fulfilled BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD out_msatoshi_fulfilled INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET in_payments_offered = 0, in_payments_fulfilled = 0 , in_msatoshi_offered = 0, in_msatoshi_fulfilled = 0 , out_payments_offered = 0, out_payments_fulfilled = 0 , out_msatoshi_offered = 0, out_msatoshi_fulfilled = 0 ;", - .query = "UPDATE channels SET in_payments_offered = 0, in_payments_fulfilled = 0 , in_msatoshi_offered = 0, in_msatoshi_fulfilled = 0 , out_payments_offered = 0, out_payments_fulfilled = 0 , out_msatoshi_offered = 0, out_msatoshi_fulfilled = 0 ;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD msatoshi_sent BIGINT;", - .query = "ALTER TABLE payments ADD msatoshi_sent INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET msatoshi_sent = msatoshi;", - .query = "UPDATE payments SET msatoshi_sent = msatoshi;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM utxoset WHERE blockheight IN ( SELECT DISTINCT(blockheight) FROM utxoset LEFT OUTER JOIN blocks on (blockheight = blocks.height) WHERE blocks.hash IS NULL);", - .query = "DELETE FROM utxoset WHERE blockheight IN ( SELECT DISTINCT(blockheight) FROM utxoset LEFT OUTER JOIN blocks on (blockheight = blocks.height) WHERE blocks.hash IS NULL);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD min_possible_feerate INTEGER;", - .query = "ALTER TABLE channels ADD min_possible_feerate INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD max_possible_feerate INTEGER;", - .query = "ALTER TABLE channels ADD max_possible_feerate INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET min_possible_feerate=0, max_possible_feerate=250000;", - .query = "UPDATE channels SET min_possible_feerate=0, max_possible_feerate=250000;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD msatoshi_to_us_min BIGINT;", - .query = "ALTER TABLE channels ADD msatoshi_to_us_min INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD msatoshi_to_us_max BIGINT;", - .query = "ALTER TABLE channels ADD msatoshi_to_us_max INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET msatoshi_to_us_min = msatoshi_local , msatoshi_to_us_max = msatoshi_local ;", - .query = "UPDATE channels SET msatoshi_to_us_min = msatoshi_local , msatoshi_to_us_max = msatoshi_local ;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE transactions ( id BLOB, blockheight INTEGER REFERENCES blocks(height) ON DELETE SET NULL, txindex INTEGER, rawtx BLOB, PRIMARY KEY (id));", - .query = "CREATE TABLE transactions ( id BLOB, blockheight INTEGER REFERENCES blocks(height) ON DELETE SET NULL, txindex INTEGER, rawtx BLOB, PRIMARY KEY (id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD faildetail TEXT;", - .query = "ALTER TABLE payments ADD faildetail TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET faildetail = 'unspecified payment failure reason' WHERE status = 2;", - .query = "UPDATE payments SET faildetail = 'unspecified payment failure reason' WHERE status = 2;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channeltxs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, type INTEGER, transaction_id BLOB REFERENCES transactions(id) ON DELETE CASCADE, input_num INTEGER, blockheight INTEGER REFERENCES blocks(height) ON DELETE CASCADE, PRIMARY KEY(id));", - .query = "CREATE TABLE channeltxs ( id INTEGER, channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, type INTEGER, transaction_id BLOB REFERENCES transactions(id) ON DELETE CASCADE, input_num INTEGER, blockheight INTEGER REFERENCES blocks(height) ON DELETE CASCADE, PRIMARY KEY(id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM blocks WHERE height > (SELECT MIN(first_blocknum) FROM channels);", - .query = "DELETE FROM blocks WHERE height > (SELECT MIN(first_blocknum) FROM channels);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO blocks (height) VALUES ((SELECT MIN(first_blocknum) FROM channels)) ON CONFLICT(height) DO NOTHING;", - .query = "INSERT OR IGNORE INTO blocks (height) VALUES ((SELECT MIN(first_blocknum) FROM channels));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "DELETE FROM blocks WHERE height IS NULL;", - .query = "DELETE FROM blocks WHERE height IS NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD description TEXT;", - .query = "ALTER TABLE invoices ADD description TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD description TEXT;", - .query = "ALTER TABLE payments ADD description TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD future_per_commitment_point BLOB;", - .query = "ALTER TABLE channels ADD future_per_commitment_point BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD last_sent_commit BLOB;", - .query = "ALTER TABLE channels ADD last_sent_commit BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE forwarded_payments ( in_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, out_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, in_channel_scid BIGINT, out_channel_scid BIGINT, in_msatoshi BIGINT, out_msatoshi BIGINT, state INTEGER, UNIQUE(in_htlc_id, out_htlc_id));", - .query = "CREATE TABLE forwarded_payments ( in_htlc_id INTEGER REFERENCES channel_htlcs(id) ON DELETE SET NULL, out_htlc_id INTEGER REFERENCES channel_htlcs(id) ON DELETE SET NULL, in_channel_scid INTEGER, out_channel_scid INTEGER, in_msatoshi INTEGER, out_msatoshi INTEGER, state INTEGER, UNIQUE(in_htlc_id, out_htlc_id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD faildirection INTEGER;", - .query = "ALTER TABLE payments ADD faildirection INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD scriptpubkey BLOB;", - .query = "ALTER TABLE outputs ADD scriptpubkey BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD bolt11 TEXT;", - .query = "ALTER TABLE payments ADD bolt11 TEXT;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD feerate_base INTEGER;", - .query = "ALTER TABLE channels ADD feerate_base INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD feerate_ppm INTEGER;", - .query = "ALTER TABLE channels ADD feerate_ppm INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD received_time BIGINT", - .query = "ALTER TABLE channel_htlcs ADD received_time INTEGER", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE forwarded_payments ADD received_time BIGINT", - .query = "ALTER TABLE forwarded_payments ADD received_time INTEGER", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE forwarded_payments ADD resolved_time BIGINT", - .query = "ALTER TABLE forwarded_payments ADD resolved_time INTEGER", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_upfront_shutdown_script BLOB;", - .query = "ALTER TABLE channels ADD remote_upfront_shutdown_script BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE forwarded_payments ADD failcode INTEGER;", - .query = "ALTER TABLE forwarded_payments ADD failcode INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_ann_node_sig BLOB;", - .query = "ALTER TABLE channels ADD remote_ann_node_sig BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_ann_bitcoin_sig BLOB;", - .query = "ALTER TABLE channels ADD remote_ann_bitcoin_sig BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE transactions ADD type BIGINT;", - .query = "ALTER TABLE transactions ADD type INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE transactions ADD channel_id BIGINT;", - .query = "ALTER TABLE transactions ADD channel_id INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET short_channel_id = REPLACE(short_channel_id, ':', 'x') WHERE short_channel_id IS NOT NULL;", - .query = "UPDATE channels SET short_channel_id = REPLACE(short_channel_id, ':', 'x') WHERE short_channel_id IS NOT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET failchannel = REPLACE(failchannel, ':', 'x') WHERE failchannel IS NOT NULL;", - .query = "UPDATE payments SET failchannel = REPLACE(failchannel, ':', 'x') WHERE failchannel IS NOT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD COLUMN option_static_remotekey INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD COLUMN option_static_remotekey INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE vars ADD COLUMN intval INTEGER", - .query = "ALTER TABLE vars ADD COLUMN intval INTEGER", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE vars ADD COLUMN blobval BLOB", - .query = "ALTER TABLE vars ADD COLUMN blobval BLOB", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE vars SET intval = CAST(val AS INTEGER) WHERE name IN ('bip32_max_index', 'last_processed_block', 'next_pay_index')", - .query = "UPDATE vars SET intval = CAST(val AS INTEGER) WHERE name IN ('bip32_max_index', 'last_processed_block', 'next_pay_index')", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE vars SET blobval = CAST(val AS BLOB) WHERE name = 'genesis_hash'", - .query = "UPDATE vars SET blobval = CAST(val AS BLOB) WHERE name = 'genesis_hash'", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE transaction_annotations ( txid BLOB, idx INTEGER, location INTEGER, type INTEGER, channel BIGINT REFERENCES channels(id), UNIQUE(txid, idx));", - .query = "CREATE TABLE transaction_annotations ( txid BLOB, idx INTEGER, location INTEGER, type INTEGER, channel INTEGER REFERENCES channels(id), UNIQUE(txid, idx));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD shutdown_scriptpubkey_local BLOB;", - .query = "ALTER TABLE channels ADD shutdown_scriptpubkey_local BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;", - .query = "UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD COLUMN features BLOB DEFAULT '';", - .query = "ALTER TABLE invoices ADD COLUMN features BLOB DEFAULT '';", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi BIGINT, payment_preimage BLOB, path_secrets BLOB, route_nodes BLOB, route_channels BLOB, failonionreply BLOB, faildestperm INTEGER, failindex INTEGER, failcode INTEGER, failnode BLOB, failchannel TEXT, failupdate BLOB, msatoshi_sent BIGINT, faildetail TEXT, description TEXT, faildirection INTEGER, bolt11 TEXT, total_msat BIGINT, partid BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash, partid))", - .query = "CREATE TABLE payments ( id INTEGER, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi INTEGER, payment_preimage BLOB, path_secrets BLOB, route_nodes BLOB, route_channels BLOB, failonionreply BLOB, faildestperm INTEGER, failindex INTEGER, failcode INTEGER, failnode BLOB, failchannel TEXT, failupdate BLOB, msatoshi_sent INTEGER, faildetail TEXT, description TEXT, faildirection INTEGER, bolt11 TEXT, total_msat INTEGER, partid INTEGER, PRIMARY KEY (id), UNIQUE (payment_hash, partid))", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO payments (id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11)SELECT id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11 FROM temp_payments;", - .query = "INSERT INTO payments (id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11)SELECT id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11 FROM temp_payments;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET total_msat = msatoshi;", - .query = "UPDATE payments SET total_msat = msatoshi;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE payments SET partid = 0;", - .query = "UPDATE payments SET partid = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD partid BIGINT;", - .query = "ALTER TABLE channel_htlcs ADD partid INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET partid = 0;", - .query = "UPDATE channel_htlcs SET partid = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_feerates ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, feerate_per_kw INTEGER, UNIQUE (channel_id, hstate));", - .query = "CREATE TABLE channel_feerates ( channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, feerate_per_kw INTEGER, UNIQUE (channel_id, hstate));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 4, local_feerate_per_kw FROM channels WHERE funder = 0;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 4, local_feerate_per_kw FROM channels WHERE funder = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 1, remote_feerate_per_kw FROM channels WHERE funder = 0 and local_feerate_per_kw != remote_feerate_per_kw;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 1, remote_feerate_per_kw FROM channels WHERE funder = 0 and local_feerate_per_kw != remote_feerate_per_kw;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 14, remote_feerate_per_kw FROM channels WHERE funder = 1;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 14, remote_feerate_per_kw FROM channels WHERE funder = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 11, local_feerate_per_kw FROM channels WHERE funder = 1 and local_feerate_per_kw != remote_feerate_per_kw;", - .query = "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 11, local_feerate_per_kw FROM channels WHERE funder = 1 and local_feerate_per_kw != remote_feerate_per_kw;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO vars (name, intval) VALUES ('data_version', 0);", - .query = "INSERT INTO vars (name, intval) VALUES ('data_version', 0);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD localfailmsg BLOB;", - .query = "ALTER TABLE channel_htlcs ADD localfailmsg BLOB;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET localfailmsg=decode('2002', 'hex') WHERE malformed_onion != 0 AND direction = 1;", - .query = "UPDATE channel_htlcs SET localfailmsg=x'2002' WHERE malformed_onion != 0 AND direction = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD our_funding_satoshi BIGINT DEFAULT 0;", - .query = "ALTER TABLE channels ADD our_funding_satoshi INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE penalty_bases ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, commitnum BIGINT, txid BLOB, outnum INTEGER, amount BIGINT, PRIMARY KEY (channel_id, commitnum));", - .query = "CREATE TABLE penalty_bases ( channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, commitnum INTEGER, txid BLOB, outnum INTEGER, amount INTEGER, PRIMARY KEY (channel_id, commitnum));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_htlcs ADD we_filled INTEGER;", - .query = "ALTER TABLE channel_htlcs ADD we_filled INTEGER;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO vars (name, intval) VALUES ('coin_moves_count', 0);", - .query = "INSERT INTO vars (name, intval) VALUES ('coin_moves_count', 0);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD reserved_til INTEGER DEFAULT NULL;", - .query = "ALTER TABLE outputs ADD reserved_til INTEGER DEFAULT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD COLUMN option_anchor_outputs INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD COLUMN option_anchor_outputs INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD option_anchor_outputs INTEGER DEFAULT 0;", - .query = "ALTER TABLE outputs ADD option_anchor_outputs INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD full_channel_id BLOB DEFAULT NULL;", - .query = "ALTER TABLE channels ADD full_channel_id BLOB DEFAULT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD funding_psbt BLOB DEFAULT NULL;", - .query = "ALTER TABLE channels ADD funding_psbt BLOB DEFAULT NULL;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD closer INTEGER DEFAULT 2;", - .query = "ALTER TABLE channels ADD closer INTEGER DEFAULT 2;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD state_change_reason INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD state_change_reason INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_state_changes ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, timestamp BIGINT, old_state INTEGER, new_state INTEGER, cause INTEGER, message TEXT);", - .query = "CREATE TABLE channel_state_changes ( channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, timestamp INTEGER, old_state INTEGER, new_state INTEGER, cause INTEGER, message TEXT);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE offers ( offer_id BLOB, bolt12 TEXT, label TEXT, status INTEGER, PRIMARY KEY (offer_id));", - .query = "CREATE TABLE offers ( offer_id BLOB, bolt12 TEXT, label TEXT, status INTEGER, PRIMARY KEY (offer_id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE invoices ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);", - .query = "ALTER TABLE invoices ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);", - .query = "ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", - .query = "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX forwarded_payments_out_htlc_id ON forwarded_payments (out_htlc_id);", - .query = "CREATE INDEX forwarded_payments_out_htlc_id ON forwarded_payments (out_htlc_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL", - .query = "UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)", - .query = "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_funding_inflights ( channel_id BIGSERIAL REFERENCES channels(id) ON DELETE CASCADE, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_feerate INTEGER, funding_satoshi BIGINT, our_funding_satoshi BIGINT, funding_psbt BLOB, last_tx BLOB, last_sig BLOB, funding_tx_remote_sigs_received INTEGER, PRIMARY KEY (channel_id, funding_tx_id));", - .query = "CREATE TABLE channel_funding_inflights ( channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_feerate INTEGER, funding_satoshi INTEGER, our_funding_satoshi INTEGER, funding_psbt BLOB, last_tx BLOB, last_sig BLOB, funding_tx_remote_sigs_received INTEGER, PRIMARY KEY (channel_id, funding_tx_id));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD revocation_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD revocation_basepoint_local BLOB", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD payment_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD payment_basepoint_local BLOB", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD htlc_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD htlc_basepoint_local BLOB", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD delayed_payment_basepoint_local BLOB", - .query = "ALTER TABLE channels ADD delayed_payment_basepoint_local BLOB", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD funding_pubkey_local BLOB", - .query = "ALTER TABLE channels ADD funding_pubkey_local BLOB", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL", - .query = "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL", - .query = "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0", - .query = "ALTER TABLE channels ADD local_static_remotekey_start INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0", - .query = "ALTER TABLE channels ADD remote_static_remotekey_start INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0", - .query = "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL", - .query = "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL", - .query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .query = "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0", - .query = "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channel_funding_inflights ADD lease_blockheight_start INTEGER DEFAULT 0", - .query = "ALTER TABLE channel_funding_inflights ADD lease_blockheight_start INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL", - .query = "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL", - .query = "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .query = "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0", - .query = "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE channel_blockheights ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, blockheight INTEGER, UNIQUE (channel_id, hstate));", - .query = "CREATE TABLE channel_blockheights ( channel_id INTEGER REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, blockheight INTEGER, UNIQUE (channel_id, hstate));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "ALTER TABLE outputs ADD csv_lock INTEGER DEFAULT 1;", - .query = "ALTER TABLE outputs ADD csv_lock INTEGER DEFAULT 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE TABLE datastore ( key BLOB, data BLOB, generation BIGINT, PRIMARY KEY (key));", - .query = "CREATE TABLE datastore ( key BLOB, data BLOB, generation INTEGER, PRIMARY KEY (key));", - .placeholders = 0, - .readonly = false, - }, - { - .name = "CREATE INDEX channel_state_changes_channel_id ON channel_state_changes (channel_id);", - .query = "CREATE INDEX channel_state_changes_channel_id ON channel_state_changes (channel_id);", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?", - .query = "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT version FROM version LIMIT 1", - .query = "SELECT version FROM version LIMIT 1", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE version SET version=?;", - .query = "UPDATE version SET version=?;", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO db_upgrades VALUES (?, ?);", - .query = "INSERT INTO db_upgrades VALUES (?, ?);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT intval FROM vars WHERE name = 'data_version'", - .query = "SELECT intval FROM vars WHERE name = 'data_version'", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT intval FROM vars WHERE name= ? LIMIT 1", - .query = "SELECT intval FROM vars WHERE name= ? LIMIT 1", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE vars SET intval=? WHERE name=?;", - .query = "UPDATE vars SET intval=? WHERE name=?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO vars (name, intval) VALUES (?, ?);", - .query = "INSERT INTO vars (name, intval) VALUES (?, ?);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;", - .query = "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;", - .query = "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;", - .query = "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?", - .query = "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;", - .query = "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channels SET full_channel_id = ? WHERE id = ?;", - .query = "UPDATE channels SET full_channel_id = ? WHERE id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)", - .query = "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channels SET revocation_basepoint_local = ?, payment_basepoint_local = ?, htlc_basepoint_local = ?, delayed_payment_basepoint_local = ?, funding_pubkey_local = ? WHERE id = ?;", - .query = "UPDATE channels SET revocation_basepoint_local = ?, payment_basepoint_local = ?, htlc_basepoint_local = ?, delayed_payment_basepoint_local = ?, funding_pubkey_local = ? WHERE id = ?;", - .placeholders = 6, - .readonly = false, - }, - { - .name = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 4, 0 FROM channels WHERE funder = 0;", - .query = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 4, 0 FROM channels WHERE funder = 0;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 14, 0 FROM channels WHERE funder = 1;", - .query = "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 14, 0 FROM channels WHERE funder = 1;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "SELECT c.id, p.node_id, c.fundingkey_remote, inflight.last_tx, inflight.last_sig, inflight.funding_satoshi, inflight.funding_tx_id FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id LEFT OUTER JOIN channel_funding_inflights inflight ON c.id = inflight.channel_id WHERE inflight.last_tx IS NOT NULL;", - .query = "SELECT c.id, p.node_id, c.fundingkey_remote, inflight.last_tx, inflight.last_sig, inflight.funding_satoshi, inflight.funding_tx_id FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id LEFT OUTER JOIN channel_funding_inflights inflight ON c.id = inflight.channel_id WHERE inflight.last_tx IS NOT NULL;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;", - .query = "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;", - .query = "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE channels SET last_tx = ? WHERE id = ?;", - .query = "UPDATE channels SET last_tx = ? WHERE id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE invoices SET state = ? WHERE state = ? AND expiry_time <= ?;", - .query = "UPDATE invoices SET state = ? WHERE state = ? AND expiry_time <= ?;", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT id FROM invoices WHERE state = ? AND expiry_time <= ?", - .query = "SELECT id FROM invoices WHERE state = ? AND expiry_time <= ?", - .placeholders = 2, - .readonly = true, - }, - { - .name = "SELECT MIN(expiry_time) FROM invoices WHERE state = ?;", - .query = "SELECT MIN(expiry_time) FROM invoices WHERE state = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO invoices ( payment_hash, payment_key, state , msatoshi, label, expiry_time , pay_index, msatoshi_received , paid_timestamp, bolt11, description, features, local_offer_id) VALUES ( ?, ?, ? , ?, ?, ? , NULL, NULL , NULL, ?, ?, ?, ?);", - .query = "INSERT INTO invoices ( payment_hash, payment_key, state , msatoshi, label, expiry_time , pay_index, msatoshi_received , paid_timestamp, bolt11, description, features, local_offer_id) VALUES ( ?, ?, ? , ?, ?, ? , NULL, NULL , NULL, ?, ?, ?, ?);", - .placeholders = 10, - .readonly = false, - }, - { - .name = "SELECT id FROM invoices WHERE label = ?;", - .query = "SELECT id FROM invoices WHERE label = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM invoices WHERE payment_hash = ?;", - .query = "SELECT id FROM invoices WHERE payment_hash = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM invoices WHERE payment_hash = ? AND state = ?;", - .query = "SELECT id FROM invoices WHERE payment_hash = ? AND state = ?;", - .placeholders = 2, - .readonly = true, - }, - { - .name = "DELETE FROM invoices WHERE id=?;", - .query = "DELETE FROM invoices WHERE id=?;", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM invoices WHERE state = ? AND expiry_time <= ?;", - .query = "DELETE FROM invoices WHERE state = ? AND expiry_time <= ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;", - .query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT state FROM invoices WHERE id = ?;", - .query = "SELECT state FROM invoices WHERE id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT local_offer_id FROM invoices WHERE id = ?;", - .query = "SELECT local_offer_id FROM invoices WHERE id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE invoices SET state=? , pay_index=? , msatoshi_received=? , paid_timestamp=? WHERE id=?;", - .query = "UPDATE invoices SET state=? , pay_index=? , msatoshi_received=? , paid_timestamp=? WHERE id=?;", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT id FROM invoices WHERE pay_index IS NOT NULL AND pay_index > ? ORDER BY pay_index ASC LIMIT 1;", - .query = "SELECT id FROM invoices WHERE pay_index IS NOT NULL AND pay_index > ? ORDER BY pay_index ASC LIMIT 1;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices WHERE id = ?;", - .query = "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices WHERE id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT txid, outnum FROM utxoset WHERE spendheight is NULL", - .query = "SELECT txid, outnum FROM utxoset WHERE spendheight is NULL", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT * from outputs WHERE prev_out_tx=? AND prev_out_index=?", - .query = "SELECT * from outputs WHERE prev_out_tx=? AND prev_out_index=?", - .placeholders = 2, - .readonly = true, - }, - { - .name = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 13, - .readonly = false, - }, - { - .name = "UPDATE outputs SET status=? WHERE status=? AND prev_out_tx=? AND prev_out_index=?", - .query = "UPDATE outputs SET status=? WHERE status=? AND prev_out_tx=? AND prev_out_index=?", - .placeholders = 4, - .readonly = false, - }, - { - .name = "UPDATE outputs SET status=? WHERE prev_out_tx=? AND prev_out_index=?", - .query = "UPDATE outputs SET status=? WHERE prev_out_tx=? AND prev_out_index=?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs WHERE status= ? ", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs WHERE status= ? ", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE channel_id IS NOT NULL AND confirmation_height IS NULL", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE channel_id IS NOT NULL AND confirmation_height IS NULL", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE prev_out_tx = ? AND prev_out_index = ?", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE prev_out_tx = ? AND prev_out_index = ?", - .placeholders = 2, - .readonly = true, - }, - { - .name = "UPDATE outputs SET status=?, reserved_til=? WHERE prev_out_tx=? AND prev_out_index=?", - .query = "UPDATE outputs SET status=?, reserved_til=? WHERE prev_out_tx=? AND prev_out_index=?", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til, csv_lock FROM outputs WHERE status = ? OR (status = ? AND reserved_til <= ?)ORDER BY RANDOM();", - .query = "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til, csv_lock FROM outputs WHERE status = ? OR (status = ? AND reserved_til <= ?)ORDER BY RANDOM();", - .placeholders = 3, - .readonly = true, - }, - { - .name = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, csv_lock) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, csv_lock) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 14, - .readonly = false, - }, - { - .name = "INSERT INTO shachains (min_index, num_valid) VALUES (?, 0);", - .query = "INSERT INTO shachains (min_index, num_valid) VALUES (?, 0);", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE shachains SET num_valid=?, min_index=? WHERE id=?", - .query = "UPDATE shachains SET num_valid=?, min_index=? WHERE id=?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE shachain_known SET idx=?, hash=? WHERE shachain_id=? AND pos=?", - .query = "UPDATE shachain_known SET idx=?, hash=? WHERE shachain_id=? AND pos=?", - .placeholders = 4, - .readonly = false, - }, - { - .name = "INSERT INTO shachain_known (shachain_id, pos, idx, hash) VALUES (?, ?, ?, ?);", - .query = "INSERT INTO shachain_known (shachain_id, pos, idx, hash) VALUES (?, ?, ?, ?);", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT min_index, num_valid FROM shachains WHERE id=?", - .query = "SELECT min_index, num_valid FROM shachains WHERE id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT idx, hash, pos FROM shachain_known WHERE shachain_id=?", - .query = "SELECT idx, hash, pos FROM shachain_known WHERE shachain_id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id, node_id, address FROM peers WHERE id=?;", - .query = "SELECT id, node_id, address FROM peers WHERE id=?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT signature FROM htlc_sigs WHERE channelid = ?", - .query = "SELECT signature FROM htlc_sigs WHERE channelid = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT remote_ann_node_sig, remote_ann_bitcoin_sig FROM channels WHERE id = ?", - .query = "SELECT remote_ann_node_sig, remote_ann_bitcoin_sig FROM channels WHERE id = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = ?", - .query = "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT hstate, blockheight FROM channel_blockheights WHERE channel_id = ?", - .query = "SELECT hstate, blockheight FROM channel_blockheights WHERE channel_id = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO channel_funding_inflights ( channel_id, funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_expiry, lease_blockheight_start) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channel_funding_inflights ( channel_id, funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_expiry, lease_blockheight_start) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 14, - .readonly = false, - }, - { - .name = "UPDATE channel_funding_inflights SET funding_psbt=?, funding_tx_remote_sigs_received=? WHERE channel_id=? AND funding_tx_id=? AND funding_tx_outnum=?", - .query = "UPDATE channel_funding_inflights SET funding_psbt=?, funding_tx_remote_sigs_received=? WHERE channel_id=? AND funding_tx_id=? AND funding_tx_outnum=?", - .placeholders = 5, - .readonly = false, - }, - { - .name = "DELETE FROM channel_funding_inflights WHERE channel_id = ?", - .query = "DELETE FROM channel_funding_inflights WHERE channel_id = ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_blockheight_start FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate", - .query = "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_blockheight_start FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM channels ORDER BY id DESC LIMIT 1;", - .query = "SELECT id FROM channels ORDER BY id DESC LIMIT 1;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, local_static_remotekey_start, remote_static_remotekey_start, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;", - .query = "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, local_static_remotekey_start, remote_static_remotekey_start, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE channels SET in_payments_offered = COALESCE(in_payments_offered, 0) + 1 , in_msatoshi_offered = COALESCE(in_msatoshi_offered, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET in_payments_offered = COALESCE(in_payments_offered, 0) + 1 , in_msatoshi_offered = COALESCE(in_msatoshi_offered, 0) + ? WHERE id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET in_payments_fulfilled = COALESCE(in_payments_fulfilled, 0) + 1 , in_msatoshi_fulfilled = COALESCE(in_msatoshi_fulfilled, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET in_payments_fulfilled = COALESCE(in_payments_fulfilled, 0) + 1 , in_msatoshi_fulfilled = COALESCE(in_msatoshi_fulfilled, 0) + ? WHERE id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET out_payments_offered = COALESCE(out_payments_offered, 0) + 1 , out_msatoshi_offered = COALESCE(out_msatoshi_offered, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET out_payments_offered = COALESCE(out_payments_offered, 0) + 1 , out_msatoshi_offered = COALESCE(out_msatoshi_offered, 0) + ? WHERE id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE channels SET out_payments_fulfilled = COALESCE(out_payments_fulfilled, 0) + 1 , out_msatoshi_fulfilled = COALESCE(out_msatoshi_fulfilled, 0) + ? WHERE id = ?;", - .query = "UPDATE channels SET out_payments_fulfilled = COALESCE(out_payments_fulfilled, 0) + 1 , out_msatoshi_fulfilled = COALESCE(out_msatoshi_fulfilled, 0) + ? WHERE id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT in_payments_offered, in_payments_fulfilled, in_msatoshi_offered, in_msatoshi_fulfilled, out_payments_offered, out_payments_fulfilled, out_msatoshi_offered, out_msatoshi_fulfilled FROM channels WHERE id = ?", - .query = "SELECT in_payments_offered, in_payments_fulfilled, in_msatoshi_offered, in_msatoshi_fulfilled, out_payments_offered, out_payments_fulfilled, out_msatoshi_offered, out_msatoshi_fulfilled FROM channels WHERE id = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT MIN(height), MAX(height) FROM blocks;", - .query = "SELECT MIN(height), MAX(height) FROM blocks;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "INSERT INTO channel_configs DEFAULT VALUES;", - .query = "INSERT INTO channel_configs DEFAULT VALUES;", - .placeholders = 0, - .readonly = false, - }, - { - .name = "UPDATE channel_configs SET dust_limit_satoshis=?, max_htlc_value_in_flight_msat=?, channel_reserve_satoshis=?, htlc_minimum_msat=?, to_self_delay=?, max_accepted_htlcs=? WHERE id=?;", - .query = "UPDATE channel_configs SET dust_limit_satoshis=?, max_htlc_value_in_flight_msat=?, channel_reserve_satoshis=?, htlc_minimum_msat=?, to_self_delay=?, max_accepted_htlcs=? WHERE id=?;", - .placeholders = 7, - .readonly = false, - }, - { - .name = "SELECT id, dust_limit_satoshis, max_htlc_value_in_flight_msat, channel_reserve_satoshis, htlc_minimum_msat, to_self_delay, max_accepted_htlcs FROM channel_configs WHERE id= ? ;", - .query = "SELECT id, dust_limit_satoshis, max_htlc_value_in_flight_msat, channel_reserve_satoshis, htlc_minimum_msat, to_self_delay, max_accepted_htlcs FROM channel_configs WHERE id= ? ;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?", - .query = "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?", - .query = "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?", - .placeholders = 43, - .readonly = false, - }, - { - .name = "UPDATE channels SET fundingkey_remote=?, revocation_basepoint_remote=?, payment_basepoint_remote=?, htlc_basepoint_remote=?, delayed_payment_basepoint_remote=?, per_commit_remote=?, old_per_commit_remote=?, channel_config_remote=?, future_per_commitment_point=? WHERE id=?", - .query = "UPDATE channels SET fundingkey_remote=?, revocation_basepoint_remote=?, payment_basepoint_remote=?, htlc_basepoint_remote=?, delayed_payment_basepoint_remote=?, per_commit_remote=?, old_per_commit_remote=?, channel_config_remote=?, future_per_commitment_point=? WHERE id=?", - .placeholders = 10, - .readonly = false, - }, - { - .name = "DELETE FROM channel_feerates WHERE channel_id=?", - .query = "DELETE FROM channel_feerates WHERE channel_id=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO channel_feerates VALUES(?, ?, ?)", - .query = "INSERT INTO channel_feerates VALUES(?, ?, ?)", - .placeholders = 3, - .readonly = false, - }, - { - .name = "DELETE FROM channel_blockheights WHERE channel_id=?", - .query = "DELETE FROM channel_blockheights WHERE channel_id=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO channel_blockheights VALUES(?, ?, ?)", - .query = "INSERT INTO channel_blockheights VALUES(?, ?, ?)", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE channels SET last_sent_commit=? WHERE id=?", - .query = "UPDATE channels SET last_sent_commit=? WHERE id=?", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);", - .placeholders = 6, - .readonly = false, - }, - { - .name = "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;", - .query = "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM peers WHERE node_id = ?", - .query = "SELECT id FROM peers WHERE node_id = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE peers SET address = ? WHERE id = ?", - .query = "UPDATE peers SET address = ? WHERE id = ?", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO peers (node_id, address) VALUES (?, ?);", - .query = "INSERT INTO peers (node_id, address) VALUES (?, ?);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 8, - .readonly = false, - }, - { - .name = "DELETE FROM channel_htlcs WHERE channel_id=?", - .query = "DELETE FROM channel_htlcs WHERE channel_id=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM htlc_sigs WHERE channelid=?", - .query = "DELETE FROM htlc_sigs WHERE channelid=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM channeltxs WHERE channel_id=?", - .query = "DELETE FROM channeltxs WHERE channel_id=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM channel_funding_inflights WHERE channel_id=?", - .query = "DELETE FROM channel_funding_inflights WHERE channel_id=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)", - .query = "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?", - .query = "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT * FROM channels WHERE peer_id = ?;", - .query = "SELECT * FROM channels WHERE peer_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM peers WHERE id=?", - .query = "DELETE FROM peers WHERE id=?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?", - .query = "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, shared_secret, routing_onion, received_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, shared_secret, routing_onion, received_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 11, - .readonly = false, - }, - { - .name = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, malformed_onion, partid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?);", - .query = "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, malformed_onion, partid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?);", - .placeholders = 11, - .readonly = false, - }, - { - .name = "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?", - .query = "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?", - .placeholders = 7, - .readonly = false, - }, - { - .name = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, we_filled FROM channel_htlcs WHERE direction= ? AND channel_id= ? AND hstate != ?", - .query = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, we_filled FROM channel_htlcs WHERE direction= ? AND channel_id= ? AND hstate != ?", - .placeholders = 3, - .readonly = true, - }, - { - .name = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, partid, localfailmsg FROM channel_htlcs WHERE direction = ? AND channel_id = ? AND hstate != ?", - .query = "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, partid, localfailmsg FROM channel_htlcs WHERE direction = ? AND channel_id = ? AND hstate != ?", - .placeholders = 3, - .readonly = true, - }, - { - .name = "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;", - .query = "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;", - .query = "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;", - .query = "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;", - .placeholders = 2, - .readonly = true, - }, - { - .name = "INSERT INTO payments ( status, payment_hash, destination, msatoshi, timestamp, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, total_msat, partid, local_offer_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO payments ( status, payment_hash, destination, msatoshi, timestamp, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, total_msat, partid, local_offer_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 14, - .readonly = false, - }, - { - .name = "DELETE FROM payments WHERE payment_hash = ? AND partid = ?", - .query = "DELETE FROM payments WHERE payment_hash = ? AND partid = ?", - .placeholders = 2, - .readonly = false, - }, - { - .name = "DELETE FROM payments WHERE payment_hash = ?", - .query = "DELETE FROM payments WHERE payment_hash = ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = ? AND partid = ?", - .query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = ? AND partid = ?", - .placeholders = 2, - .readonly = true, - }, - { - .name = "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?", - .query = "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?", - .query = "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;", - .query = "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;", - .query = "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;", - .placeholders = 2, - .readonly = true, - }, - { - .name = "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;", - .query = "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;", - .placeholders = 11, - .readonly = false, - }, - { - .name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE (payment_hash = ? OR ?) AND (status = ? OR ?) ORDER BY id;", - .query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE (payment_hash = ? OR ?) AND (status = ? OR ?) ORDER BY id;", - .placeholders = 4, - .readonly = true, - }, - { - .name = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE local_offer_id = ?;", - .query = "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE local_offer_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM htlc_sigs WHERE channelid = ?", - .query = "DELETE FROM htlc_sigs WHERE channelid = ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)", - .query = "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT blobval FROM vars WHERE name='genesis_hash'", - .query = "SELECT blobval FROM vars WHERE name='genesis_hash'", - .placeholders = 0, - .readonly = true, - }, - { - .name = "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);", - .query = "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT txid, outnum FROM utxoset WHERE spendheight < ?", - .query = "SELECT txid, outnum FROM utxoset WHERE spendheight < ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM utxoset WHERE spendheight < ?", - .query = "DELETE FROM utxoset WHERE spendheight < ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);", - .query = "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);", - .placeholders = 3, - .readonly = false, - }, - { - .name = "DELETE FROM blocks WHERE hash = ?", - .query = "DELETE FROM blocks WHERE hash = ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT * FROM blocks WHERE height >= ?;", - .query = "SELECT * FROM blocks WHERE height >= ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM blocks WHERE height > ?", - .query = "DELETE FROM blocks WHERE height > ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?", - .query = "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?", - .placeholders = 4, - .readonly = false, - }, - { - .name = "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?", - .query = "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);", - .placeholders = 7, - .readonly = false, - }, - { - .name = "SELECT height FROM blocks WHERE height = ?", - .query = "SELECT height FROM blocks WHERE height = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL", - .query = "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL", - .placeholders = 3, - .readonly = true, - }, - { - .name = "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?", - .query = "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT blockheight, txindex, outnum FROM utxoset WHERE blockheight = ?", - .query = "SELECT blockheight, txindex, outnum FROM utxoset WHERE blockheight = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT blockheight FROM transactions WHERE id=?", - .query = "SELECT blockheight FROM transactions WHERE id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);", - .query = "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);", - .placeholders = 4, - .readonly = false, - }, - { - .name = "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?", - .query = "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;", - .query = "INSERT OR IGNORE INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?);", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT type, channel_id FROM transactions WHERE id=?", - .query = "SELECT type, channel_id FROM transactions WHERE id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?", - .query = "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT type FROM transactions WHERE id=?", - .query = "SELECT type FROM transactions WHERE id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT rawtx FROM transactions WHERE id=?", - .query = "SELECT rawtx FROM transactions WHERE id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT blockheight, txindex FROM transactions WHERE id=?", - .query = "SELECT blockheight, txindex FROM transactions WHERE id=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT id FROM transactions WHERE blockheight=?", - .query = "SELECT id FROM transactions WHERE blockheight=?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);", - .query = "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;", - .query = "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT c.type, c.blockheight, t.rawtx, c.input_num, c.blockheight - t.blockheight + 1 AS depth, t.id as txid FROM channeltxs c JOIN transactions t ON t.id = c.transaction_id WHERE c.channel_id = ? ORDER BY c.id ASC;", - .query = "SELECT c.type, c.blockheight, t.rawtx, c.input_num, c.blockheight - t.blockheight + 1 AS depth, t.id as txid FROM channeltxs c JOIN transactions t ON t.id = c.transaction_id WHERE c.channel_id = ? ORDER BY c.id ASC;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?", - .query = "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?", - .placeholders = 6, - .readonly = false, - }, - { - .name = "INSERT INTO forwarded_payments ( in_htlc_id, out_htlc_id, in_channel_scid, out_channel_scid, in_msatoshi, out_msatoshi, state, received_time, resolved_time, failcode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .query = "INSERT INTO forwarded_payments ( in_htlc_id, out_htlc_id, in_channel_scid, out_channel_scid, in_msatoshi, out_msatoshi, state, received_time, resolved_time, failcode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);", - .placeholders = 10, - .readonly = false, - }, - { - .name = "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;", - .query = "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS INTEGER)FROM forwarded_payments WHERE state = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT f.state, in_msatoshi, out_msatoshi, hin.payment_hash as payment_hash, in_channel_scid, out_channel_scid, f.received_time, f.resolved_time, f.failcode FROM forwarded_payments f LEFT JOIN channel_htlcs hin ON (f.in_htlc_id = hin.id) WHERE (1 = ? OR f.state = ?) AND (1 = ? OR f.in_channel_scid = ?) AND (1 = ? OR f.out_channel_scid = ?)", - .query = "SELECT f.state, in_msatoshi, out_msatoshi, hin.payment_hash as payment_hash, in_channel_scid, out_channel_scid, f.received_time, f.resolved_time, f.failcode FROM forwarded_payments f LEFT JOIN channel_htlcs hin ON (f.in_htlc_id = hin.id) WHERE (1 = ? OR f.state = ?) AND (1 = ? OR f.in_channel_scid = ?) AND (1 = ? OR f.out_channel_scid = ?)", - .placeholders = 6, - .readonly = true, - }, - { - .name = "SELECT t.id, t.rawtx, t.blockheight, t.txindex, t.type as txtype, c2.short_channel_id as txchan, a.location, a.idx as ann_idx, a.type as annotation_type, c.short_channel_id FROM transactions t LEFT JOIN transaction_annotations a ON (a.txid = t.id) LEFT JOIN channels c ON (a.channel = c.id) LEFT JOIN channels c2 ON (t.channel_id = c2.id) ORDER BY t.blockheight, t.txindex ASC", - .query = "SELECT t.id, t.rawtx, t.blockheight, t.txindex, t.type as txtype, c2.short_channel_id as txchan, a.location, a.idx as ann_idx, a.type as annotation_type, c.short_channel_id FROM transactions t LEFT JOIN transaction_annotations a ON (a.txid = t.id) LEFT JOIN channels c ON (a.channel = c.id) LEFT JOIN channels c2 ON (t.channel_id = c2.id) ORDER BY t.blockheight, t.txindex ASC", - .placeholders = 0, - .readonly = true, - }, - { - .name = "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);", - .query = "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);", - .placeholders = 5, - .readonly = false, - }, - { - .name = "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?", - .query = "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?", - .placeholders = 1, - .readonly = true, - }, - { - .name = "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?", - .query = "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?", - .placeholders = 2, - .readonly = false, - }, - { - .name = "SELECT 1 FROM offers WHERE offer_id = ?;", - .query = "SELECT 1 FROM offers WHERE offer_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);", - .query = "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);", - .placeholders = 4, - .readonly = false, - }, - { - .name = "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;", - .query = "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT offer_id FROM offers;", - .query = "SELECT offer_id FROM offers;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "UPDATE offers SET status=? WHERE offer_id = ?;", - .query = "UPDATE offers SET status=? WHERE offer_id = ?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;", - .query = "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;", - .placeholders = 3, - .readonly = false, - }, - { - .name = "SELECT status FROM offers WHERE offer_id = ?;", - .query = "SELECT status FROM offers WHERE offer_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "UPDATE datastore SET data=?, generation=generation+1 WHERE key=?;", - .query = "UPDATE datastore SET data=?, generation=generation+1 WHERE key=?;", - .placeholders = 2, - .readonly = false, - }, - { - .name = "INSERT INTO datastore VALUES (?, ?, 0);", - .query = "INSERT INTO datastore VALUES (?, ?, 0);", - .placeholders = 2, - .readonly = false, - }, - { - .name = "DELETE FROM datastore WHERE key = ?", - .query = "DELETE FROM datastore WHERE key = ?", - .placeholders = 1, - .readonly = false, - }, - { - .name = "SELECT key, data, generation FROM datastore WHERE key >= ? ORDER BY key;", - .query = "SELECT key, data, generation FROM datastore WHERE key >= ? ORDER BY key;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "SELECT key, data, generation FROM datastore ORDER BY key;", - .query = "SELECT key, data, generation FROM datastore ORDER BY key;", - .placeholders = 0, - .readonly = true, - }, - { - .name = "SELECT name FROM sqlite_master WHERE type='table';", - .query = "SELECT name FROM sqlite_master WHERE type='table';", - .placeholders = 0, - .readonly = true, - }, - { - .name = "not a valid SQL statement", - .query = "not a valid SQL statement", - .placeholders = 0, - .readonly = false, - }, - { - .name = "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;", - .query = "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;", - .placeholders = 1, - .readonly = true, - }, - { - .name = "INSERT INTO channels (id) VALUES (1);", - .query = "INSERT INTO channels (id) VALUES (1);", - .placeholders = 0, - .readonly = false, - }, -}; - -#define DB_SQLITE3_QUERY_COUNT 342 - -#endif /* HAVE_SQLITE3 */ - -#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ - -// SHA256STAMP:e9f02b73335ca1a0b3308fba7c97f45bafe6fd773c42a915f07fb9679ca51b81 diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po deleted file mode 100644 index 58e11ce40..000000000 --- a/wallet/statements_gettextgen.po +++ /dev/null @@ -1,1368 +0,0 @@ -#: wallet/db.c:65 -msgid "CREATE TABLE version (version INTEGER)" -msgstr "" - -#: wallet/db.c:66 -msgid "INSERT INTO version VALUES (1)" -msgstr "" - -#: wallet/db.c:67 -msgid "CREATE TABLE outputs ( prev_out_tx BLOB, prev_out_index INTEGER, value BIGINT, type INTEGER, status INTEGER, keyindex INTEGER, PRIMARY KEY (prev_out_tx, prev_out_index));" -msgstr "" - -#: wallet/db.c:76 -msgid "CREATE TABLE vars ( name VARCHAR(32), val VARCHAR(255), PRIMARY KEY (name));" -msgstr "" - -#: wallet/db.c:82 -msgid "CREATE TABLE shachains ( id BIGSERIAL, min_index BIGINT, num_valid BIGINT, PRIMARY KEY (id));" -msgstr "" - -#: wallet/db.c:89 -msgid "CREATE TABLE shachain_known ( shachain_id BIGINT REFERENCES shachains(id) ON DELETE CASCADE, pos INTEGER, idx BIGINT, hash BLOB, PRIMARY KEY (shachain_id, pos));" -msgstr "" - -#: wallet/db.c:97 -msgid "CREATE TABLE peers ( id BIGSERIAL, node_id BLOB UNIQUE, address TEXT, PRIMARY KEY (id));" -msgstr "" - -#: wallet/db.c:104 -msgid "CREATE TABLE channels ( id BIGSERIAL, peer_id BIGINT REFERENCES peers(id) ON DELETE CASCADE, short_channel_id TEXT, channel_config_local BIGINT, channel_config_remote BIGINT, state INTEGER, funder INTEGER, channel_flags INTEGER, minimum_depth INTEGER, next_index_local BIGINT, next_index_remote BIGINT, next_htlc_id BIGINT, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_satoshi BIGINT, funding_locked_remote INTEGER, push_msatoshi BIGINT, msatoshi_local BIGINT, fundingkey_remote BLOB, revocation_basepoint_remote BLOB, payment_basepoint_remote BLOB, htlc_basepoint_remote BLOB, delayed_payment_basepoint_remote BLOB, per_commit_remote BLOB, old_per_commit_remote BLOB, local_feerate_per_kw INTEGER, remote_feerate_per_kw INTEGER, shachain_remote_id BIGINT, shutdown_scriptpubkey_remote BLOB, shutdown_keyidx_local BIGINT, last_sent_commit_state BIGINT, last_sent_commit_id INTEGER, last_tx BLOB, last_sig BLOB, closing_fee_received INTEGER, closing_sig_received BLOB, PRIMARY KEY (id));" -msgstr "" - -#: wallet/db.c:146 -msgid "CREATE TABLE channel_configs ( id BIGSERIAL, dust_limit_satoshis BIGINT, max_htlc_value_in_flight_msat BIGINT, channel_reserve_satoshis BIGINT, htlc_minimum_msat BIGINT, to_self_delay INTEGER, max_accepted_htlcs INTEGER, PRIMARY KEY (id));" -msgstr "" - -#: wallet/db.c:157 -msgid "CREATE TABLE channel_htlcs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, channel_htlc_id BIGINT, direction INTEGER, origin_htlc BIGINT, msatoshi BIGINT, cltv_expiry INTEGER, payment_hash BLOB, payment_key BLOB, routing_onion BLOB, failuremsg BLOB, malformed_onion INTEGER, hstate INTEGER, shared_secret BLOB, PRIMARY KEY (id), UNIQUE (channel_id, channel_htlc_id, direction));" -msgstr "" - -#: wallet/db.c:177 -msgid "CREATE TABLE invoices ( id BIGSERIAL, state INTEGER, msatoshi BIGINT, payment_hash BLOB, payment_key BLOB, label TEXT, PRIMARY KEY (id), UNIQUE (label), UNIQUE (payment_hash));" -msgstr "" - -#: wallet/db.c:189 -msgid "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, direction INTEGER, destination BLOB, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));" -msgstr "" - -#: wallet/db.c:202 -msgid "ALTER TABLE invoices ADD expiry_time BIGINT;" -msgstr "" - -#: wallet/db.c:203 -msgid "UPDATE invoices SET expiry_time=9223372036854775807;" -msgstr "" - -#: wallet/db.c:205 -msgid "ALTER TABLE invoices ADD pay_index BIGINT;" -msgstr "" - -#: wallet/db.c:206 -msgid "CREATE UNIQUE INDEX invoices_pay_index ON invoices(pay_index);" -msgstr "" - -#: wallet/db.c:208 -msgid "UPDATE invoices SET pay_index=id WHERE state=1;" -msgstr "" - -#: wallet/db.c:211 -msgid "INSERT INTO vars(name, val) VALUES('next_pay_index', COALESCE((SELECT MAX(pay_index) FROM invoices WHERE state=1), 0) + 1 );" -msgstr "" - -#: wallet/db.c:220 -msgid "ALTER TABLE channels ADD first_blocknum BIGINT;" -msgstr "" - -#: wallet/db.c:221 -msgid "UPDATE channels SET first_blocknum=1 WHERE short_channel_id IS NOT NULL;" -msgstr "" - -#: wallet/db.c:223 -msgid "ALTER TABLE outputs ADD COLUMN channel_id BIGINT;" -msgstr "" - -#: wallet/db.c:224 -msgid "ALTER TABLE outputs ADD COLUMN peer_id BLOB;" -msgstr "" - -#: wallet/db.c:225 -msgid "ALTER TABLE outputs ADD COLUMN commitment_point BLOB;" -msgstr "" - -#: wallet/db.c:226 -msgid "ALTER TABLE invoices ADD COLUMN msatoshi_received BIGINT;" -msgstr "" - -#: wallet/db.c:228 -msgid "UPDATE invoices SET msatoshi_received=0 WHERE state=1;" -msgstr "" - -#: wallet/db.c:229 -msgid "ALTER TABLE channels ADD COLUMN last_was_revoke INTEGER;" -msgstr "" - -#: wallet/db.c:233 wallet/db.c:526 -msgid "ALTER TABLE payments RENAME TO temp_payments;" -msgstr "" - -#: wallet/db.c:234 -msgid "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash));" -msgstr "" - -#: wallet/db.c:245 -msgid "INSERT INTO payments SELECT id, timestamp, status, payment_hash, destination, msatoshi FROM temp_payments WHERE direction=1;" -msgstr "" - -#: wallet/db.c:248 wallet/db.c:601 -msgid "DROP TABLE temp_payments;" -msgstr "" - -#: wallet/db.c:250 -msgid "ALTER TABLE payments ADD COLUMN payment_preimage BLOB;" -msgstr "" - -#: wallet/db.c:252 -msgid "ALTER TABLE payments ADD COLUMN path_secrets BLOB;" -msgstr "" - -#: wallet/db.c:255 -msgid "ALTER TABLE invoices ADD paid_timestamp BIGINT;" -msgstr "" - -#: wallet/db.c:256 -msgid "UPDATE invoices SET paid_timestamp = CURRENT_TIMESTAMP() WHERE state = 1;" -msgstr "" - -#: wallet/db.c:264 -msgid "ALTER TABLE payments ADD COLUMN route_nodes BLOB;" -msgstr "" - -#: wallet/db.c:265 -msgid "ALTER TABLE payments ADD COLUMN route_channels BLOB;" -msgstr "" - -#: wallet/db.c:266 -msgid "CREATE TABLE htlc_sigs (channelid INTEGER REFERENCES channels(id) ON DELETE CASCADE, signature BLOB);" -msgstr "" - -#: wallet/db.c:269 -msgid "CREATE INDEX channel_idx ON htlc_sigs (channelid)" -msgstr "" - -#: wallet/db.c:271 -msgid "DELETE FROM channels WHERE state=1" -msgstr "" - -#: wallet/db.c:273 -msgid "CREATE TABLE db_upgrades (upgrade_from INTEGER, lightning_version TEXT);" -msgstr "" - -#: wallet/db.c:277 wallet/db.c:467 -msgid "DELETE FROM peers WHERE id NOT IN (SELECT peer_id FROM channels);" -msgstr "" - -#: wallet/db.c:281 -msgid "UPDATE channels SET STATE = 8 WHERE state > 8;" -msgstr "" - -#: wallet/db.c:283 -msgid "ALTER TABLE invoices ADD bolt11 TEXT;" -msgstr "" - -#: wallet/db.c:287 -msgid "CREATE TABLE blocks (height INT, hash BLOB, prev_hash BLOB, UNIQUE(height));" -msgstr "" - -#: wallet/db.c:297 -msgid "ALTER TABLE outputs ADD COLUMN confirmation_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;" -msgstr "" - -#: wallet/db.c:300 -msgid "ALTER TABLE outputs ADD COLUMN spend_height INTEGER REFERENCES blocks(height) ON DELETE SET NULL;" -msgstr "" - -#: wallet/db.c:304 -msgid "CREATE INDEX output_height_idx ON outputs (confirmation_height, spend_height);" -msgstr "" - -#: wallet/db.c:307 -msgid "CREATE TABLE utxoset ( txid BLOB, outnum INT, blockheight INT REFERENCES blocks(height) ON DELETE CASCADE, spendheight INT REFERENCES blocks(height) ON DELETE SET NULL, txindex INT, scriptpubkey BLOB, satoshis BIGINT, PRIMARY KEY(txid, outnum));" -msgstr "" - -#: wallet/db.c:317 -msgid "CREATE INDEX short_channel_id ON utxoset (blockheight, txindex, outnum)" -msgstr "" - -#: wallet/db.c:322 -msgid "CREATE INDEX utxoset_spend ON utxoset (spendheight)" -msgstr "" - -#: wallet/db.c:324 -msgid "UPDATE channels SET shutdown_keyidx_local=0 WHERE shutdown_keyidx_local = -1;" -msgstr "" - -#: wallet/db.c:330 -msgid "ALTER TABLE payments ADD failonionreply BLOB;" -msgstr "" - -#: wallet/db.c:332 -msgid "ALTER TABLE payments ADD faildestperm INTEGER;" -msgstr "" - -#: wallet/db.c:334 -msgid "ALTER TABLE payments ADD failindex INTEGER;" -msgstr "" - -#: wallet/db.c:336 -msgid "ALTER TABLE payments ADD failcode INTEGER;" -msgstr "" - -#: wallet/db.c:337 -msgid "ALTER TABLE payments ADD failnode BLOB;" -msgstr "" - -#: wallet/db.c:338 -msgid "ALTER TABLE payments ADD failchannel TEXT;" -msgstr "" - -#: wallet/db.c:340 -msgid "ALTER TABLE payments ADD failupdate BLOB;" -msgstr "" - -#: wallet/db.c:344 -msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE status <> 0;" -msgstr "" - -#: wallet/db.c:351 -msgid "ALTER TABLE channels ADD in_payments_offered INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:352 -msgid "ALTER TABLE channels ADD in_payments_fulfilled INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:353 -msgid "ALTER TABLE channels ADD in_msatoshi_offered BIGINT DEFAULT 0;" -msgstr "" - -#: wallet/db.c:354 -msgid "ALTER TABLE channels ADD in_msatoshi_fulfilled BIGINT DEFAULT 0;" -msgstr "" - -#: wallet/db.c:355 -msgid "ALTER TABLE channels ADD out_payments_offered INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:356 -msgid "ALTER TABLE channels ADD out_payments_fulfilled INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:357 -msgid "ALTER TABLE channels ADD out_msatoshi_offered BIGINT DEFAULT 0;" -msgstr "" - -#: wallet/db.c:358 -msgid "ALTER TABLE channels ADD out_msatoshi_fulfilled BIGINT DEFAULT 0;" -msgstr "" - -#: wallet/db.c:359 -msgid "UPDATE channels SET in_payments_offered = 0, in_payments_fulfilled = 0 , in_msatoshi_offered = 0, in_msatoshi_fulfilled = 0 , out_payments_offered = 0, out_payments_fulfilled = 0 , out_msatoshi_offered = 0, out_msatoshi_fulfilled = 0 ;" -msgstr "" - -#: wallet/db.c:368 -msgid "ALTER TABLE payments ADD msatoshi_sent BIGINT;" -msgstr "" - -#: wallet/db.c:369 -msgid "UPDATE payments SET msatoshi_sent = msatoshi;" -msgstr "" - -#: wallet/db.c:371 -msgid "DELETE FROM utxoset WHERE blockheight IN ( SELECT DISTINCT(blockheight) FROM utxoset LEFT OUTER JOIN blocks on (blockheight = blocks.height) WHERE blocks.hash IS NULL);" -msgstr "" - -#: wallet/db.c:379 -msgid "ALTER TABLE channels ADD min_possible_feerate INTEGER;" -msgstr "" - -#: wallet/db.c:380 -msgid "ALTER TABLE channels ADD max_possible_feerate INTEGER;" -msgstr "" - -#: wallet/db.c:383 -msgid "UPDATE channels SET min_possible_feerate=0, max_possible_feerate=250000;" -msgstr "" - -#: wallet/db.c:387 -msgid "ALTER TABLE channels ADD msatoshi_to_us_min BIGINT;" -msgstr "" - -#: wallet/db.c:388 -msgid "ALTER TABLE channels ADD msatoshi_to_us_max BIGINT;" -msgstr "" - -#: wallet/db.c:389 -msgid "UPDATE channels SET msatoshi_to_us_min = msatoshi_local , msatoshi_to_us_max = msatoshi_local ;" -msgstr "" - -#: wallet/db.c:398 -msgid "CREATE TABLE transactions ( id BLOB, blockheight INTEGER REFERENCES blocks(height) ON DELETE SET NULL, txindex INTEGER, rawtx BLOB, PRIMARY KEY (id));" -msgstr "" - -#: wallet/db.c:407 -msgid "ALTER TABLE payments ADD faildetail TEXT;" -msgstr "" - -#: wallet/db.c:408 -msgid "UPDATE payments SET faildetail = 'unspecified payment failure reason' WHERE status = 2;" -msgstr "" - -#: wallet/db.c:413 -msgid "CREATE TABLE channeltxs ( id BIGSERIAL, channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, type INTEGER, transaction_id BLOB REFERENCES transactions(id) ON DELETE CASCADE, input_num INTEGER, blockheight INTEGER REFERENCES blocks(height) ON DELETE CASCADE, PRIMARY KEY(id));" -msgstr "" - -#: wallet/db.c:429 -msgid "DELETE FROM blocks WHERE height > (SELECT MIN(first_blocknum) FROM channels);" -msgstr "" - -#: wallet/db.c:435 -msgid "INSERT INTO blocks (height) VALUES ((SELECT MIN(first_blocknum) FROM channels)) ON CONFLICT(height) DO NOTHING;" -msgstr "" - -#: wallet/db.c:439 -msgid "DELETE FROM blocks WHERE height IS NULL;" -msgstr "" - -#: wallet/db.c:441 -msgid "ALTER TABLE invoices ADD description TEXT;" -msgstr "" - -#: wallet/db.c:443 -msgid "ALTER TABLE payments ADD description TEXT;" -msgstr "" - -#: wallet/db.c:445 -msgid "ALTER TABLE channels ADD future_per_commitment_point BLOB;" -msgstr "" - -#: wallet/db.c:447 -msgid "ALTER TABLE channels ADD last_sent_commit BLOB;" -msgstr "" - -#: wallet/db.c:452 -msgid "CREATE TABLE forwarded_payments ( in_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, out_htlc_id BIGINT REFERENCES channel_htlcs(id) ON DELETE SET NULL, in_channel_scid BIGINT, out_channel_scid BIGINT, in_msatoshi BIGINT, out_msatoshi BIGINT, state INTEGER, UNIQUE(in_htlc_id, out_htlc_id));" -msgstr "" - -#: wallet/db.c:464 -msgid "ALTER TABLE payments ADD faildirection INTEGER;" -msgstr "" - -#: wallet/db.c:469 -msgid "ALTER TABLE outputs ADD scriptpubkey BLOB;" -msgstr "" - -#: wallet/db.c:471 -msgid "ALTER TABLE payments ADD bolt11 TEXT;" -msgstr "" - -#: wallet/db.c:473 -msgid "ALTER TABLE channels ADD feerate_base INTEGER;" -msgstr "" - -#: wallet/db.c:474 -msgid "ALTER TABLE channels ADD feerate_ppm INTEGER;" -msgstr "" - -#: wallet/db.c:476 -msgid "ALTER TABLE channel_htlcs ADD received_time BIGINT" -msgstr "" - -#: wallet/db.c:477 -msgid "ALTER TABLE forwarded_payments ADD received_time BIGINT" -msgstr "" - -#: wallet/db.c:478 -msgid "ALTER TABLE forwarded_payments ADD resolved_time BIGINT" -msgstr "" - -#: wallet/db.c:479 -msgid "ALTER TABLE channels ADD remote_upfront_shutdown_script BLOB;" -msgstr "" - -#: wallet/db.c:482 -msgid "ALTER TABLE forwarded_payments ADD failcode INTEGER;" -msgstr "" - -#: wallet/db.c:484 -msgid "ALTER TABLE channels ADD remote_ann_node_sig BLOB;" -msgstr "" - -#: wallet/db.c:485 -msgid "ALTER TABLE channels ADD remote_ann_bitcoin_sig BLOB;" -msgstr "" - -#: wallet/db.c:487 -msgid "ALTER TABLE transactions ADD type BIGINT;" -msgstr "" - -#: wallet/db.c:492 -msgid "ALTER TABLE transactions ADD channel_id BIGINT;" -msgstr "" - -#: wallet/db.c:494 -msgid "UPDATE channels SET short_channel_id = REPLACE(short_channel_id, ':', 'x') WHERE short_channel_id IS NOT NULL;" -msgstr "" - -#: wallet/db.c:497 -msgid "UPDATE payments SET failchannel = REPLACE(failchannel, ':', 'x') WHERE failchannel IS NOT NULL;" -msgstr "" - -#: wallet/db.c:500 -msgid "ALTER TABLE channels ADD COLUMN option_static_remotekey INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:502 -msgid "ALTER TABLE vars ADD COLUMN intval INTEGER" -msgstr "" - -#: wallet/db.c:503 -msgid "ALTER TABLE vars ADD COLUMN blobval BLOB" -msgstr "" - -#: wallet/db.c:504 -msgid "UPDATE vars SET intval = CAST(val AS INTEGER) WHERE name IN ('bip32_max_index', 'last_processed_block', 'next_pay_index')" -msgstr "" - -#: wallet/db.c:505 -msgid "UPDATE vars SET blobval = CAST(val AS BLOB) WHERE name = 'genesis_hash'" -msgstr "" - -#: wallet/db.c:506 -msgid "CREATE TABLE transaction_annotations ( txid BLOB, idx INTEGER, location INTEGER, type INTEGER, channel BIGINT REFERENCES channels(id), UNIQUE(txid, idx));" -msgstr "" - -#: wallet/db.c:518 -msgid "ALTER TABLE channels ADD shutdown_scriptpubkey_local BLOB;" -msgstr "" - -#: wallet/db.c:521 -msgid "UPDATE forwarded_payments SET received_time=0 WHERE received_time IS NULL;" -msgstr "" - -#: wallet/db.c:523 -msgid "ALTER TABLE invoices ADD COLUMN features BLOB DEFAULT '';" -msgstr "" - -#: wallet/db.c:527 -msgid "CREATE TABLE payments ( id BIGSERIAL, timestamp INTEGER, status INTEGER, payment_hash BLOB, destination BLOB, msatoshi BIGINT, payment_preimage BLOB, path_secrets BLOB, route_nodes BLOB, route_channels BLOB, failonionreply BLOB, faildestperm INTEGER, failindex INTEGER, failcode INTEGER, failnode BLOB, failchannel TEXT, failupdate BLOB, msatoshi_sent BIGINT, faildetail TEXT, description TEXT, faildirection INTEGER, bolt11 TEXT, total_msat BIGINT, partid BIGINT, PRIMARY KEY (id), UNIQUE (payment_hash, partid))" -msgstr "" - -#: wallet/db.c:554 -msgid "INSERT INTO payments (id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11)SELECT id, timestamp, status, payment_hash, destination, msatoshi, payment_preimage, path_secrets, route_nodes, route_channels, failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, msatoshi_sent, faildetail, description, faildirection, bolt11 FROM temp_payments;" -msgstr "" - -#: wallet/db.c:599 -msgid "UPDATE payments SET total_msat = msatoshi;" -msgstr "" - -#: wallet/db.c:600 -msgid "UPDATE payments SET partid = 0;" -msgstr "" - -#: wallet/db.c:602 -msgid "ALTER TABLE channel_htlcs ADD partid BIGINT;" -msgstr "" - -#: wallet/db.c:603 -msgid "UPDATE channel_htlcs SET partid = 0;" -msgstr "" - -#: wallet/db.c:604 -msgid "CREATE TABLE channel_feerates ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, feerate_per_kw INTEGER, UNIQUE (channel_id, hstate));" -msgstr "" - -#: wallet/db.c:615 -msgid "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 4, local_feerate_per_kw FROM channels WHERE funder = 0;" -msgstr "" - -#: wallet/db.c:619 -msgid "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 1, remote_feerate_per_kw FROM channels WHERE funder = 0 and local_feerate_per_kw != remote_feerate_per_kw;" -msgstr "" - -#: wallet/db.c:624 -msgid "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 14, remote_feerate_per_kw FROM channels WHERE funder = 1;" -msgstr "" - -#: wallet/db.c:628 -msgid "INSERT INTO channel_feerates(channel_id, hstate, feerate_per_kw) SELECT id, 11, local_feerate_per_kw FROM channels WHERE funder = 1 and local_feerate_per_kw != remote_feerate_per_kw;" -msgstr "" - -#: wallet/db.c:632 -msgid "INSERT INTO vars (name, intval) VALUES ('data_version', 0);" -msgstr "" - -#: wallet/db.c:635 -msgid "ALTER TABLE channel_htlcs ADD localfailmsg BLOB;" -msgstr "" - -#: wallet/db.c:636 -msgid "UPDATE channel_htlcs SET localfailmsg=decode('2002', 'hex') WHERE malformed_onion != 0 AND direction = 1;" -msgstr "" - -#: wallet/db.c:637 -msgid "ALTER TABLE channels ADD our_funding_satoshi BIGINT DEFAULT 0;" -msgstr "" - -#: wallet/db.c:638 -msgid "CREATE TABLE penalty_bases ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, commitnum BIGINT, txid BLOB, outnum INTEGER, amount BIGINT, PRIMARY KEY (channel_id, commitnum));" -msgstr "" - -#: wallet/db.c:648 -msgid "ALTER TABLE channel_htlcs ADD we_filled INTEGER;" -msgstr "" - -#: wallet/db.c:650 -msgid "INSERT INTO vars (name, intval) VALUES ('coin_moves_count', 0);" -msgstr "" - -#: wallet/db.c:652 -msgid "ALTER TABLE outputs ADD reserved_til INTEGER DEFAULT NULL;" -msgstr "" - -#: wallet/db.c:655 -msgid "ALTER TABLE channels ADD COLUMN option_anchor_outputs INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:658 -msgid "ALTER TABLE outputs ADD option_anchor_outputs INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:660 -msgid "ALTER TABLE channels ADD full_channel_id BLOB DEFAULT NULL;" -msgstr "" - -#: wallet/db.c:661 -msgid "ALTER TABLE channels ADD funding_psbt BLOB DEFAULT NULL;" -msgstr "" - -#: wallet/db.c:663 -msgid "ALTER TABLE channels ADD closer INTEGER DEFAULT 2;" -msgstr "" - -#: wallet/db.c:664 -msgid "ALTER TABLE channels ADD state_change_reason INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:665 -msgid "CREATE TABLE channel_state_changes ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, timestamp BIGINT, old_state INTEGER, new_state INTEGER, cause INTEGER, message TEXT);" -msgstr "" - -#: wallet/db.c:673 -msgid "CREATE TABLE offers ( offer_id BLOB, bolt12 TEXT, label TEXT, status INTEGER, PRIMARY KEY (offer_id));" -msgstr "" - -#: wallet/db.c:681 -msgid "ALTER TABLE invoices ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);" -msgstr "" - -#: wallet/db.c:683 -msgid "ALTER TABLE payments ADD COLUMN local_offer_id BLOB DEFAULT NULL REFERENCES offers(offer_id);" -msgstr "" - -#: wallet/db.c:684 -msgid "ALTER TABLE channels ADD funding_tx_remote_sigs_received INTEGER DEFAULT 0;" -msgstr "" - -#: wallet/db.c:687 -msgid "CREATE INDEX forwarded_payments_out_htlc_id ON forwarded_payments (out_htlc_id);" -msgstr "" - -#: wallet/db.c:689 -msgid "UPDATE channel_htlcs SET malformed_onion = 0 WHERE malformed_onion IS NULL" -msgstr "" - -#: wallet/db.c:691 -msgid "CREATE INDEX forwarded_payments_state ON forwarded_payments (state)" -msgstr "" - -#: wallet/db.c:692 -msgid "CREATE TABLE channel_funding_inflights ( channel_id BIGSERIAL REFERENCES channels(id) ON DELETE CASCADE, funding_tx_id BLOB, funding_tx_outnum INTEGER, funding_feerate INTEGER, funding_satoshi BIGINT, our_funding_satoshi BIGINT, funding_psbt BLOB, last_tx BLOB, last_sig BLOB, funding_tx_remote_sigs_received INTEGER, PRIMARY KEY (channel_id, funding_tx_id));" -msgstr "" - -#: wallet/db.c:706 -msgid "ALTER TABLE channels ADD revocation_basepoint_local BLOB" -msgstr "" - -#: wallet/db.c:707 -msgid "ALTER TABLE channels ADD payment_basepoint_local BLOB" -msgstr "" - -#: wallet/db.c:708 -msgid "ALTER TABLE channels ADD htlc_basepoint_local BLOB" -msgstr "" - -#: wallet/db.c:709 -msgid "ALTER TABLE channels ADD delayed_payment_basepoint_local BLOB" -msgstr "" - -#: wallet/db.c:710 -msgid "ALTER TABLE channels ADD funding_pubkey_local BLOB" -msgstr "" - -#: wallet/db.c:713 -msgid "ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL" -msgstr "" - -#: wallet/db.c:714 -msgid "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL" -msgstr "" - -#: wallet/db.c:717 -msgid "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0" -msgstr "" - -#: wallet/db.c:719 -msgid "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0" -msgstr "" - -#: wallet/db.c:722 -msgid "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0" -msgstr "" - -#: wallet/db.c:727 -msgid "ALTER TABLE channel_funding_inflights ADD lease_commit_sig BLOB DEFAULT NULL" -msgstr "" - -#: wallet/db.c:728 -msgid "ALTER TABLE channel_funding_inflights ADD lease_chan_max_msat BIGINT DEFAULT NULL" -msgstr "" - -#: wallet/db.c:729 -msgid "ALTER TABLE channel_funding_inflights ADD lease_chan_max_ppt INTEGER DEFAULT NULL" -msgstr "" - -#: wallet/db.c:730 -msgid "ALTER TABLE channel_funding_inflights ADD lease_expiry INTEGER DEFAULT 0" -msgstr "" - -#: wallet/db.c:731 -msgid "ALTER TABLE channel_funding_inflights ADD lease_blockheight_start INTEGER DEFAULT 0" -msgstr "" - -#: wallet/db.c:732 -msgid "ALTER TABLE channels ADD lease_commit_sig BLOB DEFAULT NULL" -msgstr "" - -#: wallet/db.c:733 -msgid "ALTER TABLE channels ADD lease_chan_max_msat INTEGER DEFAULT NULL" -msgstr "" - -#: wallet/db.c:734 -msgid "ALTER TABLE channels ADD lease_chan_max_ppt INTEGER DEFAULT NULL" -msgstr "" - -#: wallet/db.c:735 -msgid "ALTER TABLE channels ADD lease_expiry INTEGER DEFAULT 0" -msgstr "" - -#: wallet/db.c:736 -msgid "CREATE TABLE channel_blockheights ( channel_id BIGINT REFERENCES channels(id) ON DELETE CASCADE, hstate INTEGER, blockheight INTEGER, UNIQUE (channel_id, hstate));" -msgstr "" - -#: wallet/db.c:743 -msgid "ALTER TABLE outputs ADD csv_lock INTEGER DEFAULT 1;" -msgstr "" - -#: wallet/db.c:744 -msgid "CREATE TABLE datastore ( key BLOB, data BLOB, generation BIGINT, PRIMARY KEY (key));" -msgstr "" - -#: wallet/db.c:751 -msgid "CREATE INDEX channel_state_changes_channel_id ON channel_state_changes (channel_id);" -msgstr "" - -#: wallet/db.c:979 -msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?" -msgstr "" - -#: wallet/db.c:1079 -msgid "SELECT version FROM version LIMIT 1" -msgstr "" - -#: wallet/db.c:1141 -msgid "UPDATE version SET version=?;" -msgstr "" - -#: wallet/db.c:1149 -msgid "INSERT INTO db_upgrades VALUES (?, ?);" -msgstr "" - -#: wallet/db.c:1161 -msgid "SELECT intval FROM vars WHERE name = 'data_version'" -msgstr "" - -#: wallet/db.c:1188 -msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1" -msgstr "" - -#: wallet/db.c:1204 -msgid "UPDATE vars SET intval=? WHERE name=?;" -msgstr "" - -#: wallet/db.c:1213 -msgid "INSERT INTO vars (name, intval) VALUES (?, ?);" -msgstr "" - -#: wallet/db.c:1227 -msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;" -msgstr "" - -#: wallet/db.c:1248 -msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;" -msgstr "" - -#: wallet/db.c:1264 -msgid "SELECT type, keyindex, prev_out_tx, prev_out_index, channel_id, peer_id, commitment_point FROM outputs WHERE scriptpubkey IS NULL;" -msgstr "" - -#: wallet/db.c:1326 -msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?" -msgstr "" - -#: wallet/db.c:1351 -msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;" -msgstr "" - -#: wallet/db.c:1370 -msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;" -msgstr "" - -#: wallet/db.c:1391 -msgid "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)" -msgstr "" - -#: wallet/db.c:1424 -msgid "UPDATE channels SET revocation_basepoint_local = ?, payment_basepoint_local = ?, htlc_basepoint_local = ?, delayed_payment_basepoint_local = ?, funding_pubkey_local = ? WHERE id = ?;" -msgstr "" - -#: wallet/db.c:1457 -msgid "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 4, 0 FROM channels WHERE funder = 0;" -msgstr "" - -#: wallet/db.c:1465 -msgid "INSERT INTO channel_blockheights (channel_id, hstate, blockheight) SELECT id, 14, 0 FROM channels WHERE funder = 1;" -msgstr "" - -#: wallet/db.c:1477 -msgid "SELECT c.id, p.node_id, c.fundingkey_remote, inflight.last_tx, inflight.last_sig, inflight.funding_satoshi, inflight.funding_tx_id FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id LEFT OUTER JOIN channel_funding_inflights inflight ON c.id = inflight.channel_id WHERE inflight.last_tx IS NOT NULL;" -msgstr "" - -#: wallet/db.c:1544 -msgid "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;" -msgstr "" - -#: wallet/db.c:1568 -msgid "SELECT c.id, p.node_id, c.last_tx, c.funding_satoshi, c.fundingkey_remote, c.last_sig FROM channels c LEFT OUTER JOIN peers p ON p.id = c.peer_id;" -msgstr "" - -#: wallet/db.c:1635 -msgid "UPDATE channels SET last_tx = ? WHERE id = ?;" -msgstr "" - -#: wallet/invoices.c:126 -msgid "UPDATE invoices SET state = ? WHERE state = ? AND expiry_time <= ?;" -msgstr "" - -#: wallet/invoices.c:174 -msgid "SELECT id FROM invoices WHERE state = ? AND expiry_time <= ?" -msgstr "" - -#: wallet/invoices.c:213 -msgid "SELECT MIN(expiry_time) FROM invoices WHERE state = ?;" -msgstr "" - -#: wallet/invoices.c:280 -msgid "INSERT INTO invoices ( payment_hash, payment_key, state , msatoshi, label, expiry_time , pay_index, msatoshi_received , paid_timestamp, bolt11, description, features, local_offer_id) VALUES ( ?, ?, ? , ?, ?, ? , NULL, NULL , NULL, ?, ?, ?, ?);" -msgstr "" - -#: wallet/invoices.c:335 -msgid "SELECT id FROM invoices WHERE label = ?;" -msgstr "" - -#: wallet/invoices.c:357 -msgid "SELECT id FROM invoices WHERE payment_hash = ?;" -msgstr "" - -#: wallet/invoices.c:378 -msgid "SELECT id FROM invoices WHERE payment_hash = ? AND state = ?;" -msgstr "" - -#: wallet/invoices.c:402 -msgid "DELETE FROM invoices WHERE id=?;" -msgstr "" - -#: wallet/invoices.c:422 -msgid "DELETE FROM invoices WHERE state = ? AND expiry_time <= ?;" -msgstr "" - -#: wallet/invoices.c:436 -msgid "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices ORDER BY id;" -msgstr "" - -#: wallet/invoices.c:494 -msgid "SELECT state FROM invoices WHERE id = ?;" -msgstr "" - -#: wallet/invoices.c:512 -msgid "SELECT local_offer_id FROM invoices WHERE id = ?;" -msgstr "" - -#: wallet/invoices.c:544 -msgid "UPDATE invoices SET state=? , pay_index=? , msatoshi_received=? , paid_timestamp=? WHERE id=?;" -msgstr "" - -#: wallet/invoices.c:603 -msgid "SELECT id FROM invoices WHERE pay_index IS NOT NULL AND pay_index > ? ORDER BY pay_index ASC LIMIT 1;" -msgstr "" - -#: wallet/invoices.c:652 -msgid "SELECT state, payment_key, payment_hash, label, msatoshi, expiry_time, pay_index, msatoshi_received, paid_timestamp, bolt11, description, features, local_offer_id FROM invoices WHERE id = ?;" -msgstr "" - -#: wallet/wallet.c:64 -msgid "SELECT txid, outnum FROM utxoset WHERE spendheight is NULL" -msgstr "" - -#: wallet/wallet.c:105 wallet/wallet.c:609 -msgid "SELECT * from outputs WHERE prev_out_tx=? AND prev_out_index=?" -msgstr "" - -#: wallet/wallet.c:119 -msgid "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:237 -msgid "UPDATE outputs SET status=? WHERE status=? AND prev_out_tx=? AND prev_out_index=?" -msgstr "" - -#: wallet/wallet.c:245 -msgid "UPDATE outputs SET status=? WHERE prev_out_tx=? AND prev_out_index=?" -msgstr "" - -#: wallet/wallet.c:264 -msgid "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs" -msgstr "" - -#: wallet/wallet.c:282 -msgid "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til , csv_lock FROM outputs WHERE status= ? " -msgstr "" - -#: wallet/wallet.c:321 -msgid "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE channel_id IS NOT NULL AND confirmation_height IS NULL" -msgstr "" - -#: wallet/wallet.c:359 -msgid "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, reserved_til, csv_lock FROM outputs WHERE prev_out_tx = ? AND prev_out_index = ?" -msgstr "" - -#: wallet/wallet.c:452 -msgid "UPDATE outputs SET status=?, reserved_til=? WHERE prev_out_tx=? AND prev_out_index=?" -msgstr "" - -#: wallet/wallet.c:555 -msgid "SELECT prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey , reserved_til, csv_lock FROM outputs WHERE status = ? OR (status = ? AND reserved_til <= ?)ORDER BY RANDOM();" -msgstr "" - -#: wallet/wallet.c:623 -msgid "INSERT INTO outputs ( prev_out_tx, prev_out_index, value, type, status, keyindex, channel_id, peer_id, commitment_point, option_anchor_outputs, confirmation_height, spend_height, scriptpubkey, csv_lock) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:730 -msgid "INSERT INTO shachains (min_index, num_valid) VALUES (?, 0);" -msgstr "" - -#: wallet/wallet.c:774 -msgid "UPDATE shachains SET num_valid=?, min_index=? WHERE id=?" -msgstr "" - -#: wallet/wallet.c:781 -msgid "UPDATE shachain_known SET idx=?, hash=? WHERE shachain_id=? AND pos=?" -msgstr "" - -#: wallet/wallet.c:793 -msgid "INSERT INTO shachain_known (shachain_id, pos, idx, hash) VALUES (?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:815 -msgid "SELECT min_index, num_valid FROM shachains WHERE id=?" -msgstr "" - -#: wallet/wallet.c:830 -msgid "SELECT idx, hash, pos FROM shachain_known WHERE shachain_id=?" -msgstr "" - -#: wallet/wallet.c:853 -msgid "SELECT id, node_id, address FROM peers WHERE id=?;" -msgstr "" - -#: wallet/wallet.c:886 -msgid "SELECT signature FROM htlc_sigs WHERE channelid = ?" -msgstr "" - -#: wallet/wallet.c:920 -msgid "SELECT remote_ann_node_sig, remote_ann_bitcoin_sig FROM channels WHERE id = ?" -msgstr "" - -#: wallet/wallet.c:964 -msgid "SELECT hstate, feerate_per_kw FROM channel_feerates WHERE channel_id = ?" -msgstr "" - -#: wallet/wallet.c:1000 -msgid "SELECT hstate, blockheight FROM channel_blockheights WHERE channel_id = ?" -msgstr "" - -#: wallet/wallet.c:1033 -msgid "INSERT INTO channel_funding_inflights ( channel_id, funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_expiry, lease_blockheight_start) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:1089 -msgid "UPDATE channel_funding_inflights SET funding_psbt=?, funding_tx_remote_sigs_received=? WHERE channel_id=? AND funding_tx_id=? AND funding_tx_outnum=?" -msgstr "" - -#: wallet/wallet.c:1112 -msgid "DELETE FROM channel_funding_inflights WHERE channel_id = ?" -msgstr "" - -#: wallet/wallet.c:1182 -msgid "SELECT funding_tx_id, funding_tx_outnum, funding_feerate, funding_satoshi, our_funding_satoshi, funding_psbt, last_tx, last_sig, funding_tx_remote_sigs_received, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt, lease_blockheight_start FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate" -msgstr "" - -#: wallet/wallet.c:1458 -msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;" -msgstr "" - -#: wallet/wallet.c:1475 -msgid "SELECT id, peer_id, short_channel_id, full_channel_id, channel_config_local, channel_config_remote, state, funder, channel_flags, minimum_depth, next_index_local, next_index_remote, next_htlc_id, funding_tx_id, funding_tx_outnum, funding_satoshi, our_funding_satoshi, funding_locked_remote, push_msatoshi, msatoshi_local, fundingkey_remote, revocation_basepoint_remote, payment_basepoint_remote, htlc_basepoint_remote, delayed_payment_basepoint_remote, per_commit_remote, old_per_commit_remote, local_feerate_per_kw, remote_feerate_per_kw, shachain_remote_id, shutdown_scriptpubkey_remote, shutdown_keyidx_local, last_sent_commit_state, last_sent_commit_id, last_tx, last_sig, last_was_revoke, first_blocknum, min_possible_feerate, max_possible_feerate, msatoshi_to_us_min, msatoshi_to_us_max, future_per_commitment_point, last_sent_commit, feerate_base, feerate_ppm, remote_upfront_shutdown_script, local_static_remotekey_start, remote_static_remotekey_start, option_anchor_outputs, shutdown_scriptpubkey_local, closer, state_change_reason, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local, shutdown_wrong_txid, shutdown_wrong_outnum, lease_expiry, lease_commit_sig, lease_chan_max_msat, lease_chan_max_ppt FROM channels WHERE state != ?;" -msgstr "" - -#: wallet/wallet.c:1587 -msgid "UPDATE channels SET in_payments_offered = COALESCE(in_payments_offered, 0) + 1 , in_msatoshi_offered = COALESCE(in_msatoshi_offered, 0) + ? WHERE id = ?;" -msgstr "" - -#: wallet/wallet.c:1593 -msgid "UPDATE channels SET in_payments_fulfilled = COALESCE(in_payments_fulfilled, 0) + 1 , in_msatoshi_fulfilled = COALESCE(in_msatoshi_fulfilled, 0) + ? WHERE id = ?;" -msgstr "" - -#: wallet/wallet.c:1599 -msgid "UPDATE channels SET out_payments_offered = COALESCE(out_payments_offered, 0) + 1 , out_msatoshi_offered = COALESCE(out_msatoshi_offered, 0) + ? WHERE id = ?;" -msgstr "" - -#: wallet/wallet.c:1605 -msgid "UPDATE channels SET out_payments_fulfilled = COALESCE(out_payments_fulfilled, 0) + 1 , out_msatoshi_fulfilled = COALESCE(out_msatoshi_fulfilled, 0) + ? WHERE id = ?;" -msgstr "" - -#: wallet/wallet.c:1650 -msgid "SELECT in_payments_offered, in_payments_fulfilled, in_msatoshi_offered, in_msatoshi_fulfilled, out_payments_offered, out_payments_fulfilled, out_msatoshi_offered, out_msatoshi_fulfilled FROM channels WHERE id = ?" -msgstr "" - -#: wallet/wallet.c:1679 -msgid "SELECT MIN(height), MAX(height) FROM blocks;" -msgstr "" - -#: wallet/wallet.c:1701 -msgid "INSERT INTO channel_configs DEFAULT VALUES;" -msgstr "" - -#: wallet/wallet.c:1713 -msgid "UPDATE channel_configs SET dust_limit_satoshis=?, max_htlc_value_in_flight_msat=?, channel_reserve_satoshis=?, htlc_minimum_msat=?, to_self_delay=?, max_accepted_htlcs=? WHERE id=?;" -msgstr "" - -#: wallet/wallet.c:1737 -msgid "SELECT id, dust_limit_satoshis, max_htlc_value_in_flight_msat, channel_reserve_satoshis, htlc_minimum_msat, to_self_delay, max_accepted_htlcs FROM channel_configs WHERE id= ? ;" -msgstr "" - -#: wallet/wallet.c:1771 -msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?" -msgstr "" - -#: wallet/wallet.c:1790 -msgid "UPDATE channels SET shachain_remote_id=?, short_channel_id=?, full_channel_id=?, state=?, funder=?, channel_flags=?, minimum_depth=?, next_index_local=?, next_index_remote=?, next_htlc_id=?, funding_tx_id=?, funding_tx_outnum=?, funding_satoshi=?, our_funding_satoshi=?, funding_locked_remote=?, push_msatoshi=?, msatoshi_local=?, shutdown_scriptpubkey_remote=?, shutdown_keyidx_local=?, channel_config_local=?, last_tx=?, last_sig=?, last_was_revoke=?, min_possible_feerate=?, max_possible_feerate=?, msatoshi_to_us_min=?, msatoshi_to_us_max=?, feerate_base=?, feerate_ppm=?, remote_upfront_shutdown_script=?, local_static_remotekey_start=?, remote_static_remotekey_start=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=?, lease_expiry=?, lease_commit_sig=?, lease_chan_max_msat=?, lease_chan_max_ppt=? WHERE id=?" -msgstr "" - -#: wallet/wallet.c:1899 -msgid "UPDATE channels SET fundingkey_remote=?, revocation_basepoint_remote=?, payment_basepoint_remote=?, htlc_basepoint_remote=?, delayed_payment_basepoint_remote=?, per_commit_remote=?, old_per_commit_remote=?, channel_config_remote=?, future_per_commitment_point=? WHERE id=?" -msgstr "" - -#: wallet/wallet.c:1926 -msgid "DELETE FROM channel_feerates WHERE channel_id=?" -msgstr "" - -#: wallet/wallet.c:1936 -msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)" -msgstr "" - -#: wallet/wallet.c:1945 -msgid "DELETE FROM channel_blockheights WHERE channel_id=?" -msgstr "" - -#: wallet/wallet.c:1955 -msgid "INSERT INTO channel_blockheights VALUES(?, ?, ?)" -msgstr "" - -#: wallet/wallet.c:1972 -msgid "UPDATE channels SET last_sent_commit=? WHERE id=?" -msgstr "" - -#: wallet/wallet.c:1995 -msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:2023 -msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;" -msgstr "" - -#: wallet/wallet.c:2052 -msgid "SELECT id FROM peers WHERE node_id = ?" -msgstr "" - -#: wallet/wallet.c:2064 -msgid "UPDATE peers SET address = ? WHERE id = ?" -msgstr "" - -#: wallet/wallet.c:2073 -msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);" -msgstr "" - -#: wallet/wallet.c:2094 -msgid "INSERT INTO channels ( peer_id, first_blocknum, id, revocation_basepoint_local, payment_basepoint_local, htlc_basepoint_local, delayed_payment_basepoint_local, funding_pubkey_local) VALUES (?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:2135 -msgid "DELETE FROM channel_htlcs WHERE channel_id=?" -msgstr "" - -#: wallet/wallet.c:2141 -msgid "DELETE FROM htlc_sigs WHERE channelid=?" -msgstr "" - -#: wallet/wallet.c:2147 -msgid "DELETE FROM channeltxs WHERE channel_id=?" -msgstr "" - -#: wallet/wallet.c:2154 -msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?" -msgstr "" - -#: wallet/wallet.c:2160 -msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)" -msgstr "" - -#: wallet/wallet.c:2170 -msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?" -msgstr "" - -#: wallet/wallet.c:2184 -msgid "SELECT * FROM channels WHERE peer_id = ?;" -msgstr "" - -#: wallet/wallet.c:2192 -msgid "DELETE FROM peers WHERE id=?" -msgstr "" - -#: wallet/wallet.c:2203 -msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?" -msgstr "" - -#: wallet/wallet.c:2306 -msgid "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, shared_secret, routing_onion, received_time) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:2359 -msgid "INSERT INTO channel_htlcs ( channel_id, channel_htlc_id, direction, origin_htlc, msatoshi, cltv_expiry, payment_hash, payment_key, hstate, routing_onion, malformed_onion, partid) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, 0, ?);" -msgstr "" - -#: wallet/wallet.c:2420 -msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?" -msgstr "" - -#: wallet/wallet.c:2637 -msgid "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, we_filled FROM channel_htlcs WHERE direction= ? AND channel_id= ? AND hstate != ?" -msgstr "" - -#: wallet/wallet.c:2684 -msgid "SELECT id, channel_htlc_id, msatoshi, cltv_expiry, hstate, payment_hash, payment_key, routing_onion, failuremsg, malformed_onion, origin_htlc, shared_secret, received_time, partid, localfailmsg FROM channel_htlcs WHERE direction = ? AND channel_id = ? AND hstate != ?" -msgstr "" - -#: wallet/wallet.c:2815 -msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;" -msgstr "" - -#: wallet/wallet.c:2849 -msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;" -msgstr "" - -#: wallet/wallet.c:2902 -msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;" -msgstr "" - -#: wallet/wallet.c:2920 -msgid "INSERT INTO payments ( status, payment_hash, destination, msatoshi, timestamp, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, total_msat, partid, local_offer_id) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:3009 -msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?" -msgstr "" - -#: wallet/wallet.c:3023 -msgid "DELETE FROM payments WHERE payment_hash = ?" -msgstr "" - -#: wallet/wallet.c:3124 -msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE payment_hash = ? AND partid = ?" -msgstr "" - -#: wallet/wallet.c:3174 -msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?" -msgstr "" - -#: wallet/wallet.c:3184 -msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?" -msgstr "" - -#: wallet/wallet.c:3194 -msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;" -msgstr "" - -#: wallet/wallet.c:3226 -msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;" -msgstr "" - -#: wallet/wallet.c:3293 -msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;" -msgstr "" - -#: wallet/wallet.c:3355 -msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE (payment_hash = ? OR ?) AND (status = ? OR ?) ORDER BY id;" -msgstr "" - -#: wallet/wallet.c:3418 -msgid "SELECT id, status, destination, msatoshi, payment_hash, timestamp, payment_preimage, path_secrets, route_nodes, route_channels, msatoshi_sent, description, bolt11, failonionreply, total_msat, partid, local_offer_id FROM payments WHERE local_offer_id = ?;" -msgstr "" - -#: wallet/wallet.c:3463 -msgid "DELETE FROM htlc_sigs WHERE channelid = ?" -msgstr "" - -#: wallet/wallet.c:3470 -msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)" -msgstr "" - -#: wallet/wallet.c:3482 -msgid "SELECT blobval FROM vars WHERE name='genesis_hash'" -msgstr "" - -#: wallet/wallet.c:3506 -msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);" -msgstr "" - -#: wallet/wallet.c:3524 -msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?" -msgstr "" - -#: wallet/wallet.c:3536 -msgid "DELETE FROM utxoset WHERE spendheight < ?" -msgstr "" - -#: wallet/wallet.c:3544 wallet/wallet.c:3658 -msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:3563 -msgid "DELETE FROM blocks WHERE hash = ?" -msgstr "" - -#: wallet/wallet.c:3569 -msgid "SELECT * FROM blocks WHERE height >= ?;" -msgstr "" - -#: wallet/wallet.c:3578 -msgid "DELETE FROM blocks WHERE height > ?" -msgstr "" - -#: wallet/wallet.c:3590 -msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?" -msgstr "" - -#: wallet/wallet.c:3608 -msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?" -msgstr "" - -#: wallet/wallet.c:3631 wallet/wallet.c:3669 -msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:3695 -msgid "SELECT height FROM blocks WHERE height = ?" -msgstr "" - -#: wallet/wallet.c:3708 -msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL" -msgstr "" - -#: wallet/wallet.c:3772 -msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?" -msgstr "" - -#: wallet/wallet.c:3789 -msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE blockheight = ?" -msgstr "" - -#: wallet/wallet.c:3806 wallet/wallet.c:3966 -msgid "SELECT blockheight FROM transactions WHERE id=?" -msgstr "" - -#: wallet/wallet.c:3816 -msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:3837 -msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?" -msgstr "" - -#: wallet/wallet.c:3854 -msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;" -msgstr "" - -#: wallet/wallet.c:3886 -msgid "SELECT type, channel_id FROM transactions WHERE id=?" -msgstr "" - -#: wallet/wallet.c:3902 -msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?" -msgstr "" - -#: wallet/wallet.c:3921 -msgid "SELECT type FROM transactions WHERE id=?" -msgstr "" - -#: wallet/wallet.c:3944 -msgid "SELECT rawtx FROM transactions WHERE id=?" -msgstr "" - -#: wallet/wallet.c:3990 -msgid "SELECT blockheight, txindex FROM transactions WHERE id=?" -msgstr "" - -#: wallet/wallet.c:4018 -msgid "SELECT id FROM transactions WHERE blockheight=?" -msgstr "" - -#: wallet/wallet.c:4037 -msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:4061 -msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;" -msgstr "" - -#: wallet/wallet.c:4082 -msgid "SELECT c.type, c.blockheight, t.rawtx, c.input_num, c.blockheight - t.blockheight + 1 AS depth, t.id as txid FROM channeltxs c JOIN transactions t ON t.id = c.transaction_id WHERE c.channel_id = ? ORDER BY c.id ASC;" -msgstr "" - -#: wallet/wallet.c:4127 -msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?" -msgstr "" - -#: wallet/wallet.c:4185 -msgid "INSERT INTO forwarded_payments ( in_htlc_id, out_htlc_id, in_channel_scid, out_channel_scid, in_msatoshi, out_msatoshi, state, received_time, resolved_time, failcode) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:4244 -msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;" -msgstr "" - -#: wallet/wallet.c:4293 -msgid "SELECT f.state, in_msatoshi, out_msatoshi, hin.payment_hash as payment_hash, in_channel_scid, out_channel_scid, f.received_time, f.resolved_time, f.failcode FROM forwarded_payments f LEFT JOIN channel_htlcs hin ON (f.in_htlc_id = hin.id) WHERE (1 = ? OR f.state = ?) AND (1 = ? OR f.in_channel_scid = ?) AND (1 = ? OR f.out_channel_scid = ?)" -msgstr "" - -#: wallet/wallet.c:4415 -msgid "SELECT t.id, t.rawtx, t.blockheight, t.txindex, t.type as txtype, c2.short_channel_id as txchan, a.location, a.idx as ann_idx, a.type as annotation_type, c.short_channel_id FROM transactions t LEFT JOIN transaction_annotations a ON (a.txid = t.id) LEFT JOIN channels c ON (a.channel = c.id) LEFT JOIN channels c2 ON (t.channel_id = c2.id) ORDER BY t.blockheight, t.txindex ASC" -msgstr "" - -#: wallet/wallet.c:4509 -msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:4534 -msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?" -msgstr "" - -#: wallet/wallet.c:4558 -msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?" -msgstr "" - -#: wallet/wallet.c:4576 -msgid "SELECT 1 FROM offers WHERE offer_id = ?;" -msgstr "" - -#: wallet/wallet.c:4589 -msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);" -msgstr "" - -#: wallet/wallet.c:4616 -msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;" -msgstr "" - -#: wallet/wallet.c:4644 -msgid "SELECT offer_id FROM offers;" -msgstr "" - -#: wallet/wallet.c:4670 -msgid "UPDATE offers SET status=? WHERE offer_id = ?;" -msgstr "" - -#: wallet/wallet.c:4681 -msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;" -msgstr "" - -#: wallet/wallet.c:4709 -msgid "SELECT status FROM offers WHERE offer_id = ?;" -msgstr "" - -#: wallet/wallet.c:4794 -msgid "UPDATE datastore SET data=?, generation=generation+1 WHERE key=?;" -msgstr "" - -#: wallet/wallet.c:4805 -msgid "INSERT INTO datastore VALUES (?, ?, 0);" -msgstr "" - -#: wallet/wallet.c:4816 -msgid "DELETE FROM datastore WHERE key = ?" -msgstr "" - -#: wallet/wallet.c:4833 -msgid "SELECT key, data, generation FROM datastore WHERE key >= ? ORDER BY key;" -msgstr "" - -#: wallet/wallet.c:4840 -msgid "SELECT key, data, generation FROM datastore ORDER BY key;" -msgstr "" - -#: wallet/test/run-db.c:124 -msgid "SELECT name FROM sqlite_master WHERE type='table';" -msgstr "" - -#: wallet/test/run-db.c:129 -msgid "not a valid SQL statement" -msgstr "" - -#: wallet/test/run-wallet.c:1499 -msgid "SELECT COUNT(1) FROM channel_funding_inflights WHERE channel_id = ?;" -msgstr "" - -#: wallet/test/run-wallet.c:1712 -msgid "INSERT INTO channels (id) VALUES (1);" -msgstr "" -# SHA256STAMP:7c2e1d0bc6f3d83dca5bcef21ccc62286e9ef1a8c020839480501cc4ed2cff97 diff --git a/wire/bolt12_wiregen.c b/wire/bolt12_wiregen.c deleted file mode 100644 index 42aa6ae88..000000000 --- a/wire/bolt12_wiregen.c +++ /dev/null @@ -1,1687 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - - - -/* SUBTYPE: BLINDED_PATH */ -void towire_blinded_path(u8 **p, const struct blinded_path *blinded_path) -{ - u16 num_hops = tal_count(blinded_path->path); - - towire_pubkey(p, &blinded_path->blinding); - towire_u16(p, num_hops); - for (size_t i = 0; i < num_hops; i++) - towire_onionmsg_path(p, blinded_path->path[i]); -} -struct blinded_path * -fromwire_blinded_path(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct blinded_path *blinded_path = tal(ctx, struct blinded_path); - u16 num_hops; - - fromwire_pubkey(cursor, plen, &blinded_path->blinding); - num_hops = fromwire_u16(cursor, plen); - blinded_path->path = num_hops ? tal_arr(blinded_path, struct onionmsg_path *, 0) : NULL; - for (size_t i = 0; i < num_hops; i++) { - struct onionmsg_path * tmp; - tmp = fromwire_onionmsg_path(blinded_path, cursor, plen); - tal_arr_expand(&blinded_path->path, tmp); - } - - return blinded_path; -} - -/* SUBTYPE: BLINDED_PAYINFO */ -void towire_blinded_payinfo(u8 **p, const struct blinded_payinfo *blinded_payinfo) -{ - u16 flen = tal_count(blinded_payinfo->features); - - towire_u32(p, blinded_payinfo->fee_base_msat); - towire_u32(p, blinded_payinfo->fee_proportional_millionths); - towire_u16(p, blinded_payinfo->cltv_expiry_delta); - towire_u16(p, flen); - towire_u8_array(p, blinded_payinfo->features, flen); -} -struct blinded_payinfo * -fromwire_blinded_payinfo(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct blinded_payinfo *blinded_payinfo = tal(ctx, struct blinded_payinfo); - u16 flen; - - blinded_payinfo->fee_base_msat = fromwire_u32(cursor, plen); - blinded_payinfo->fee_proportional_millionths = fromwire_u32(cursor, plen); - blinded_payinfo->cltv_expiry_delta = fromwire_u16(cursor, plen); - flen = fromwire_u16(cursor, plen); - blinded_payinfo->features = tal_arr(blinded_payinfo, u8, flen); -fromwire_u8_array(cursor, plen, blinded_payinfo->features, flen); - - return blinded_payinfo; -} - -/* SUBTYPE: FALLBACK_ADDRESS */ -void towire_fallback_address(u8 **p, const struct fallback_address *fallback_address) -{ - u16 len = tal_count(fallback_address->address); - - towire_u8(p, fallback_address->version); - towire_u16(p, len); - towire_u8_array(p, fallback_address->address, len); -} -struct fallback_address * -fromwire_fallback_address(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct fallback_address *fallback_address = tal(ctx, struct fallback_address); - u16 len; - - fallback_address->version = fromwire_u8(cursor, plen); - len = fromwire_u16(cursor, plen); - fallback_address->address = tal_arr(fallback_address, u8, len); -fromwire_u8_array(cursor, plen, fallback_address->address, len); - - return fallback_address; -} - - -struct tlv_offer *tlv_offer_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_offer *inst = talz(ctx, struct tlv_offer); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* OFFER MSG: chains */ -static u8 *towire_tlv_offer_chains(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->chains) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->chains); i++) - towire_bitcoin_blkid(&ptr, r->chains + i); - return ptr; -} -static void fromwire_tlv_offer_chains(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->chains = *plen ? tal_arr(r, struct bitcoin_blkid, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct bitcoin_blkid tmp; - fromwire_bitcoin_blkid(cursor, plen, &tmp); - tal_arr_expand(&r->chains, tmp); - } -} -/* OFFER MSG: currency */ -static u8 *towire_tlv_offer_currency(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->currency) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->currency, tal_count(r->currency)); - return ptr; -} -static void fromwire_tlv_offer_currency(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->currency = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->currency, *plen); -} -/* OFFER MSG: amount */ -static u8 *towire_tlv_offer_amount(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->amount) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->amount); - return ptr; -} -static void fromwire_tlv_offer_amount(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->amount = tal(r, u64); - -*r->amount = fromwire_tu64(cursor, plen); -} -/* OFFER MSG: description */ -static u8 *towire_tlv_offer_description(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->description) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->description, tal_count(r->description)); - return ptr; -} -static void fromwire_tlv_offer_description(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->description = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->description, *plen); -} -/* OFFER MSG: features */ -static u8 *towire_tlv_offer_features(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->features) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->features, tal_count(r->features)); - return ptr; -} -static void fromwire_tlv_offer_features(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->features = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->features, *plen); -} -/* OFFER MSG: absolute_expiry */ -static u8 *towire_tlv_offer_absolute_expiry(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->absolute_expiry) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->absolute_expiry); - return ptr; -} -static void fromwire_tlv_offer_absolute_expiry(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->absolute_expiry = tal(r, u64); - -*r->absolute_expiry = fromwire_tu64(cursor, plen); -} -/* OFFER MSG: paths */ -static u8 *towire_tlv_offer_paths(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->paths) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->paths); i++) - towire_blinded_path(&ptr, r->paths[i]); - return ptr; -} -static void fromwire_tlv_offer_paths(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct blinded_path * tmp; - tmp = fromwire_blinded_path(r, cursor, plen); - tal_arr_expand(&r->paths, tmp); - } -} -/* OFFER MSG: vendor */ -static u8 *towire_tlv_offer_vendor(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->vendor) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->vendor, tal_count(r->vendor)); - return ptr; -} -static void fromwire_tlv_offer_vendor(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->vendor = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->vendor, *plen); -} -/* OFFER MSG: quantity_min */ -static u8 *towire_tlv_offer_quantity_min(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->quantity_min) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->quantity_min); - return ptr; -} -static void fromwire_tlv_offer_quantity_min(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->quantity_min = tal(r, u64); - -*r->quantity_min = fromwire_tu64(cursor, plen); -} -/* OFFER MSG: quantity_max */ -static u8 *towire_tlv_offer_quantity_max(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->quantity_max) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->quantity_max); - return ptr; -} -static void fromwire_tlv_offer_quantity_max(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->quantity_max = tal(r, u64); - -*r->quantity_max = fromwire_tu64(cursor, plen); -} -/* OFFER MSG: recurrence */ -static u8 *towire_tlv_offer_recurrence(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->recurrence) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8(&ptr, r->recurrence->time_unit); - - towire_tu32(&ptr, r->recurrence->period); - return ptr; -} -static void fromwire_tlv_offer_recurrence(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->recurrence = tal(r, struct tlv_offer_recurrence); - r->recurrence->time_unit = fromwire_u8(cursor, plen); - r->recurrence->period = fromwire_tu32(cursor, plen); -} -/* OFFER MSG: recurrence_paywindow */ -static u8 *towire_tlv_offer_recurrence_paywindow(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->recurrence_paywindow) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u32(&ptr, r->recurrence_paywindow->seconds_before); - - towire_u8(&ptr, r->recurrence_paywindow->proportional_amount); - - towire_tu32(&ptr, r->recurrence_paywindow->seconds_after); - return ptr; -} -static void fromwire_tlv_offer_recurrence_paywindow(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->recurrence_paywindow = tal(r, struct tlv_offer_recurrence_paywindow); - r->recurrence_paywindow->seconds_before = fromwire_u32(cursor, plen); - r->recurrence_paywindow->proportional_amount = fromwire_u8(cursor, plen); - r->recurrence_paywindow->seconds_after = fromwire_tu32(cursor, plen); -} -/* OFFER MSG: recurrence_limit */ -static u8 *towire_tlv_offer_recurrence_limit(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->recurrence_limit) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->recurrence_limit); - return ptr; -} -static void fromwire_tlv_offer_recurrence_limit(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->recurrence_limit = tal(r, u32); - -*r->recurrence_limit = fromwire_tu32(cursor, plen); -} -/* OFFER MSG: recurrence_base */ -static u8 *towire_tlv_offer_recurrence_base(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->recurrence_base) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8(&ptr, r->recurrence_base->start_any_period); - - towire_tu64(&ptr, r->recurrence_base->basetime); - return ptr; -} -static void fromwire_tlv_offer_recurrence_base(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->recurrence_base = tal(r, struct tlv_offer_recurrence_base); - r->recurrence_base->start_any_period = fromwire_u8(cursor, plen); - r->recurrence_base->basetime = fromwire_tu64(cursor, plen); -} -/* OFFER MSG: node_id */ -static u8 *towire_tlv_offer_node_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->node_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey32(&ptr, r->node_id); - return ptr; -} -static void fromwire_tlv_offer_node_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->node_id = tal(r, struct pubkey32); - -fromwire_pubkey32(cursor, plen, &*r->node_id); -} -/* OFFER MSG: send_invoice */ -static u8 *towire_tlv_offer_send_invoice(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->send_invoice) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - return ptr; -} -static void fromwire_tlv_offer_send_invoice(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->send_invoice = tal(r, struct tlv_offer_send_invoice); -} -/* OFFER MSG: refund_for */ -static u8 *towire_tlv_offer_refund_for(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->refund_for) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->refund_for); - return ptr; -} -static void fromwire_tlv_offer_refund_for(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->refund_for = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->refund_for); -} -/* OFFER MSG: signature */ -static u8 *towire_tlv_offer_signature(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_offer *r = vrecord; - u8 *ptr; - - if (!r->signature) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_bip340sig(&ptr, r->signature); - return ptr; -} -static void fromwire_tlv_offer_signature(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_offer *r = vrecord; - - r->signature = tal(r, struct bip340sig); - -fromwire_bip340sig(cursor, plen, &*r->signature); -} - -static const struct tlv_record_type tlvs_offer[] = { - { 2, towire_tlv_offer_chains, fromwire_tlv_offer_chains }, - { 6, towire_tlv_offer_currency, fromwire_tlv_offer_currency }, - { 8, towire_tlv_offer_amount, fromwire_tlv_offer_amount }, - { 10, towire_tlv_offer_description, fromwire_tlv_offer_description }, - { 12, towire_tlv_offer_features, fromwire_tlv_offer_features }, - { 14, towire_tlv_offer_absolute_expiry, fromwire_tlv_offer_absolute_expiry }, - { 16, towire_tlv_offer_paths, fromwire_tlv_offer_paths }, - { 20, towire_tlv_offer_vendor, fromwire_tlv_offer_vendor }, - { 22, towire_tlv_offer_quantity_min, fromwire_tlv_offer_quantity_min }, - { 24, towire_tlv_offer_quantity_max, fromwire_tlv_offer_quantity_max }, - { 26, towire_tlv_offer_recurrence, fromwire_tlv_offer_recurrence }, - { 28, towire_tlv_offer_recurrence_base, fromwire_tlv_offer_recurrence_base }, - { 30, towire_tlv_offer_node_id, fromwire_tlv_offer_node_id }, - { 34, towire_tlv_offer_refund_for, fromwire_tlv_offer_refund_for }, - { 54, towire_tlv_offer_send_invoice, fromwire_tlv_offer_send_invoice }, - { 64, towire_tlv_offer_recurrence_paywindow, fromwire_tlv_offer_recurrence_paywindow }, - { 66, towire_tlv_offer_recurrence_limit, fromwire_tlv_offer_recurrence_limit }, - { 240, towire_tlv_offer_signature, fromwire_tlv_offer_signature }, -}; - -void towire_offer(u8 **pptr, const struct tlv_offer *record) -{ - towire_tlv(pptr, tlvs_offer, 18, record); -} - - -bool fromwire_offer(const u8 **cursor, size_t *max, struct tlv_offer *record) -{ - return fromwire_tlv(cursor, max, tlvs_offer, 18, record, &record->fields); -} - -bool offer_is_valid(const struct tlv_offer *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_invoice_request *tlv_invoice_request_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_invoice_request *inst = talz(ctx, struct tlv_invoice_request); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* INVOICE_REQUEST MSG: chains */ -static u8 *towire_tlv_invoice_request_chains(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->chains) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->chains); i++) - towire_bitcoin_blkid(&ptr, r->chains + i); - return ptr; -} -static void fromwire_tlv_invoice_request_chains(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->chains = *plen ? tal_arr(r, struct bitcoin_blkid, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct bitcoin_blkid tmp; - fromwire_bitcoin_blkid(cursor, plen, &tmp); - tal_arr_expand(&r->chains, tmp); - } -} -/* INVOICE_REQUEST MSG: offer_id */ -static u8 *towire_tlv_invoice_request_offer_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->offer_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->offer_id); - return ptr; -} -static void fromwire_tlv_invoice_request_offer_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->offer_id = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->offer_id); -} -/* INVOICE_REQUEST MSG: amount */ -static u8 *towire_tlv_invoice_request_amount(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->amount) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->amount); - return ptr; -} -static void fromwire_tlv_invoice_request_amount(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->amount = tal(r, u64); - -*r->amount = fromwire_tu64(cursor, plen); -} -/* INVOICE_REQUEST MSG: features */ -static u8 *towire_tlv_invoice_request_features(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->features) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->features, tal_count(r->features)); - return ptr; -} -static void fromwire_tlv_invoice_request_features(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->features = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->features, *plen); -} -/* INVOICE_REQUEST MSG: quantity */ -static u8 *towire_tlv_invoice_request_quantity(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->quantity) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->quantity); - return ptr; -} -static void fromwire_tlv_invoice_request_quantity(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->quantity = tal(r, u64); - -*r->quantity = fromwire_tu64(cursor, plen); -} -/* INVOICE_REQUEST MSG: recurrence_counter */ -static u8 *towire_tlv_invoice_request_recurrence_counter(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->recurrence_counter) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->recurrence_counter); - return ptr; -} -static void fromwire_tlv_invoice_request_recurrence_counter(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->recurrence_counter = tal(r, u32); - -*r->recurrence_counter = fromwire_tu32(cursor, plen); -} -/* INVOICE_REQUEST MSG: recurrence_start */ -static u8 *towire_tlv_invoice_request_recurrence_start(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->recurrence_start) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->recurrence_start); - return ptr; -} -static void fromwire_tlv_invoice_request_recurrence_start(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->recurrence_start = tal(r, u32); - -*r->recurrence_start = fromwire_tu32(cursor, plen); -} -/* INVOICE_REQUEST MSG: payer_key */ -static u8 *towire_tlv_invoice_request_payer_key(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->payer_key) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey32(&ptr, r->payer_key); - return ptr; -} -static void fromwire_tlv_invoice_request_payer_key(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->payer_key = tal(r, struct pubkey32); - -fromwire_pubkey32(cursor, plen, &*r->payer_key); -} -/* INVOICE_REQUEST MSG: payer_note */ -static u8 *towire_tlv_invoice_request_payer_note(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->payer_note) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->payer_note, tal_count(r->payer_note)); - return ptr; -} -static void fromwire_tlv_invoice_request_payer_note(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->payer_note = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->payer_note, *plen); -} -/* INVOICE_REQUEST MSG: payer_info */ -static u8 *towire_tlv_invoice_request_payer_info(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->payer_info) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->payer_info, tal_count(r->payer_info)); - return ptr; -} -static void fromwire_tlv_invoice_request_payer_info(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->payer_info = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->payer_info, *plen); -} -/* INVOICE_REQUEST MSG: replace_invoice */ -static u8 *towire_tlv_invoice_request_replace_invoice(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->replace_invoice) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->replace_invoice); - return ptr; -} -static void fromwire_tlv_invoice_request_replace_invoice(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->replace_invoice = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->replace_invoice); -} -/* INVOICE_REQUEST MSG: payer_signature */ -static u8 *towire_tlv_invoice_request_payer_signature(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_request *r = vrecord; - u8 *ptr; - - if (!r->payer_signature) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_bip340sig(&ptr, r->payer_signature); - return ptr; -} -static void fromwire_tlv_invoice_request_payer_signature(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_request *r = vrecord; - - r->payer_signature = tal(r, struct bip340sig); - -fromwire_bip340sig(cursor, plen, &*r->payer_signature); -} - -const struct tlv_record_type tlvs_invoice_request[] = { - { 2, towire_tlv_invoice_request_chains, fromwire_tlv_invoice_request_chains }, - { 4, towire_tlv_invoice_request_offer_id, fromwire_tlv_invoice_request_offer_id }, - { 8, towire_tlv_invoice_request_amount, fromwire_tlv_invoice_request_amount }, - { 12, towire_tlv_invoice_request_features, fromwire_tlv_invoice_request_features }, - { 32, towire_tlv_invoice_request_quantity, fromwire_tlv_invoice_request_quantity }, - { 36, towire_tlv_invoice_request_recurrence_counter, fromwire_tlv_invoice_request_recurrence_counter }, - { 38, towire_tlv_invoice_request_payer_key, fromwire_tlv_invoice_request_payer_key }, - { 39, towire_tlv_invoice_request_payer_note, fromwire_tlv_invoice_request_payer_note }, - { 50, towire_tlv_invoice_request_payer_info, fromwire_tlv_invoice_request_payer_info }, - { 56, towire_tlv_invoice_request_replace_invoice, fromwire_tlv_invoice_request_replace_invoice }, - { 68, towire_tlv_invoice_request_recurrence_start, fromwire_tlv_invoice_request_recurrence_start }, - { 240, towire_tlv_invoice_request_payer_signature, fromwire_tlv_invoice_request_payer_signature }, -}; - -void towire_invoice_request(u8 **pptr, const struct tlv_invoice_request *record) -{ - towire_tlv(pptr, tlvs_invoice_request, 12, record); -} - - -bool fromwire_invoice_request(const u8 **cursor, size_t *max, struct tlv_invoice_request *record) -{ - return fromwire_tlv(cursor, max, tlvs_invoice_request, 12, record, &record->fields); -} - -bool invoice_request_is_valid(const struct tlv_invoice_request *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_invoice *tlv_invoice_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_invoice *inst = talz(ctx, struct tlv_invoice); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* INVOICE MSG: chains */ -static u8 *towire_tlv_invoice_chains(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->chains) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->chains); i++) - towire_bitcoin_blkid(&ptr, r->chains + i); - return ptr; -} -static void fromwire_tlv_invoice_chains(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->chains = *plen ? tal_arr(r, struct bitcoin_blkid, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct bitcoin_blkid tmp; - fromwire_bitcoin_blkid(cursor, plen, &tmp); - tal_arr_expand(&r->chains, tmp); - } -} -/* INVOICE MSG: offer_id */ -static u8 *towire_tlv_invoice_offer_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->offer_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->offer_id); - return ptr; -} -static void fromwire_tlv_invoice_offer_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->offer_id = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->offer_id); -} -/* INVOICE MSG: amount */ -static u8 *towire_tlv_invoice_amount(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->amount) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->amount); - return ptr; -} -static void fromwire_tlv_invoice_amount(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->amount = tal(r, u64); - -*r->amount = fromwire_tu64(cursor, plen); -} -/* INVOICE MSG: description */ -static u8 *towire_tlv_invoice_description(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->description) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->description, tal_count(r->description)); - return ptr; -} -static void fromwire_tlv_invoice_description(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->description = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->description, *plen); -} -/* INVOICE MSG: features */ -static u8 *towire_tlv_invoice_features(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->features) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->features, tal_count(r->features)); - return ptr; -} -static void fromwire_tlv_invoice_features(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->features = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->features, *plen); -} -/* INVOICE MSG: paths */ -static u8 *towire_tlv_invoice_paths(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->paths) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->paths); i++) - towire_blinded_path(&ptr, r->paths[i]); - return ptr; -} -static void fromwire_tlv_invoice_paths(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->paths = *plen ? tal_arr(r, struct blinded_path *, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct blinded_path * tmp; - tmp = fromwire_blinded_path(r, cursor, plen); - tal_arr_expand(&r->paths, tmp); - } -} -/* INVOICE MSG: blindedpay */ -static u8 *towire_tlv_invoice_blindedpay(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->blindedpay) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->blindedpay); i++) - towire_blinded_payinfo(&ptr, r->blindedpay[i]); - return ptr; -} -static void fromwire_tlv_invoice_blindedpay(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->blindedpay = *plen ? tal_arr(r, struct blinded_payinfo *, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct blinded_payinfo * tmp; - tmp = fromwire_blinded_payinfo(r, cursor, plen); - tal_arr_expand(&r->blindedpay, tmp); - } -} -/* INVOICE MSG: blinded_capacities */ -static u8 *towire_tlv_invoice_blinded_capacities(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->blinded_capacities) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->blinded_capacities); i++) - towire_amount_msat(&ptr, r->blinded_capacities[i]); - return ptr; -} -static void fromwire_tlv_invoice_blinded_capacities(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->blinded_capacities = *plen ? tal_arr(r, struct amount_msat, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct amount_msat tmp; - tmp = fromwire_amount_msat(cursor, plen); - tal_arr_expand(&r->blinded_capacities, tmp); - } -} -/* INVOICE MSG: vendor */ -static u8 *towire_tlv_invoice_vendor(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->vendor) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->vendor, tal_count(r->vendor)); - return ptr; -} -static void fromwire_tlv_invoice_vendor(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->vendor = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->vendor, *plen); -} -/* INVOICE MSG: node_id */ -static u8 *towire_tlv_invoice_node_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->node_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey32(&ptr, r->node_id); - return ptr; -} -static void fromwire_tlv_invoice_node_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->node_id = tal(r, struct pubkey32); - -fromwire_pubkey32(cursor, plen, &*r->node_id); -} -/* INVOICE MSG: quantity */ -static u8 *towire_tlv_invoice_quantity(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->quantity) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->quantity); - return ptr; -} -static void fromwire_tlv_invoice_quantity(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->quantity = tal(r, u64); - -*r->quantity = fromwire_tu64(cursor, plen); -} -/* INVOICE MSG: refund_for */ -static u8 *towire_tlv_invoice_refund_for(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->refund_for) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->refund_for); - return ptr; -} -static void fromwire_tlv_invoice_refund_for(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->refund_for = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->refund_for); -} -/* INVOICE MSG: recurrence_counter */ -static u8 *towire_tlv_invoice_recurrence_counter(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->recurrence_counter) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->recurrence_counter); - return ptr; -} -static void fromwire_tlv_invoice_recurrence_counter(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->recurrence_counter = tal(r, u32); - -*r->recurrence_counter = fromwire_tu32(cursor, plen); -} -/* INVOICE MSG: send_invoice */ -static u8 *towire_tlv_invoice_send_invoice(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->send_invoice) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - return ptr; -} -static void fromwire_tlv_invoice_send_invoice(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->send_invoice = tal(r, struct tlv_invoice_send_invoice); -} -/* INVOICE MSG: recurrence_start */ -static u8 *towire_tlv_invoice_recurrence_start(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->recurrence_start) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->recurrence_start); - return ptr; -} -static void fromwire_tlv_invoice_recurrence_start(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->recurrence_start = tal(r, u32); - -*r->recurrence_start = fromwire_tu32(cursor, plen); -} -/* INVOICE MSG: recurrence_basetime */ -static u8 *towire_tlv_invoice_recurrence_basetime(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->recurrence_basetime) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->recurrence_basetime); - return ptr; -} -static void fromwire_tlv_invoice_recurrence_basetime(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->recurrence_basetime = tal(r, u64); - -*r->recurrence_basetime = fromwire_tu64(cursor, plen); -} -/* INVOICE MSG: payer_key */ -static u8 *towire_tlv_invoice_payer_key(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->payer_key) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey32(&ptr, r->payer_key); - return ptr; -} -static void fromwire_tlv_invoice_payer_key(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->payer_key = tal(r, struct pubkey32); - -fromwire_pubkey32(cursor, plen, &*r->payer_key); -} -/* INVOICE MSG: payer_note */ -static u8 *towire_tlv_invoice_payer_note(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->payer_note) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->payer_note, tal_count(r->payer_note)); - return ptr; -} -static void fromwire_tlv_invoice_payer_note(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->payer_note = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->payer_note, *plen); -} -/* INVOICE MSG: payer_info */ -static u8 *towire_tlv_invoice_payer_info(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->payer_info) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->payer_info, tal_count(r->payer_info)); - return ptr; -} -static void fromwire_tlv_invoice_payer_info(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->payer_info = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->payer_info, *plen); -} -/* INVOICE MSG: created_at */ -static u8 *towire_tlv_invoice_created_at(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->created_at) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->created_at); - return ptr; -} -static void fromwire_tlv_invoice_created_at(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->created_at = tal(r, u64); - -*r->created_at = fromwire_tu64(cursor, plen); -} -/* INVOICE MSG: payment_hash */ -static u8 *towire_tlv_invoice_payment_hash(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->payment_hash) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->payment_hash); - return ptr; -} -static void fromwire_tlv_invoice_payment_hash(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->payment_hash = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->payment_hash); -} -/* INVOICE MSG: relative_expiry */ -static u8 *towire_tlv_invoice_relative_expiry(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->relative_expiry) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->relative_expiry); - return ptr; -} -static void fromwire_tlv_invoice_relative_expiry(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->relative_expiry = tal(r, u32); - -*r->relative_expiry = fromwire_tu32(cursor, plen); -} -/* INVOICE MSG: cltv */ -static u8 *towire_tlv_invoice_cltv(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->cltv) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->cltv); - return ptr; -} -static void fromwire_tlv_invoice_cltv(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->cltv = tal(r, u32); - -*r->cltv = fromwire_tu32(cursor, plen); -} -/* INVOICE MSG: fallbacks */ -static u8 *towire_tlv_invoice_fallbacks(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->fallbacks) - return NULL; - - u8 num = tal_count(r->fallbacks->fallbacks); - - ptr = tal_arr(ctx, u8, 0); - - towire_u8(&ptr, num); - - for (size_t i = 0; i < num; i++) - towire_fallback_address(&ptr, r->fallbacks->fallbacks[i]); - return ptr; -} -static void fromwire_tlv_invoice_fallbacks(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - u8 num; - - r->fallbacks = tal(r, struct tlv_invoice_fallbacks); - num = fromwire_u8(cursor, plen); - r->fallbacks->fallbacks = num ? tal_arr(r->fallbacks, struct fallback_address *, 0) : NULL; - for (size_t i = 0; i < num; i++) { - struct fallback_address * tmp; - tmp = fromwire_fallback_address(r->fallbacks, cursor, plen); - tal_arr_expand(&r->fallbacks->fallbacks, tmp); - } -} -/* INVOICE MSG: refund_signature */ -static u8 *towire_tlv_invoice_refund_signature(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->refund_signature) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_bip340sig(&ptr, r->refund_signature); - return ptr; -} -static void fromwire_tlv_invoice_refund_signature(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->refund_signature = tal(r, struct bip340sig); - -fromwire_bip340sig(cursor, plen, &*r->refund_signature); -} -/* INVOICE MSG: replace_invoice */ -static u8 *towire_tlv_invoice_replace_invoice(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->replace_invoice) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_sha256(&ptr, r->replace_invoice); - return ptr; -} -static void fromwire_tlv_invoice_replace_invoice(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->replace_invoice = tal(r, struct sha256); - -fromwire_sha256(cursor, plen, &*r->replace_invoice); -} -/* INVOICE MSG: signature */ -static u8 *towire_tlv_invoice_signature(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice *r = vrecord; - u8 *ptr; - - if (!r->signature) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_bip340sig(&ptr, r->signature); - return ptr; -} -static void fromwire_tlv_invoice_signature(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice *r = vrecord; - - r->signature = tal(r, struct bip340sig); - -fromwire_bip340sig(cursor, plen, &*r->signature); -} - -static const struct tlv_record_type tlvs_invoice[] = { - { 2, towire_tlv_invoice_chains, fromwire_tlv_invoice_chains }, - { 4, towire_tlv_invoice_offer_id, fromwire_tlv_invoice_offer_id }, - { 8, towire_tlv_invoice_amount, fromwire_tlv_invoice_amount }, - { 10, towire_tlv_invoice_description, fromwire_tlv_invoice_description }, - { 12, towire_tlv_invoice_features, fromwire_tlv_invoice_features }, - { 16, towire_tlv_invoice_paths, fromwire_tlv_invoice_paths }, - { 18, towire_tlv_invoice_blindedpay, fromwire_tlv_invoice_blindedpay }, - { 19, towire_tlv_invoice_blinded_capacities, fromwire_tlv_invoice_blinded_capacities }, - { 20, towire_tlv_invoice_vendor, fromwire_tlv_invoice_vendor }, - { 30, towire_tlv_invoice_node_id, fromwire_tlv_invoice_node_id }, - { 32, towire_tlv_invoice_quantity, fromwire_tlv_invoice_quantity }, - { 34, towire_tlv_invoice_refund_for, fromwire_tlv_invoice_refund_for }, - { 36, towire_tlv_invoice_recurrence_counter, fromwire_tlv_invoice_recurrence_counter }, - { 38, towire_tlv_invoice_payer_key, fromwire_tlv_invoice_payer_key }, - { 39, towire_tlv_invoice_payer_note, fromwire_tlv_invoice_payer_note }, - { 40, towire_tlv_invoice_created_at, fromwire_tlv_invoice_created_at }, - { 42, towire_tlv_invoice_payment_hash, fromwire_tlv_invoice_payment_hash }, - { 44, towire_tlv_invoice_relative_expiry, fromwire_tlv_invoice_relative_expiry }, - { 46, towire_tlv_invoice_cltv, fromwire_tlv_invoice_cltv }, - { 48, towire_tlv_invoice_fallbacks, fromwire_tlv_invoice_fallbacks }, - { 50, towire_tlv_invoice_payer_info, fromwire_tlv_invoice_payer_info }, - { 52, towire_tlv_invoice_refund_signature, fromwire_tlv_invoice_refund_signature }, - { 54, towire_tlv_invoice_send_invoice, fromwire_tlv_invoice_send_invoice }, - { 56, towire_tlv_invoice_replace_invoice, fromwire_tlv_invoice_replace_invoice }, - { 64, towire_tlv_invoice_recurrence_basetime, fromwire_tlv_invoice_recurrence_basetime }, - { 68, towire_tlv_invoice_recurrence_start, fromwire_tlv_invoice_recurrence_start }, - { 240, towire_tlv_invoice_signature, fromwire_tlv_invoice_signature }, -}; - -void towire_invoice(u8 **pptr, const struct tlv_invoice *record) -{ - towire_tlv(pptr, tlvs_invoice, 27, record); -} - - -bool fromwire_invoice(const u8 **cursor, size_t *max, struct tlv_invoice *record) -{ - return fromwire_tlv(cursor, max, tlvs_invoice, 27, record, &record->fields); -} - -bool invoice_is_valid(const struct tlv_invoice *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_invoice_error *tlv_invoice_error_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_invoice_error *inst = talz(ctx, struct tlv_invoice_error); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* INVOICE_ERROR MSG: erroneous_field */ -static u8 *towire_tlv_invoice_error_erroneous_field(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_error *r = vrecord; - u8 *ptr; - - if (!r->erroneous_field) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->erroneous_field); - return ptr; -} -static void fromwire_tlv_invoice_error_erroneous_field(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_error *r = vrecord; - - r->erroneous_field = tal(r, u64); - -*r->erroneous_field = fromwire_tu64(cursor, plen); -} -/* INVOICE_ERROR MSG: suggested_value */ -static u8 *towire_tlv_invoice_error_suggested_value(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_error *r = vrecord; - u8 *ptr; - - if (!r->suggested_value) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->suggested_value, tal_count(r->suggested_value)); - return ptr; -} -static void fromwire_tlv_invoice_error_suggested_value(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_error *r = vrecord; - - r->suggested_value = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->suggested_value, *plen); -} -/* INVOICE_ERROR MSG: error */ -static u8 *towire_tlv_invoice_error_error(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_invoice_error *r = vrecord; - u8 *ptr; - - if (!r->error) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_utf8_array(&ptr, r->error, tal_count(r->error)); - return ptr; -} -static void fromwire_tlv_invoice_error_error(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_invoice_error *r = vrecord; - - r->error = tal_arr(r, utf8, *plen); -fromwire_utf8_array(cursor, plen, r->error, *plen); -} - -static const struct tlv_record_type tlvs_invoice_error[] = { - { 1, towire_tlv_invoice_error_erroneous_field, fromwire_tlv_invoice_error_erroneous_field }, - { 3, towire_tlv_invoice_error_suggested_value, fromwire_tlv_invoice_error_suggested_value }, - { 5, towire_tlv_invoice_error_error, fromwire_tlv_invoice_error_error }, -}; - -void towire_invoice_error(u8 **pptr, const struct tlv_invoice_error *record) -{ - towire_tlv(pptr, tlvs_invoice_error, 3, record); -} - - -bool fromwire_invoice_error(const u8 **cursor, size_t *max, struct tlv_invoice_error *record) -{ - return fromwire_tlv(cursor, max, tlvs_invoice_error, 3, record, &record->fields); -} - -bool invoice_error_is_valid(const struct tlv_invoice_error *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - -// SHA256STAMP:040e24ba1c955e65d81d184dac635c72fe8af10aa1795411d6ec2e7ed76c6224 diff --git a/wire/bolt12_wiregen.h b/wire/bolt12_wiregen.h deleted file mode 100644 index ddfe63e23..000000000 --- a/wire/bolt12_wiregen.h +++ /dev/null @@ -1,326 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_WIRE_BOLT12_WIREGEN_H -#define LIGHTNING_WIRE_BOLT12_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - - -struct blinded_path { - struct pubkey blinding; - struct onionmsg_path **path; -}; -struct blinded_payinfo { - u32 fee_base_msat; - u32 fee_proportional_millionths; - u16 cltv_expiry_delta; - u8 *features; -}; -struct fallback_address { - u8 version; - u8 *address; -}; -struct tlv_offer_recurrence { - u8 time_unit; - u32 period; -}; -struct tlv_offer_recurrence_paywindow { - u32 seconds_before; - u8 proportional_amount; - u32 seconds_after; -}; -struct tlv_offer_recurrence_base { - u8 start_any_period; - u64 basetime; -}; -struct tlv_offer_send_invoice { -}; -struct tlv_invoice_send_invoice { -}; -struct tlv_invoice_fallbacks { - struct fallback_address **fallbacks; -}; -struct tlv_offer { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct bitcoin_blkid *chains; - utf8 *currency; - u64 *amount; - utf8 *description; - u8 *features; - u64 *absolute_expiry; - struct blinded_path **paths; - utf8 *vendor; - u64 *quantity_min; - u64 *quantity_max; - struct tlv_offer_recurrence *recurrence; - struct tlv_offer_recurrence_paywindow *recurrence_paywindow; - u32 *recurrence_limit; - struct tlv_offer_recurrence_base *recurrence_base; - struct pubkey32 *node_id; - struct tlv_offer_send_invoice *send_invoice; - struct sha256 *refund_for; - struct bip340sig *signature; -}; -struct tlv_invoice_request { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct bitcoin_blkid *chains; - struct sha256 *offer_id; - u64 *amount; - u8 *features; - u64 *quantity; - u32 *recurrence_counter; - u32 *recurrence_start; - struct pubkey32 *payer_key; - utf8 *payer_note; - u8 *payer_info; - struct sha256 *replace_invoice; - struct bip340sig *payer_signature; -}; -struct tlv_invoice { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct bitcoin_blkid *chains; - struct sha256 *offer_id; - u64 *amount; - utf8 *description; - u8 *features; - struct blinded_path **paths; - struct blinded_payinfo **blindedpay; - struct amount_msat *blinded_capacities; - utf8 *vendor; - struct pubkey32 *node_id; - u64 *quantity; - struct sha256 *refund_for; - u32 *recurrence_counter; - struct tlv_invoice_send_invoice *send_invoice; - u32 *recurrence_start; - u64 *recurrence_basetime; - struct pubkey32 *payer_key; - utf8 *payer_note; - u8 *payer_info; - u64 *created_at; - struct sha256 *payment_hash; - u32 *relative_expiry; - u32 *cltv; - struct tlv_invoice_fallbacks *fallbacks; - struct bip340sig *refund_signature; - struct sha256 *replace_invoice; - struct bip340sig *signature; -}; -struct tlv_invoice_error { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u64 *erroneous_field; - u8 *suggested_value; - utf8 *error; -}; - -struct tlv_offer *tlv_offer_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the offer namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using offer_is_valid. - */ -bool fromwire_offer(const u8 **cursor, size_t *max, - struct tlv_offer * record); - -/** - * Serialize a TLV stream for the offer namespace. - * - * This function only considers known fields from the offer namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `offer_is_valid`. - */ -void towire_offer(u8 **pptr, const struct tlv_offer *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool offer_is_valid(const struct tlv_offer *record, - size_t *err_index); - -struct tlv_invoice_request *tlv_invoice_request_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the invoice_request namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using invoice_request_is_valid. - */ -bool fromwire_invoice_request(const u8 **cursor, size_t *max, - struct tlv_invoice_request * record); - -/** - * Serialize a TLV stream for the invoice_request namespace. - * - * This function only considers known fields from the invoice_request namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `invoice_request_is_valid`. - */ -void towire_invoice_request(u8 **pptr, const struct tlv_invoice_request *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool invoice_request_is_valid(const struct tlv_invoice_request *record, - size_t *err_index); - -#define TLVS_ARRAY_SIZE_invoice_request 12 -extern const struct tlv_record_type tlvs_invoice_request[]; - - - -/* Define an enum with the constants */ -enum invoice_request_types { - TLV_INVOICE_REQUEST_CHAINS = 2, - TLV_INVOICE_REQUEST_OFFER_ID = 4, - TLV_INVOICE_REQUEST_AMOUNT = 8, - TLV_INVOICE_REQUEST_FEATURES = 12, - TLV_INVOICE_REQUEST_QUANTITY = 32, - TLV_INVOICE_REQUEST_RECURRENCE_COUNTER = 36, - TLV_INVOICE_REQUEST_PAYER_KEY = 38, - TLV_INVOICE_REQUEST_PAYER_NOTE = 39, - TLV_INVOICE_REQUEST_PAYER_INFO = 50, - TLV_INVOICE_REQUEST_REPLACE_INVOICE = 56, - TLV_INVOICE_REQUEST_RECURRENCE_START = 68, - TLV_INVOICE_REQUEST_PAYER_SIGNATURE = 240, -}; - -struct tlv_invoice *tlv_invoice_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the invoice namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using invoice_is_valid. - */ -bool fromwire_invoice(const u8 **cursor, size_t *max, - struct tlv_invoice * record); - -/** - * Serialize a TLV stream for the invoice namespace. - * - * This function only considers known fields from the invoice namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `invoice_is_valid`. - */ -void towire_invoice(u8 **pptr, const struct tlv_invoice *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool invoice_is_valid(const struct tlv_invoice *record, - size_t *err_index); - -struct tlv_invoice_error *tlv_invoice_error_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the invoice_error namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using invoice_error_is_valid. - */ -bool fromwire_invoice_error(const u8 **cursor, size_t *max, - struct tlv_invoice_error * record); - -/** - * Serialize a TLV stream for the invoice_error namespace. - * - * This function only considers known fields from the invoice_error namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `invoice_error_is_valid`. - */ -void towire_invoice_error(u8 **pptr, const struct tlv_invoice_error *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool invoice_error_is_valid(const struct tlv_invoice_error *record, - size_t *err_index); - -/* SUBTYPE: BLINDED_PATH */ -void towire_blinded_path(u8 **p, const struct blinded_path *blinded_path); -struct blinded_path *fromwire_blinded_path(const tal_t *ctx, const u8 **cursor, size_t *plen); - -/* SUBTYPE: BLINDED_PAYINFO */ -void towire_blinded_payinfo(u8 **p, const struct blinded_payinfo *blinded_payinfo); -struct blinded_payinfo *fromwire_blinded_payinfo(const tal_t *ctx, const u8 **cursor, size_t *plen); - -/* SUBTYPE: FALLBACK_ADDRESS */ -void towire_fallback_address(u8 **p, const struct fallback_address *fallback_address); -struct fallback_address *fromwire_fallback_address(const tal_t *ctx, const u8 **cursor, size_t *plen); - - -#endif /* LIGHTNING_WIRE_BOLT12_WIREGEN_H */ -// SHA256STAMP:040e24ba1c955e65d81d184dac635c72fe8af10aa1795411d6ec2e7ed76c6224 diff --git a/wire/channel_type_printgen.c b/wire/channel_type_printgen.c deleted file mode 100644 index 3c0204cf5..000000000 --- a/wire/channel_type_printgen.c +++ /dev/null @@ -1,32 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ - -#include -#include -#include -#include -#include -#include -#include - - - -void printwire_channel_type(const char *fieldname, const u8 **cursor, size_t *plen) -{ - - 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; - } - -} - -// SHA256STAMP:8639d78101a54a07ac8be72bc33df8d2c974b52452786fb5a898f0a83a7837a7 diff --git a/wire/channel_type_printgen.h b/wire/channel_type_printgen.h deleted file mode 100644 index 91ed961ef..000000000 --- a/wire/channel_type_printgen.h +++ /dev/null @@ -1,16 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Template located at tools/gen/print_header_template */ -#ifndef LIGHTNING_WIRE_CHANNEL_TYPE_PRINTGEN_H -#define LIGHTNING_WIRE_CHANNEL_TYPE_PRINTGEN_H -#include -#include - -void printchannel_type_wire_message(const u8 *msg); - -void printchannel_type_wire_tlv_message(const char *tlv_name, const u8 *msg); - - -void printwire_channel_type(const char *fieldname, const u8 **cursor, size_t *plen); -#endif /* LIGHTNING_WIRE_CHANNEL_TYPE_PRINTGEN_H */ -// SHA256STAMP:8639d78101a54a07ac8be72bc33df8d2c974b52452786fb5a898f0a83a7837a7 diff --git a/wire/channel_type_wiregen.c b/wire/channel_type_wiregen.c deleted file mode 100644 index 184342b17..000000000 --- a/wire/channel_type_wiregen.c +++ /dev/null @@ -1,42 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - - - -/* SUBTYPE: CHANNEL_TYPE */ -/* Why not let our generator generate this too? */ -void towire_channel_type(u8 **p, const struct channel_type *channel_type) -{ - u16 len = tal_count(channel_type->features); - - towire_u16(p, len); - towire_u8_array(p, channel_type->features, len); -} -struct channel_type * -fromwire_channel_type(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct channel_type *channel_type = tal(ctx, struct channel_type); - u16 len; - - len = fromwire_u16(cursor, plen); - channel_type->features = tal_arr(channel_type, u8, len); -fromwire_u8_array(cursor, plen, channel_type->features, len); - - return channel_type; -} - -// SHA256STAMP:8639d78101a54a07ac8be72bc33df8d2c974b52452786fb5a898f0a83a7837a7 diff --git a/wire/channel_type_wiregen.h b/wire/channel_type_wiregen.h deleted file mode 100644 index 3c73a585d..000000000 --- a/wire/channel_type_wiregen.h +++ /dev/null @@ -1,23 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_WIRE_CHANNEL_TYPE_WIREGEN_H -#define LIGHTNING_WIRE_CHANNEL_TYPE_WIREGEN_H -#include -#include -#include - - -struct channel_type { - u8 *features; -}; - -/* SUBTYPE: CHANNEL_TYPE */ -/* Why not let our generator generate this too? */ -void towire_channel_type(u8 **p, const struct channel_type *channel_type); -struct channel_type *fromwire_channel_type(const tal_t *ctx, const u8 **cursor, size_t *plen); - - -#endif /* LIGHTNING_WIRE_CHANNEL_TYPE_WIREGEN_H */ -// SHA256STAMP:8639d78101a54a07ac8be72bc33df8d2c974b52452786fb5a898f0a83a7837a7 diff --git a/wire/common_wiregen.c b/wire/common_wiregen.c deleted file mode 100644 index 3032ec26e..000000000 --- a/wire/common_wiregen.c +++ /dev/null @@ -1,103 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *common_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum common_wire)e) { - case WIRE_CUSTOMMSG_IN: return "WIRE_CUSTOMMSG_IN"; - case WIRE_CUSTOMMSG_OUT: return "WIRE_CUSTOMMSG_OUT"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool common_wire_is_defined(u16 type) -{ - switch ((enum common_wire)type) { - case WIRE_CUSTOMMSG_IN:; - case WIRE_CUSTOMMSG_OUT:; - return true; - } - return false; -} - - - - - -/* WIRE: CUSTOMMSG_IN */ -/* A custom message that we got from a peer and don't know how to handle */ -/* forward it to the master for further handling. */ -u8 *towire_custommsg_in(const tal_t *ctx, const u8 *msg) -{ - u16 msg_len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CUSTOMMSG_IN); - towire_u16(&p, msg_len); - towire_u8_array(&p, msg, msg_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_custommsg_in(const tal_t *ctx, const void *p, u8 **msg) -{ - u16 msg_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CUSTOMMSG_IN) - return false; - msg_len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = msg_len ? tal_arr(ctx, u8, msg_len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, msg_len); - return cursor != NULL; -} - -/* WIRE: CUSTOMMSG_OUT */ -/* A custom message that the master tells us to send to the peer. */ -u8 *towire_custommsg_out(const tal_t *ctx, const u8 *msg) -{ - u16 msg_len = tal_count(msg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CUSTOMMSG_OUT); - towire_u16(&p, msg_len); - towire_u8_array(&p, msg, msg_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg) -{ - u16 msg_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CUSTOMMSG_OUT) - return false; - msg_len = fromwire_u16(&cursor, &plen); - // 2nd case msg - *msg = msg_len ? tal_arr(ctx, u8, msg_len) : NULL; - fromwire_u8_array(&cursor, &plen, *msg, msg_len); - return cursor != NULL; -} -// SHA256STAMP:a0d8998b1f9bd46677f237471545a49b8009e41b8b3afedf0007adeabf98b440 diff --git a/wire/common_wiregen.h b/wire/common_wiregen.h deleted file mode 100644 index 8f0282bcd..000000000 --- a/wire/common_wiregen.h +++ /dev/null @@ -1,44 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_WIRE_COMMON_WIREGEN_H -#define LIGHTNING_WIRE_COMMON_WIREGEN_H -#include -#include -#include - -enum common_wire { - /* A custom message that we got from a peer and don't know how to handle */ - /* forward it to the master for further handling. */ - WIRE_CUSTOMMSG_IN = 1030, - /* A custom message that the master tells us to send to the peer. */ - WIRE_CUSTOMMSG_OUT = 1031, -}; - -const char *common_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool common_wire_is_defined(u16 type); - - -/* WIRE: CUSTOMMSG_IN */ -/* A custom message that we got from a peer and don't know how to handle */ -/* forward it to the master for further handling. */ -u8 *towire_custommsg_in(const tal_t *ctx, const u8 *msg); -bool fromwire_custommsg_in(const tal_t *ctx, const void *p, u8 **msg); - -/* WIRE: CUSTOMMSG_OUT */ -/* A custom message that the master tells us to send to the peer. */ -u8 *towire_custommsg_out(const tal_t *ctx, const u8 *msg); -bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg); - - -#endif /* LIGHTNING_WIRE_COMMON_WIREGEN_H */ -// SHA256STAMP:a0d8998b1f9bd46677f237471545a49b8009e41b8b3afedf0007adeabf98b440 diff --git a/wire/onion_printgen.c b/wire/onion_printgen.c deleted file mode 100644 index 9d844fa31..000000000 --- a/wire/onion_printgen.c +++ /dev/null @@ -1,944 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ - -#include -#include -#include -#include -#include -#include -#include - -void printonion_wire_message(const u8 *msg) -{ - switch ((enum onion_wire)fromwire_peektype(msg)) { - case WIRE_INVALID_REALM: - printf("WIRE_INVALID_REALM:\n"); - printwire_invalid_realm("invalid_realm", msg); - return; - case WIRE_TEMPORARY_NODE_FAILURE: - printf("WIRE_TEMPORARY_NODE_FAILURE:\n"); - printwire_temporary_node_failure("temporary_node_failure", msg); - return; - case WIRE_PERMANENT_NODE_FAILURE: - printf("WIRE_PERMANENT_NODE_FAILURE:\n"); - printwire_permanent_node_failure("permanent_node_failure", msg); - return; - case WIRE_REQUIRED_NODE_FEATURE_MISSING: - printf("WIRE_REQUIRED_NODE_FEATURE_MISSING:\n"); - printwire_required_node_feature_missing("required_node_feature_missing", msg); - return; - case WIRE_INVALID_ONION_VERSION: - printf("WIRE_INVALID_ONION_VERSION:\n"); - printwire_invalid_onion_version("invalid_onion_version", msg); - return; - case WIRE_INVALID_ONION_HMAC: - printf("WIRE_INVALID_ONION_HMAC:\n"); - printwire_invalid_onion_hmac("invalid_onion_hmac", msg); - return; - case WIRE_INVALID_ONION_KEY: - printf("WIRE_INVALID_ONION_KEY:\n"); - printwire_invalid_onion_key("invalid_onion_key", msg); - return; - case WIRE_TEMPORARY_CHANNEL_FAILURE: - printf("WIRE_TEMPORARY_CHANNEL_FAILURE:\n"); - printwire_temporary_channel_failure("temporary_channel_failure", msg); - return; - case WIRE_PERMANENT_CHANNEL_FAILURE: - printf("WIRE_PERMANENT_CHANNEL_FAILURE:\n"); - printwire_permanent_channel_failure("permanent_channel_failure", msg); - return; - case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING: - printf("WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:\n"); - printwire_required_channel_feature_missing("required_channel_feature_missing", msg); - return; - case WIRE_UNKNOWN_NEXT_PEER: - printf("WIRE_UNKNOWN_NEXT_PEER:\n"); - printwire_unknown_next_peer("unknown_next_peer", msg); - return; - case WIRE_AMOUNT_BELOW_MINIMUM: - printf("WIRE_AMOUNT_BELOW_MINIMUM:\n"); - printwire_amount_below_minimum("amount_below_minimum", msg); - return; - case WIRE_FEE_INSUFFICIENT: - printf("WIRE_FEE_INSUFFICIENT:\n"); - printwire_fee_insufficient("fee_insufficient", msg); - return; - case WIRE_INCORRECT_CLTV_EXPIRY: - printf("WIRE_INCORRECT_CLTV_EXPIRY:\n"); - printwire_incorrect_cltv_expiry("incorrect_cltv_expiry", msg); - return; - case WIRE_EXPIRY_TOO_SOON: - printf("WIRE_EXPIRY_TOO_SOON:\n"); - printwire_expiry_too_soon("expiry_too_soon", msg); - return; - case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS: - printf("WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS:\n"); - printwire_incorrect_or_unknown_payment_details("incorrect_or_unknown_payment_details", msg); - return; - case WIRE_FINAL_INCORRECT_CLTV_EXPIRY: - printf("WIRE_FINAL_INCORRECT_CLTV_EXPIRY:\n"); - printwire_final_incorrect_cltv_expiry("final_incorrect_cltv_expiry", msg); - return; - case WIRE_FINAL_INCORRECT_HTLC_AMOUNT: - printf("WIRE_FINAL_INCORRECT_HTLC_AMOUNT:\n"); - printwire_final_incorrect_htlc_amount("final_incorrect_htlc_amount", msg); - return; - case WIRE_CHANNEL_DISABLED: - printf("WIRE_CHANNEL_DISABLED:\n"); - printwire_channel_disabled("channel_disabled", msg); - return; - case WIRE_EXPIRY_TOO_FAR: - printf("WIRE_EXPIRY_TOO_FAR:\n"); - printwire_expiry_too_far("expiry_too_far", msg); - return; - case WIRE_INVALID_ONION_PAYLOAD: - printf("WIRE_INVALID_ONION_PAYLOAD:\n"); - printwire_invalid_onion_payload("invalid_onion_payload", msg); - return; - case WIRE_MPP_TIMEOUT: - printf("WIRE_MPP_TIMEOUT:\n"); - printwire_mpp_timeout("mpp_timeout", msg); - return; - } - - printf("UNKNOWN: %s\\n", tal_hex(msg, msg)); -} - - -void printwire_onionmsg_path(const char *fieldname, const u8 **cursor, size_t *plen) -{ - - 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; - } - u16 enclen = fromwire_u16(cursor, plen); - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("enctlv="); - printwire_u8_array(tal_fmt(NULL, "%s.enctlv", fieldname), cursor, plen, enclen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} - -static void printwire_tlv_tlv_payload_amt_to_forward(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "amt_to_forward"); - - printf("amt_to_forward="); - u64 amt_to_forward = fromwire_tu64(cursor, plen); - - printwire_u64(tal_fmt(NULL, "%s.amt_to_forward", fieldname), &amt_to_forward); - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_tlv_payload_outgoing_cltv_value(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "outgoing_cltv_value"); - - printf("outgoing_cltv_value="); - u32 outgoing_cltv_value = fromwire_tu32(cursor, plen); - - printwire_u32(tal_fmt(NULL, "%s.outgoing_cltv_value", fieldname), &outgoing_cltv_value); - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_tlv_payload_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "short_channel_id"); - - 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; - } - -} -static void printwire_tlv_tlv_payload_payment_data(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "payment_data"); - - printf("payment_secret="); - struct secret payment_secret; - fromwire_secret(cursor, plen, &payment_secret); - - printwire_secret(tal_fmt(NULL, "%s.payment_secret", fieldname), &payment_secret); - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("total_msat="); - u64 total_msat = fromwire_tu64(cursor, plen); - - printwire_u64(tal_fmt(NULL, "%s.total_msat", fieldname), &total_msat); - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} - -static const struct tlv_print_record_type print_tlvs_tlv_payload[] = { - { 2, printwire_tlv_tlv_payload_amt_to_forward }, - { 4, printwire_tlv_tlv_payload_outgoing_cltv_value }, - { 6, printwire_tlv_tlv_payload_short_channel_id }, - { 8, printwire_tlv_tlv_payload_payment_data }, -}; - -static void printwire_tlv_onionmsg_payload_reply_path(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "reply_path"); - - printf("first_node_id="); - struct pubkey first_node_id; - fromwire_pubkey(cursor, plen, &first_node_id); - - printwire_pubkey(tal_fmt(NULL, "%s.first_node_id", fieldname), &first_node_id); - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - 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; - } - printf("path="); - printf("["); - for (size_t i = 0; i < *plen; i++) { - printf("{\n"); - printwire_onionmsg_path(tal_fmt(NULL, "%s.path", fieldname), cursor, plen); - printf("}\n"); - } - printf("]"); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_onionmsg_payload_obs_next_node_id(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "obs_next_node_id"); - - 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; - } - -} -static void printwire_tlv_onionmsg_payload_obs_next_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "obs_next_short_channel_id"); - - 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; - } - -} -static void printwire_tlv_onionmsg_payload_obs_reply_path(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "obs_reply_path"); - - 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; - } - printf("path="); - printf("["); - for (size_t i = 0; i < *plen; i++) { - printf("{\n"); - printwire_onionmsg_path(tal_fmt(NULL, "%s.path", fieldname), cursor, plen); - printf("}\n"); - } - printf("]"); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_onionmsg_payload_enctlv(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "enctlv"); - - printf("enctlv="); - printwire_u8_array(tal_fmt(NULL, "%s.enctlv", fieldname), cursor, plen, *plen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_onionmsg_payload_obs_blinding(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "obs_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 void printwire_tlv_onionmsg_payload_invoice_request(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "invoice_request"); - - printf("invoice_request="); - printwire_u8_array(tal_fmt(NULL, "%s.invoice_request", fieldname), cursor, plen, *plen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_onionmsg_payload_invoice(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "invoice"); - - printf("invoice="); - printwire_u8_array(tal_fmt(NULL, "%s.invoice", fieldname), cursor, plen, *plen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_onionmsg_payload_invoice_error(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "invoice_error"); - - printf("invoice_error="); - printwire_u8_array(tal_fmt(NULL, "%s.invoice_error", fieldname), cursor, plen, *plen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} - -static const struct tlv_print_record_type print_tlvs_onionmsg_payload[] = { - { 2, printwire_tlv_onionmsg_payload_reply_path }, - { 4, printwire_tlv_onionmsg_payload_obs_next_node_id }, - { 6, printwire_tlv_onionmsg_payload_obs_next_short_channel_id }, - { 8, printwire_tlv_onionmsg_payload_obs_reply_path }, - { 10, printwire_tlv_onionmsg_payload_enctlv }, - { 12, printwire_tlv_onionmsg_payload_obs_blinding }, - { 64, printwire_tlv_onionmsg_payload_invoice_request }, - { 66, printwire_tlv_onionmsg_payload_invoice }, - { 68, printwire_tlv_onionmsg_payload_invoice_error }, -}; - -static void printwire_tlv_encmsg_tlvs_padding(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "padding"); - - printf("pad="); - printwire_u8_array(tal_fmt(NULL, "%s.pad", fieldname), cursor, plen, *plen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} -static void printwire_tlv_encmsg_tlvs_next_node_id(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "next_node_id"); - - 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; - } - -} -static void printwire_tlv_encmsg_tlvs_obs_next_short_channel_id(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "obs_next_short_channel_id"); - - 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; - } - -} -static void printwire_tlv_encmsg_tlvs_next_blinding(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "next_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 void printwire_tlv_encmsg_tlvs_self_id(const char *fieldname, const u8 **cursor, size_t *plen) -{ - printf("(msg_name=%s)\n", "self_id"); - - printf("data="); - printwire_u8_array(tal_fmt(NULL, "%s.data", fieldname), cursor, plen, *plen); - - if (!*cursor) { - printf("**TRUNCATED**\n"); - return; - } - -} - -static const struct tlv_print_record_type print_tlvs_encmsg_tlvs[] = { - { 1, printwire_tlv_encmsg_tlvs_padding }, - { 4, printwire_tlv_encmsg_tlvs_next_node_id }, - { 6, printwire_tlv_encmsg_tlvs_obs_next_short_channel_id }, - { 12, printwire_tlv_encmsg_tlvs_next_blinding }, - { 14, printwire_tlv_encmsg_tlvs_self_id }, -}; -void printwire_invalid_realm(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_REALM) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_temporary_node_failure(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_TEMPORARY_NODE_FAILURE) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_permanent_node_failure(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_PERMANENT_NODE_FAILURE) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_required_node_feature_missing(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_REQUIRED_NODE_FEATURE_MISSING) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_invalid_onion_version(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_VERSION) { - printf("WRONG TYPE?!\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; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_invalid_onion_hmac(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_HMAC) { - printf("WRONG TYPE?!\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; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_invalid_onion_key(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_KEY) { - printf("WRONG TYPE?!\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; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_temporary_channel_failure(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_TEMPORARY_CHANNEL_FAILURE) { - printf("WRONG TYPE?!\n"); - return; - } - - u16 len = fromwire_u16(&cursor, &plen); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("channel_update="); - printwire_u8_array(tal_fmt(NULL, "%s.channel_update", fieldname), &cursor, &plen, len); - - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_permanent_channel_failure(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_PERMANENT_CHANNEL_FAILURE) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_required_channel_feature_missing(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_REQUIRED_CHANNEL_FEATURE_MISSING) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_unknown_next_peer(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_UNKNOWN_NEXT_PEER) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_amount_below_minimum(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_AMOUNT_BELOW_MINIMUM) { - printf("WRONG TYPE?!\n"); - return; - } - - printf("htlc_msat="); - struct amount_msat htlc_msat = fromwire_amount_msat(&cursor, &plen); - - printwire_amount_msat(tal_fmt(NULL, "%s.htlc_msat", fieldname), &htlc_msat); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - u16 len = fromwire_u16(&cursor, &plen); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("channel_update="); - printwire_u8_array(tal_fmt(NULL, "%s.channel_update", fieldname), &cursor, &plen, len); - - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_fee_insufficient(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_FEE_INSUFFICIENT) { - printf("WRONG TYPE?!\n"); - return; - } - - printf("htlc_msat="); - struct amount_msat htlc_msat = fromwire_amount_msat(&cursor, &plen); - - printwire_amount_msat(tal_fmt(NULL, "%s.htlc_msat", fieldname), &htlc_msat); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - u16 len = fromwire_u16(&cursor, &plen); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("channel_update="); - printwire_u8_array(tal_fmt(NULL, "%s.channel_update", fieldname), &cursor, &plen, len); - - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_incorrect_cltv_expiry(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INCORRECT_CLTV_EXPIRY) { - printf("WRONG TYPE?!\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; - } - u16 len = fromwire_u16(&cursor, &plen); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("channel_update="); - printwire_u8_array(tal_fmt(NULL, "%s.channel_update", fieldname), &cursor, &plen, len); - - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_expiry_too_soon(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_EXPIRY_TOO_SOON) { - printf("WRONG TYPE?!\n"); - return; - } - - u16 len = fromwire_u16(&cursor, &plen); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("channel_update="); - printwire_u8_array(tal_fmt(NULL, "%s.channel_update", fieldname), &cursor, &plen, len); - - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_incorrect_or_unknown_payment_details(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS) { - printf("WRONG TYPE?!\n"); - return; - } - - printf("htlc_msat="); - struct amount_msat htlc_msat = fromwire_amount_msat(&cursor, &plen); - - printwire_amount_msat(tal_fmt(NULL, "%s.htlc_msat", fieldname), &htlc_msat); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("height="); - u32 height = fromwire_u32(&cursor, &plen); - - printwire_u32(tal_fmt(NULL, "%s.height", fieldname), &height); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_final_incorrect_cltv_expiry(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_FINAL_INCORRECT_CLTV_EXPIRY) { - printf("WRONG TYPE?!\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; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_final_incorrect_htlc_amount(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_FINAL_INCORRECT_HTLC_AMOUNT) { - printf("WRONG TYPE?!\n"); - return; - } - - printf("incoming_htlc_amt="); - struct amount_msat incoming_htlc_amt = fromwire_amount_msat(&cursor, &plen); - - printwire_amount_msat(tal_fmt(NULL, "%s.incoming_htlc_amt", fieldname), &incoming_htlc_amt); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_channel_disabled(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_DISABLED) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_expiry_too_far(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_EXPIRY_TOO_FAR) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_invalid_onion_payload(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_PAYLOAD) { - printf("WRONG TYPE?!\n"); - return; - } - - printf("type="); - bigsize type = fromwire_bigsize(&cursor, &plen); - - printwire_bigsize(tal_fmt(NULL, "%s.type", fieldname), &type); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - printf("offset="); - u16 offset = fromwire_u16(&cursor, &plen); - - printwire_u16(tal_fmt(NULL, "%s.offset", fieldname), &offset); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_mpp_timeout(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_MPP_TIMEOUT) { - printf("WRONG TYPE?!\n"); - return; - } - - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} - -void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg) { - size_t plen = tal_count(msg); - if (strcmp(tlv_name, "tlv_payload") == 0) { - printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_tlv_payload, ARRAY_SIZE(print_tlvs_tlv_payload)); - } - if (strcmp(tlv_name, "onionmsg_payload") == 0) { - printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_onionmsg_payload, ARRAY_SIZE(print_tlvs_onionmsg_payload)); - } - if (strcmp(tlv_name, "encmsg_tlvs") == 0) { - printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_encmsg_tlvs, ARRAY_SIZE(print_tlvs_encmsg_tlvs)); - } -} -// SHA256STAMP:dc74e1b66f37a96bed7d2ab3f5b83fdf7cbe4ee7775ebda3ee43812e75f260ba diff --git a/wire/onion_printgen.h b/wire/onion_printgen.h deleted file mode 100644 index 2f9b3ef05..000000000 --- a/wire/onion_printgen.h +++ /dev/null @@ -1,61 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Template located at tools/gen/print_header_template */ -#ifndef LIGHTNING_WIRE_ONION_PRINTGEN_H -#define LIGHTNING_WIRE_ONION_PRINTGEN_H -#include -#include -#include - -void printonion_wire_message(const u8 *msg); - -void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg); - -void printwire_invalid_realm(const char *fieldname, const u8 *cursor); - -void printwire_temporary_node_failure(const char *fieldname, const u8 *cursor); - -void printwire_permanent_node_failure(const char *fieldname, const u8 *cursor); - -void printwire_required_node_feature_missing(const char *fieldname, const u8 *cursor); - -void printwire_invalid_onion_version(const char *fieldname, const u8 *cursor); - -void printwire_invalid_onion_hmac(const char *fieldname, const u8 *cursor); - -void printwire_invalid_onion_key(const char *fieldname, const u8 *cursor); - -void printwire_temporary_channel_failure(const char *fieldname, const u8 *cursor); - -void printwire_permanent_channel_failure(const char *fieldname, const u8 *cursor); - -void printwire_required_channel_feature_missing(const char *fieldname, const u8 *cursor); - -void printwire_unknown_next_peer(const char *fieldname, const u8 *cursor); - -void printwire_amount_below_minimum(const char *fieldname, const u8 *cursor); - -void printwire_fee_insufficient(const char *fieldname, const u8 *cursor); - -void printwire_incorrect_cltv_expiry(const char *fieldname, const u8 *cursor); - -void printwire_expiry_too_soon(const char *fieldname, const u8 *cursor); - -void printwire_incorrect_or_unknown_payment_details(const char *fieldname, const u8 *cursor); - -void printwire_final_incorrect_cltv_expiry(const char *fieldname, const u8 *cursor); - -void printwire_final_incorrect_htlc_amount(const char *fieldname, const u8 *cursor); - -void printwire_channel_disabled(const char *fieldname, const u8 *cursor); - -void printwire_expiry_too_far(const char *fieldname, const u8 *cursor); - -void printwire_invalid_onion_payload(const char *fieldname, const u8 *cursor); - -void printwire_mpp_timeout(const char *fieldname, const u8 *cursor); - - -void printwire_onionmsg_path(const char *fieldname, const u8 **cursor, size_t *plen); -#endif /* LIGHTNING_WIRE_ONION_PRINTGEN_H */ -// SHA256STAMP:dc74e1b66f37a96bed7d2ab3f5b83fdf7cbe4ee7775ebda3ee43812e75f260ba diff --git a/wire/onion_wiregen.c b/wire/onion_wiregen.c deleted file mode 100644 index 577df14aa..000000000 --- a/wire/onion_wiregen.c +++ /dev/null @@ -1,1134 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *onion_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum onion_wire)e) { - case WIRE_INVALID_REALM: return "WIRE_INVALID_REALM"; - case WIRE_TEMPORARY_NODE_FAILURE: return "WIRE_TEMPORARY_NODE_FAILURE"; - case WIRE_PERMANENT_NODE_FAILURE: return "WIRE_PERMANENT_NODE_FAILURE"; - case WIRE_REQUIRED_NODE_FEATURE_MISSING: return "WIRE_REQUIRED_NODE_FEATURE_MISSING"; - case WIRE_INVALID_ONION_VERSION: return "WIRE_INVALID_ONION_VERSION"; - case WIRE_INVALID_ONION_HMAC: return "WIRE_INVALID_ONION_HMAC"; - case WIRE_INVALID_ONION_KEY: return "WIRE_INVALID_ONION_KEY"; - case WIRE_TEMPORARY_CHANNEL_FAILURE: return "WIRE_TEMPORARY_CHANNEL_FAILURE"; - case WIRE_PERMANENT_CHANNEL_FAILURE: return "WIRE_PERMANENT_CHANNEL_FAILURE"; - case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING: return "WIRE_REQUIRED_CHANNEL_FEATURE_MISSING"; - case WIRE_UNKNOWN_NEXT_PEER: return "WIRE_UNKNOWN_NEXT_PEER"; - case WIRE_AMOUNT_BELOW_MINIMUM: return "WIRE_AMOUNT_BELOW_MINIMUM"; - case WIRE_FEE_INSUFFICIENT: return "WIRE_FEE_INSUFFICIENT"; - case WIRE_INCORRECT_CLTV_EXPIRY: return "WIRE_INCORRECT_CLTV_EXPIRY"; - case WIRE_EXPIRY_TOO_SOON: return "WIRE_EXPIRY_TOO_SOON"; - case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS: return "WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS"; - case WIRE_FINAL_INCORRECT_CLTV_EXPIRY: return "WIRE_FINAL_INCORRECT_CLTV_EXPIRY"; - case WIRE_FINAL_INCORRECT_HTLC_AMOUNT: return "WIRE_FINAL_INCORRECT_HTLC_AMOUNT"; - case WIRE_CHANNEL_DISABLED: return "WIRE_CHANNEL_DISABLED"; - case WIRE_EXPIRY_TOO_FAR: return "WIRE_EXPIRY_TOO_FAR"; - case WIRE_INVALID_ONION_PAYLOAD: return "WIRE_INVALID_ONION_PAYLOAD"; - case WIRE_MPP_TIMEOUT: return "WIRE_MPP_TIMEOUT"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool onion_wire_is_defined(u16 type) -{ - switch ((enum onion_wire)type) { - case WIRE_INVALID_REALM:; - case WIRE_TEMPORARY_NODE_FAILURE:; - case WIRE_PERMANENT_NODE_FAILURE:; - case WIRE_REQUIRED_NODE_FEATURE_MISSING:; - case WIRE_INVALID_ONION_VERSION:; - case WIRE_INVALID_ONION_HMAC:; - case WIRE_INVALID_ONION_KEY:; - case WIRE_TEMPORARY_CHANNEL_FAILURE:; - case WIRE_PERMANENT_CHANNEL_FAILURE:; - case WIRE_REQUIRED_CHANNEL_FEATURE_MISSING:; - case WIRE_UNKNOWN_NEXT_PEER:; - case WIRE_AMOUNT_BELOW_MINIMUM:; - case WIRE_FEE_INSUFFICIENT:; - case WIRE_INCORRECT_CLTV_EXPIRY:; - case WIRE_EXPIRY_TOO_SOON:; - case WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS:; - case WIRE_FINAL_INCORRECT_CLTV_EXPIRY:; - case WIRE_FINAL_INCORRECT_HTLC_AMOUNT:; - case WIRE_CHANNEL_DISABLED:; - case WIRE_EXPIRY_TOO_FAR:; - case WIRE_INVALID_ONION_PAYLOAD:; - case WIRE_MPP_TIMEOUT:; - return true; - } - return false; -} - - - - -/* SUBTYPE: ONIONMSG_PATH */ -void towire_onionmsg_path(u8 **p, const struct onionmsg_path *onionmsg_path) -{ - u16 enclen = tal_count(onionmsg_path->enctlv); - - towire_pubkey(p, &onionmsg_path->node_id); - towire_u16(p, enclen); - towire_u8_array(p, onionmsg_path->enctlv, enclen); -} -struct onionmsg_path * -fromwire_onionmsg_path(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct onionmsg_path *onionmsg_path = tal(ctx, struct onionmsg_path); - u16 enclen; - - fromwire_pubkey(cursor, plen, &onionmsg_path->node_id); - enclen = fromwire_u16(cursor, plen); - onionmsg_path->enctlv = tal_arr(onionmsg_path, u8, enclen); -fromwire_u8_array(cursor, plen, onionmsg_path->enctlv, enclen); - - return onionmsg_path; -} - - -struct tlv_tlv_payload *tlv_tlv_payload_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_tlv_payload *inst = talz(ctx, struct tlv_tlv_payload); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* TLV_PAYLOAD MSG: amt_to_forward */ -static u8 *towire_tlv_tlv_payload_amt_to_forward(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_tlv_payload *r = vrecord; - u8 *ptr; - - if (!r->amt_to_forward) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->amt_to_forward); - return ptr; -} -static void fromwire_tlv_tlv_payload_amt_to_forward(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_tlv_payload *r = vrecord; - - r->amt_to_forward = tal(r, u64); - -*r->amt_to_forward = fromwire_tu64(cursor, plen); -} -/* TLV_PAYLOAD MSG: outgoing_cltv_value */ -static u8 *towire_tlv_tlv_payload_outgoing_cltv_value(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_tlv_payload *r = vrecord; - u8 *ptr; - - if (!r->outgoing_cltv_value) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->outgoing_cltv_value); - return ptr; -} -static void fromwire_tlv_tlv_payload_outgoing_cltv_value(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_tlv_payload *r = vrecord; - - r->outgoing_cltv_value = tal(r, u32); - -*r->outgoing_cltv_value = fromwire_tu32(cursor, plen); -} -/* TLV_PAYLOAD MSG: short_channel_id */ -static u8 *towire_tlv_tlv_payload_short_channel_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_tlv_payload *r = vrecord; - u8 *ptr; - - if (!r->short_channel_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_short_channel_id(&ptr, r->short_channel_id); - return ptr; -} -static void fromwire_tlv_tlv_payload_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_tlv_payload *r = vrecord; - - r->short_channel_id = tal(r, struct short_channel_id); - -fromwire_short_channel_id(cursor, plen, &*r->short_channel_id); -} -/* TLV_PAYLOAD MSG: payment_data */ -static u8 *towire_tlv_tlv_payload_payment_data(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_tlv_payload *r = vrecord; - u8 *ptr; - - if (!r->payment_data) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_secret(&ptr, &r->payment_data->payment_secret); - - towire_tu64(&ptr, r->payment_data->total_msat); - return ptr; -} -static void fromwire_tlv_tlv_payload_payment_data(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_tlv_payload *r = vrecord; - - r->payment_data = tal(r, struct tlv_tlv_payload_payment_data); - fromwire_secret(cursor, plen, &r->payment_data->payment_secret); - r->payment_data->total_msat = fromwire_tu64(cursor, plen); -} - -const struct tlv_record_type tlvs_tlv_payload[] = { - { 2, towire_tlv_tlv_payload_amt_to_forward, fromwire_tlv_tlv_payload_amt_to_forward }, - { 4, towire_tlv_tlv_payload_outgoing_cltv_value, fromwire_tlv_tlv_payload_outgoing_cltv_value }, - { 6, towire_tlv_tlv_payload_short_channel_id, fromwire_tlv_tlv_payload_short_channel_id }, - { 8, towire_tlv_tlv_payload_payment_data, fromwire_tlv_tlv_payload_payment_data }, -}; - -void towire_tlv_payload(u8 **pptr, const struct tlv_tlv_payload *record) -{ - towire_tlv(pptr, tlvs_tlv_payload, 4, record); -} - - -bool fromwire_tlv_payload(const u8 **cursor, size_t *max, struct tlv_tlv_payload *record) -{ - return fromwire_tlv(cursor, max, tlvs_tlv_payload, 4, record, &record->fields); -} - -bool tlv_payload_is_valid(const struct tlv_tlv_payload *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_onionmsg_payload *tlv_onionmsg_payload_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_onionmsg_payload *inst = talz(ctx, struct tlv_onionmsg_payload); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* ONIONMSG_PAYLOAD MSG: reply_path */ -static u8 *towire_tlv_onionmsg_payload_reply_path(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->reply_path) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, &r->reply_path->first_node_id); - - towire_pubkey(&ptr, &r->reply_path->blinding); - - for (size_t i = 0; i < tal_count(r->reply_path->path); i++) - towire_onionmsg_path(&ptr, r->reply_path->path[i]); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_reply_path(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->reply_path = tal(r, struct tlv_onionmsg_payload_reply_path); - fromwire_pubkey(cursor, plen, &r->reply_path->first_node_id); - fromwire_pubkey(cursor, plen, &r->reply_path->blinding); - r->reply_path->path = *plen ? tal_arr(r->reply_path, struct onionmsg_path *, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct onionmsg_path * tmp; - tmp = fromwire_onionmsg_path(r->reply_path, cursor, plen); - tal_arr_expand(&r->reply_path->path, tmp); - } -} -/* ONIONMSG_PAYLOAD MSG: obs_next_node_id */ -static u8 *towire_tlv_onionmsg_payload_obs_next_node_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->obs_next_node_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, r->obs_next_node_id); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_obs_next_node_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->obs_next_node_id = tal(r, struct pubkey); - -fromwire_pubkey(cursor, plen, &*r->obs_next_node_id); -} -/* ONIONMSG_PAYLOAD MSG: obs_next_short_channel_id */ -static u8 *towire_tlv_onionmsg_payload_obs_next_short_channel_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->obs_next_short_channel_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_short_channel_id(&ptr, r->obs_next_short_channel_id); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_obs_next_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->obs_next_short_channel_id = tal(r, struct short_channel_id); - -fromwire_short_channel_id(cursor, plen, &*r->obs_next_short_channel_id); -} -/* ONIONMSG_PAYLOAD MSG: obs_reply_path */ -static u8 *towire_tlv_onionmsg_payload_obs_reply_path(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->obs_reply_path) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, &r->obs_reply_path->blinding); - - for (size_t i = 0; i < tal_count(r->obs_reply_path->path); i++) - towire_onionmsg_path(&ptr, r->obs_reply_path->path[i]); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_obs_reply_path(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->obs_reply_path = tal(r, struct tlv_onionmsg_payload_obs_reply_path); - fromwire_pubkey(cursor, plen, &r->obs_reply_path->blinding); - r->obs_reply_path->path = *plen ? tal_arr(r->obs_reply_path, struct onionmsg_path *, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct onionmsg_path * tmp; - tmp = fromwire_onionmsg_path(r->obs_reply_path, cursor, plen); - tal_arr_expand(&r->obs_reply_path->path, tmp); - } -} -/* ONIONMSG_PAYLOAD MSG: enctlv */ -static u8 *towire_tlv_onionmsg_payload_enctlv(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->enctlv) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->enctlv, tal_count(r->enctlv)); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_enctlv(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->enctlv = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->enctlv, *plen); -} -/* ONIONMSG_PAYLOAD MSG: obs_blinding */ -static u8 *towire_tlv_onionmsg_payload_obs_blinding(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->obs_blinding) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, r->obs_blinding); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_obs_blinding(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->obs_blinding = tal(r, struct pubkey); - -fromwire_pubkey(cursor, plen, &*r->obs_blinding); -} -/* ONIONMSG_PAYLOAD MSG: invoice_request */ -static u8 *towire_tlv_onionmsg_payload_invoice_request(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->invoice_request) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->invoice_request, tal_count(r->invoice_request)); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_invoice_request(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->invoice_request = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->invoice_request, *plen); -} -/* ONIONMSG_PAYLOAD MSG: invoice */ -static u8 *towire_tlv_onionmsg_payload_invoice(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->invoice) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->invoice, tal_count(r->invoice)); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_invoice(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->invoice = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->invoice, *plen); -} -/* ONIONMSG_PAYLOAD MSG: invoice_error */ -static u8 *towire_tlv_onionmsg_payload_invoice_error(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_onionmsg_payload *r = vrecord; - u8 *ptr; - - if (!r->invoice_error) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->invoice_error, tal_count(r->invoice_error)); - return ptr; -} -static void fromwire_tlv_onionmsg_payload_invoice_error(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_onionmsg_payload *r = vrecord; - - r->invoice_error = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->invoice_error, *plen); -} - -static const struct tlv_record_type tlvs_onionmsg_payload[] = { - { 2, towire_tlv_onionmsg_payload_reply_path, fromwire_tlv_onionmsg_payload_reply_path }, - { 4, towire_tlv_onionmsg_payload_obs_next_node_id, fromwire_tlv_onionmsg_payload_obs_next_node_id }, - { 6, towire_tlv_onionmsg_payload_obs_next_short_channel_id, fromwire_tlv_onionmsg_payload_obs_next_short_channel_id }, - { 8, towire_tlv_onionmsg_payload_obs_reply_path, fromwire_tlv_onionmsg_payload_obs_reply_path }, - { 10, towire_tlv_onionmsg_payload_enctlv, fromwire_tlv_onionmsg_payload_enctlv }, - { 12, towire_tlv_onionmsg_payload_obs_blinding, fromwire_tlv_onionmsg_payload_obs_blinding }, - { 64, towire_tlv_onionmsg_payload_invoice_request, fromwire_tlv_onionmsg_payload_invoice_request }, - { 66, towire_tlv_onionmsg_payload_invoice, fromwire_tlv_onionmsg_payload_invoice }, - { 68, towire_tlv_onionmsg_payload_invoice_error, fromwire_tlv_onionmsg_payload_invoice_error }, -}; - -void towire_onionmsg_payload(u8 **pptr, const struct tlv_onionmsg_payload *record) -{ - towire_tlv(pptr, tlvs_onionmsg_payload, 9, record); -} - - -bool fromwire_onionmsg_payload(const u8 **cursor, size_t *max, struct tlv_onionmsg_payload *record) -{ - return fromwire_tlv(cursor, max, tlvs_onionmsg_payload, 9, record, &record->fields); -} - -bool onionmsg_payload_is_valid(const struct tlv_onionmsg_payload *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_encmsg_tlvs *tlv_encmsg_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_encmsg_tlvs *inst = talz(ctx, struct tlv_encmsg_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* ENCMSG_TLVS MSG: padding */ -static u8 *towire_tlv_encmsg_tlvs_padding(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_encmsg_tlvs *r = vrecord; - u8 *ptr; - - if (!r->padding) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->padding, tal_count(r->padding)); - return ptr; -} -static void fromwire_tlv_encmsg_tlvs_padding(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_encmsg_tlvs *r = vrecord; - - r->padding = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->padding, *plen); -} -/* ENCMSG_TLVS MSG: next_node_id */ -static u8 *towire_tlv_encmsg_tlvs_next_node_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_encmsg_tlvs *r = vrecord; - u8 *ptr; - - if (!r->next_node_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, r->next_node_id); - return ptr; -} -static void fromwire_tlv_encmsg_tlvs_next_node_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_encmsg_tlvs *r = vrecord; - - r->next_node_id = tal(r, struct pubkey); - -fromwire_pubkey(cursor, plen, &*r->next_node_id); -} -/* ENCMSG_TLVS MSG: obs_next_short_channel_id */ -static u8 *towire_tlv_encmsg_tlvs_obs_next_short_channel_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_encmsg_tlvs *r = vrecord; - u8 *ptr; - - if (!r->obs_next_short_channel_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_short_channel_id(&ptr, r->obs_next_short_channel_id); - return ptr; -} -static void fromwire_tlv_encmsg_tlvs_obs_next_short_channel_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_encmsg_tlvs *r = vrecord; - - r->obs_next_short_channel_id = tal(r, struct short_channel_id); - -fromwire_short_channel_id(cursor, plen, &*r->obs_next_short_channel_id); -} -/* ENCMSG_TLVS MSG: next_blinding */ -static u8 *towire_tlv_encmsg_tlvs_next_blinding(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_encmsg_tlvs *r = vrecord; - u8 *ptr; - - if (!r->next_blinding) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, r->next_blinding); - return ptr; -} -static void fromwire_tlv_encmsg_tlvs_next_blinding(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_encmsg_tlvs *r = vrecord; - - r->next_blinding = tal(r, struct pubkey); - -fromwire_pubkey(cursor, plen, &*r->next_blinding); -} -/* ENCMSG_TLVS MSG: self_id */ -static u8 *towire_tlv_encmsg_tlvs_self_id(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_encmsg_tlvs *r = vrecord; - u8 *ptr; - - if (!r->self_id) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->self_id, tal_count(r->self_id)); - return ptr; -} -static void fromwire_tlv_encmsg_tlvs_self_id(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_encmsg_tlvs *r = vrecord; - - r->self_id = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->self_id, *plen); -} - -static const struct tlv_record_type tlvs_encmsg_tlvs[] = { - { 1, towire_tlv_encmsg_tlvs_padding, fromwire_tlv_encmsg_tlvs_padding }, - { 4, towire_tlv_encmsg_tlvs_next_node_id, fromwire_tlv_encmsg_tlvs_next_node_id }, - { 6, towire_tlv_encmsg_tlvs_obs_next_short_channel_id, fromwire_tlv_encmsg_tlvs_obs_next_short_channel_id }, - { 12, towire_tlv_encmsg_tlvs_next_blinding, fromwire_tlv_encmsg_tlvs_next_blinding }, - { 14, towire_tlv_encmsg_tlvs_self_id, fromwire_tlv_encmsg_tlvs_self_id }, -}; - -void towire_encmsg_tlvs(u8 **pptr, const struct tlv_encmsg_tlvs *record) -{ - towire_tlv(pptr, tlvs_encmsg_tlvs, 5, record); -} - - -bool fromwire_encmsg_tlvs(const u8 **cursor, size_t *max, struct tlv_encmsg_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_encmsg_tlvs, 5, record, &record->fields); -} - -bool encmsg_tlvs_is_valid(const struct tlv_encmsg_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -/* WIRE: INVALID_REALM */ -u8 *towire_invalid_realm(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INVALID_REALM); - - return memcheck(p, tal_count(p)); -} -bool fromwire_invalid_realm(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_REALM) - return false; - return cursor != NULL; -} - -/* WIRE: TEMPORARY_NODE_FAILURE */ -u8 *towire_temporary_node_failure(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TEMPORARY_NODE_FAILURE); - - return memcheck(p, tal_count(p)); -} -bool fromwire_temporary_node_failure(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TEMPORARY_NODE_FAILURE) - return false; - return cursor != NULL; -} - -/* WIRE: PERMANENT_NODE_FAILURE */ -u8 *towire_permanent_node_failure(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_PERMANENT_NODE_FAILURE); - - return memcheck(p, tal_count(p)); -} -bool fromwire_permanent_node_failure(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_PERMANENT_NODE_FAILURE) - return false; - return cursor != NULL; -} - -/* WIRE: REQUIRED_NODE_FEATURE_MISSING */ -u8 *towire_required_node_feature_missing(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_REQUIRED_NODE_FEATURE_MISSING); - - return memcheck(p, tal_count(p)); -} -bool fromwire_required_node_feature_missing(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_REQUIRED_NODE_FEATURE_MISSING) - return false; - return cursor != NULL; -} - -/* WIRE: INVALID_ONION_VERSION */ -u8 *towire_invalid_onion_version(const tal_t *ctx, const struct sha256 *sha256_of_onion) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INVALID_ONION_VERSION); - towire_sha256(&p, sha256_of_onion); - - return memcheck(p, tal_count(p)); -} -bool fromwire_invalid_onion_version(const void *p, struct sha256 *sha256_of_onion) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_VERSION) - return false; - fromwire_sha256(&cursor, &plen, sha256_of_onion); - return cursor != NULL; -} - -/* WIRE: INVALID_ONION_HMAC */ -u8 *towire_invalid_onion_hmac(const tal_t *ctx, const struct sha256 *sha256_of_onion) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INVALID_ONION_HMAC); - towire_sha256(&p, sha256_of_onion); - - return memcheck(p, tal_count(p)); -} -bool fromwire_invalid_onion_hmac(const void *p, struct sha256 *sha256_of_onion) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_HMAC) - return false; - fromwire_sha256(&cursor, &plen, sha256_of_onion); - return cursor != NULL; -} - -/* WIRE: INVALID_ONION_KEY */ -u8 *towire_invalid_onion_key(const tal_t *ctx, const struct sha256 *sha256_of_onion) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INVALID_ONION_KEY); - towire_sha256(&p, sha256_of_onion); - - return memcheck(p, tal_count(p)); -} -bool fromwire_invalid_onion_key(const void *p, struct sha256 *sha256_of_onion) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_KEY) - return false; - fromwire_sha256(&cursor, &plen, sha256_of_onion); - return cursor != NULL; -} - -/* WIRE: TEMPORARY_CHANNEL_FAILURE */ -u8 *towire_temporary_channel_failure(const tal_t *ctx, const u8 *channel_update) -{ - u16 len = tal_count(channel_update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TEMPORARY_CHANNEL_FAILURE); - towire_u16(&p, len); - towire_u8_array(&p, channel_update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_temporary_channel_failure(const tal_t *ctx, const void *p, u8 **channel_update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TEMPORARY_CHANNEL_FAILURE) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case channel_update - *channel_update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *channel_update, len); - return cursor != NULL; -} - -/* WIRE: PERMANENT_CHANNEL_FAILURE */ -u8 *towire_permanent_channel_failure(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_PERMANENT_CHANNEL_FAILURE); - - return memcheck(p, tal_count(p)); -} -bool fromwire_permanent_channel_failure(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_PERMANENT_CHANNEL_FAILURE) - return false; - return cursor != NULL; -} - -/* WIRE: REQUIRED_CHANNEL_FEATURE_MISSING */ -u8 *towire_required_channel_feature_missing(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_REQUIRED_CHANNEL_FEATURE_MISSING); - - return memcheck(p, tal_count(p)); -} -bool fromwire_required_channel_feature_missing(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_REQUIRED_CHANNEL_FEATURE_MISSING) - return false; - return cursor != NULL; -} - -/* WIRE: UNKNOWN_NEXT_PEER */ -u8 *towire_unknown_next_peer(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UNKNOWN_NEXT_PEER); - - return memcheck(p, tal_count(p)); -} -bool fromwire_unknown_next_peer(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UNKNOWN_NEXT_PEER) - return false; - return cursor != NULL; -} - -/* WIRE: AMOUNT_BELOW_MINIMUM */ -u8 *towire_amount_below_minimum(const tal_t *ctx, struct amount_msat htlc_msat, const u8 *channel_update) -{ - u16 len = tal_count(channel_update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_AMOUNT_BELOW_MINIMUM); - towire_amount_msat(&p, htlc_msat); - towire_u16(&p, len); - towire_u8_array(&p, channel_update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_amount_below_minimum(const tal_t *ctx, const void *p, struct amount_msat *htlc_msat, u8 **channel_update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_AMOUNT_BELOW_MINIMUM) - return false; - *htlc_msat = fromwire_amount_msat(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case channel_update - *channel_update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *channel_update, len); - return cursor != NULL; -} - -/* WIRE: FEE_INSUFFICIENT */ -u8 *towire_fee_insufficient(const tal_t *ctx, struct amount_msat htlc_msat, const u8 *channel_update) -{ - u16 len = tal_count(channel_update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_FEE_INSUFFICIENT); - towire_amount_msat(&p, htlc_msat); - towire_u16(&p, len); - towire_u8_array(&p, channel_update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_fee_insufficient(const tal_t *ctx, const void *p, struct amount_msat *htlc_msat, u8 **channel_update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_FEE_INSUFFICIENT) - return false; - *htlc_msat = fromwire_amount_msat(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case channel_update - *channel_update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *channel_update, len); - return cursor != NULL; -} - -/* WIRE: INCORRECT_CLTV_EXPIRY */ -u8 *towire_incorrect_cltv_expiry(const tal_t *ctx, u32 cltv_expiry, const u8 *channel_update) -{ - u16 len = tal_count(channel_update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INCORRECT_CLTV_EXPIRY); - towire_u32(&p, cltv_expiry); - towire_u16(&p, len); - towire_u8_array(&p, channel_update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_incorrect_cltv_expiry(const tal_t *ctx, const void *p, u32 *cltv_expiry, u8 **channel_update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INCORRECT_CLTV_EXPIRY) - return false; - *cltv_expiry = fromwire_u32(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case channel_update - *channel_update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *channel_update, len); - return cursor != NULL; -} - -/* WIRE: EXPIRY_TOO_SOON */ -u8 *towire_expiry_too_soon(const tal_t *ctx, const u8 *channel_update) -{ - u16 len = tal_count(channel_update); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_EXPIRY_TOO_SOON); - towire_u16(&p, len); - towire_u8_array(&p, channel_update, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_expiry_too_soon(const tal_t *ctx, const void *p, u8 **channel_update) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_EXPIRY_TOO_SOON) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case channel_update - *channel_update = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *channel_update, len); - return cursor != NULL; -} - -/* WIRE: INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS */ -u8 *towire_incorrect_or_unknown_payment_details(const tal_t *ctx, struct amount_msat htlc_msat, u32 height) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS); - towire_amount_msat(&p, htlc_msat); - towire_u32(&p, height); - - return memcheck(p, tal_count(p)); -} -bool fromwire_incorrect_or_unknown_payment_details(const void *p, struct amount_msat *htlc_msat, u32 *height) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS) - return false; - *htlc_msat = fromwire_amount_msat(&cursor, &plen); - *height = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: FINAL_INCORRECT_CLTV_EXPIRY */ -u8 *towire_final_incorrect_cltv_expiry(const tal_t *ctx, u32 cltv_expiry) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_FINAL_INCORRECT_CLTV_EXPIRY); - towire_u32(&p, cltv_expiry); - - return memcheck(p, tal_count(p)); -} -bool fromwire_final_incorrect_cltv_expiry(const void *p, u32 *cltv_expiry) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_FINAL_INCORRECT_CLTV_EXPIRY) - return false; - *cltv_expiry = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: FINAL_INCORRECT_HTLC_AMOUNT */ -u8 *towire_final_incorrect_htlc_amount(const tal_t *ctx, struct amount_msat incoming_htlc_amt) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_FINAL_INCORRECT_HTLC_AMOUNT); - towire_amount_msat(&p, incoming_htlc_amt); - - return memcheck(p, tal_count(p)); -} -bool fromwire_final_incorrect_htlc_amount(const void *p, struct amount_msat *incoming_htlc_amt) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_FINAL_INCORRECT_HTLC_AMOUNT) - return false; - *incoming_htlc_amt = fromwire_amount_msat(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNEL_DISABLED */ -u8 *towire_channel_disabled(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNEL_DISABLED); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channel_disabled(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_DISABLED) - return false; - return cursor != NULL; -} - -/* WIRE: EXPIRY_TOO_FAR */ -u8 *towire_expiry_too_far(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_EXPIRY_TOO_FAR); - - return memcheck(p, tal_count(p)); -} -bool fromwire_expiry_too_far(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_EXPIRY_TOO_FAR) - return false; - return cursor != NULL; -} - -/* WIRE: INVALID_ONION_PAYLOAD */ -u8 *towire_invalid_onion_payload(const tal_t *ctx, bigsize type, u16 offset) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INVALID_ONION_PAYLOAD); - towire_bigsize(&p, type); - towire_u16(&p, offset); - - return memcheck(p, tal_count(p)); -} -bool fromwire_invalid_onion_payload(const void *p, bigsize *type, u16 *offset) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INVALID_ONION_PAYLOAD) - return false; - *type = fromwire_bigsize(&cursor, &plen); - *offset = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: MPP_TIMEOUT */ -u8 *towire_mpp_timeout(const tal_t *ctx) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_MPP_TIMEOUT); - - return memcheck(p, tal_count(p)); -} -bool fromwire_mpp_timeout(const void *p) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_MPP_TIMEOUT) - return false; - return cursor != NULL; -} -// SHA256STAMP:dc74e1b66f37a96bed7d2ab3f5b83fdf7cbe4ee7775ebda3ee43812e75f260ba diff --git a/wire/onion_wiregen.h b/wire/onion_wiregen.h deleted file mode 100644 index 20c2d7d81..000000000 --- a/wire/onion_wiregen.h +++ /dev/null @@ -1,329 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_WIRE_ONION_WIREGEN_H -#define LIGHTNING_WIRE_ONION_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum onion_wire { - WIRE_INVALID_REALM = PERM|1, - WIRE_TEMPORARY_NODE_FAILURE = NODE|2, - WIRE_PERMANENT_NODE_FAILURE = PERM|NODE|2, - WIRE_REQUIRED_NODE_FEATURE_MISSING = PERM|NODE|3, - WIRE_INVALID_ONION_VERSION = BADONION|PERM|4, - WIRE_INVALID_ONION_HMAC = BADONION|PERM|5, - WIRE_INVALID_ONION_KEY = BADONION|PERM|6, - WIRE_TEMPORARY_CHANNEL_FAILURE = UPDATE|7, - WIRE_PERMANENT_CHANNEL_FAILURE = PERM|8, - WIRE_REQUIRED_CHANNEL_FEATURE_MISSING = PERM|9, - WIRE_UNKNOWN_NEXT_PEER = PERM|10, - WIRE_AMOUNT_BELOW_MINIMUM = UPDATE|11, - WIRE_FEE_INSUFFICIENT = UPDATE|12, - WIRE_INCORRECT_CLTV_EXPIRY = UPDATE|13, - WIRE_EXPIRY_TOO_SOON = UPDATE|14, - WIRE_INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS = PERM|15, - WIRE_FINAL_INCORRECT_CLTV_EXPIRY = 18, - WIRE_FINAL_INCORRECT_HTLC_AMOUNT = 19, - WIRE_CHANNEL_DISABLED = UPDATE|20, - WIRE_EXPIRY_TOO_FAR = 21, - WIRE_INVALID_ONION_PAYLOAD = PERM|22, - WIRE_MPP_TIMEOUT = 23, -}; - -const char *onion_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool onion_wire_is_defined(u16 type); - -struct onionmsg_path { - struct pubkey node_id; - u8 *enctlv; -}; -struct tlv_tlv_payload_payment_data { - struct secret payment_secret; - u64 total_msat; -}; -struct tlv_onionmsg_payload_reply_path { - struct pubkey first_node_id; - struct pubkey blinding; - struct onionmsg_path **path; -}; -struct tlv_onionmsg_payload_obs_reply_path { - struct pubkey blinding; - struct onionmsg_path **path; -}; -struct tlv_tlv_payload { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u64 *amt_to_forward; - u32 *outgoing_cltv_value; - struct short_channel_id *short_channel_id; - struct tlv_tlv_payload_payment_data *payment_data; -}; -struct tlv_onionmsg_payload { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_onionmsg_payload_reply_path *reply_path; - struct pubkey *obs_next_node_id; - struct short_channel_id *obs_next_short_channel_id; - struct tlv_onionmsg_payload_obs_reply_path *obs_reply_path; - u8 *enctlv; - struct pubkey *obs_blinding; - u8 *invoice_request; - u8 *invoice; - u8 *invoice_error; -}; -struct tlv_encmsg_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u8 *padding; - struct pubkey *next_node_id; - struct short_channel_id *obs_next_short_channel_id; - struct pubkey *next_blinding; - u8 *self_id; -}; - -struct tlv_tlv_payload *tlv_tlv_payload_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the tlv_payload namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using tlv_payload_is_valid. - */ -bool fromwire_tlv_payload(const u8 **cursor, size_t *max, - struct tlv_tlv_payload * record); - -/** - * Serialize a TLV stream for the tlv_payload namespace. - * - * This function only considers known fields from the tlv_payload namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `tlv_payload_is_valid`. - */ -void towire_tlv_payload(u8 **pptr, const struct tlv_tlv_payload *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool tlv_payload_is_valid(const struct tlv_tlv_payload *record, - size_t *err_index); - -#define TLVS_ARRAY_SIZE_tlv_payload 4 -extern const struct tlv_record_type tlvs_tlv_payload[]; - - - -/* Define an enum with the constants */ -enum tlv_payload_types { - TLV_TLV_PAYLOAD_AMT_TO_FORWARD = 2, - TLV_TLV_PAYLOAD_OUTGOING_CLTV_VALUE = 4, - TLV_TLV_PAYLOAD_SHORT_CHANNEL_ID = 6, - TLV_TLV_PAYLOAD_PAYMENT_DATA = 8, -}; - -struct tlv_onionmsg_payload *tlv_onionmsg_payload_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the onionmsg_payload namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using onionmsg_payload_is_valid. - */ -bool fromwire_onionmsg_payload(const u8 **cursor, size_t *max, - struct tlv_onionmsg_payload * record); - -/** - * Serialize a TLV stream for the onionmsg_payload namespace. - * - * This function only considers known fields from the onionmsg_payload namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `onionmsg_payload_is_valid`. - */ -void towire_onionmsg_payload(u8 **pptr, const struct tlv_onionmsg_payload *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool onionmsg_payload_is_valid(const struct tlv_onionmsg_payload *record, - size_t *err_index); - -struct tlv_encmsg_tlvs *tlv_encmsg_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the encmsg_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using encmsg_tlvs_is_valid. - */ -bool fromwire_encmsg_tlvs(const u8 **cursor, size_t *max, - struct tlv_encmsg_tlvs * record); - -/** - * Serialize a TLV stream for the encmsg_tlvs namespace. - * - * This function only considers known fields from the encmsg_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `encmsg_tlvs_is_valid`. - */ -void towire_encmsg_tlvs(u8 **pptr, const struct tlv_encmsg_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool encmsg_tlvs_is_valid(const struct tlv_encmsg_tlvs *record, - size_t *err_index); - -/* SUBTYPE: ONIONMSG_PATH */ -void towire_onionmsg_path(u8 **p, const struct onionmsg_path *onionmsg_path); -struct onionmsg_path *fromwire_onionmsg_path(const tal_t *ctx, const u8 **cursor, size_t *plen); - -/* WIRE: INVALID_REALM */ -u8 *towire_invalid_realm(const tal_t *ctx); -bool fromwire_invalid_realm(const void *p); - -/* WIRE: TEMPORARY_NODE_FAILURE */ -u8 *towire_temporary_node_failure(const tal_t *ctx); -bool fromwire_temporary_node_failure(const void *p); - -/* WIRE: PERMANENT_NODE_FAILURE */ -u8 *towire_permanent_node_failure(const tal_t *ctx); -bool fromwire_permanent_node_failure(const void *p); - -/* WIRE: REQUIRED_NODE_FEATURE_MISSING */ -u8 *towire_required_node_feature_missing(const tal_t *ctx); -bool fromwire_required_node_feature_missing(const void *p); - -/* WIRE: INVALID_ONION_VERSION */ -u8 *towire_invalid_onion_version(const tal_t *ctx, const struct sha256 *sha256_of_onion); -bool fromwire_invalid_onion_version(const void *p, struct sha256 *sha256_of_onion); - -/* WIRE: INVALID_ONION_HMAC */ -u8 *towire_invalid_onion_hmac(const tal_t *ctx, const struct sha256 *sha256_of_onion); -bool fromwire_invalid_onion_hmac(const void *p, struct sha256 *sha256_of_onion); - -/* WIRE: INVALID_ONION_KEY */ -u8 *towire_invalid_onion_key(const tal_t *ctx, const struct sha256 *sha256_of_onion); -bool fromwire_invalid_onion_key(const void *p, struct sha256 *sha256_of_onion); - -/* WIRE: TEMPORARY_CHANNEL_FAILURE */ -u8 *towire_temporary_channel_failure(const tal_t *ctx, const u8 *channel_update); -bool fromwire_temporary_channel_failure(const tal_t *ctx, const void *p, u8 **channel_update); - -/* WIRE: PERMANENT_CHANNEL_FAILURE */ -u8 *towire_permanent_channel_failure(const tal_t *ctx); -bool fromwire_permanent_channel_failure(const void *p); - -/* WIRE: REQUIRED_CHANNEL_FEATURE_MISSING */ -u8 *towire_required_channel_feature_missing(const tal_t *ctx); -bool fromwire_required_channel_feature_missing(const void *p); - -/* WIRE: UNKNOWN_NEXT_PEER */ -u8 *towire_unknown_next_peer(const tal_t *ctx); -bool fromwire_unknown_next_peer(const void *p); - -/* WIRE: AMOUNT_BELOW_MINIMUM */ -u8 *towire_amount_below_minimum(const tal_t *ctx, struct amount_msat htlc_msat, const u8 *channel_update); -bool fromwire_amount_below_minimum(const tal_t *ctx, const void *p, struct amount_msat *htlc_msat, u8 **channel_update); - -/* WIRE: FEE_INSUFFICIENT */ -u8 *towire_fee_insufficient(const tal_t *ctx, struct amount_msat htlc_msat, const u8 *channel_update); -bool fromwire_fee_insufficient(const tal_t *ctx, const void *p, struct amount_msat *htlc_msat, u8 **channel_update); - -/* WIRE: INCORRECT_CLTV_EXPIRY */ -u8 *towire_incorrect_cltv_expiry(const tal_t *ctx, u32 cltv_expiry, const u8 *channel_update); -bool fromwire_incorrect_cltv_expiry(const tal_t *ctx, const void *p, u32 *cltv_expiry, u8 **channel_update); - -/* WIRE: EXPIRY_TOO_SOON */ -u8 *towire_expiry_too_soon(const tal_t *ctx, const u8 *channel_update); -bool fromwire_expiry_too_soon(const tal_t *ctx, const void *p, u8 **channel_update); - -/* WIRE: INCORRECT_OR_UNKNOWN_PAYMENT_DETAILS */ -u8 *towire_incorrect_or_unknown_payment_details(const tal_t *ctx, struct amount_msat htlc_msat, u32 height); -bool fromwire_incorrect_or_unknown_payment_details(const void *p, struct amount_msat *htlc_msat, u32 *height); - -/* WIRE: FINAL_INCORRECT_CLTV_EXPIRY */ -u8 *towire_final_incorrect_cltv_expiry(const tal_t *ctx, u32 cltv_expiry); -bool fromwire_final_incorrect_cltv_expiry(const void *p, u32 *cltv_expiry); - -/* WIRE: FINAL_INCORRECT_HTLC_AMOUNT */ -u8 *towire_final_incorrect_htlc_amount(const tal_t *ctx, struct amount_msat incoming_htlc_amt); -bool fromwire_final_incorrect_htlc_amount(const void *p, struct amount_msat *incoming_htlc_amt); - -/* WIRE: CHANNEL_DISABLED */ -u8 *towire_channel_disabled(const tal_t *ctx); -bool fromwire_channel_disabled(const void *p); - -/* WIRE: EXPIRY_TOO_FAR */ -u8 *towire_expiry_too_far(const tal_t *ctx); -bool fromwire_expiry_too_far(const void *p); - -/* WIRE: INVALID_ONION_PAYLOAD */ -u8 *towire_invalid_onion_payload(const tal_t *ctx, bigsize type, u16 offset); -bool fromwire_invalid_onion_payload(const void *p, bigsize *type, u16 *offset); - -/* WIRE: MPP_TIMEOUT */ -u8 *towire_mpp_timeout(const tal_t *ctx); -bool fromwire_mpp_timeout(const void *p); - - -#endif /* LIGHTNING_WIRE_ONION_WIREGEN_H */ -// SHA256STAMP:dc74e1b66f37a96bed7d2ab3f5b83fdf7cbe4ee7775ebda3ee43812e75f260ba diff --git a/wire/peer_printgen.c b/wire/peer_printgen.c deleted file mode 100644 index f7a3c3d31..000000000 --- a/wire/peer_printgen.c +++ /dev/null @@ -1,3181 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ - -#include -#include -#include -#include -#include -#include -#include - -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_OBS_ONION_MESSAGE: - printf("WIRE_OBS_ONION_MESSAGE:\n"); - printwire_obs_onion_message("obs_onion_message", 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), ×tamp_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), ×tamp_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_obs_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_obs_onion_message_tlvs[] = { - { 2, printwire_tlv_obs_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), ×tamp); - 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), ×tamp); - 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), ×tamp_range); - if (!cursor) { - printf("**TRUNCATED**\n"); - return; - } - - - if (plen != 0) - printf("EXTRA: %s\n", tal_hexstr(NULL, cursor, plen)); -} -void printwire_obs_onion_message(const char *fieldname, const u8 *cursor) -{ - - size_t plen = tal_count(cursor); - if (fromwire_u16(&cursor, &plen) != WIRE_OBS_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("obs_onion_message_tlvs="); - printwire_tlvs(tal_fmt(NULL, "%s.obs_onion_message_tlvs", fieldname), &cursor, &plen, print_tlvs_obs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_obs_onion_message_tlvs)); - - - 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; - } - - 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; - } - 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; - } - - - 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, "obs_onion_message_tlvs") == 0) { - printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_obs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_obs_onion_message_tlvs)); - } -} -// SHA256STAMP:6c0b9a8708efecb98f258c55fb8cc46909b5cf1ea1204cf18cc7b422f3496d41 diff --git a/wire/peer_printgen.h b/wire/peer_printgen.h deleted file mode 100644 index 7e4c03fe6..000000000 --- a/wire/peer_printgen.h +++ /dev/null @@ -1,104 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Template located at tools/gen/print_header_template */ -#ifndef LIGHTNING_WIRE_PEER_PRINTGEN_H -#define LIGHTNING_WIRE_PEER_PRINTGEN_H -#include -#include - -void printpeer_wire_message(const u8 *msg); - -void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg); - -void printwire_init(const char *fieldname, const u8 *cursor); - -void printwire_error(const char *fieldname, const u8 *cursor); - -void printwire_warning(const char *fieldname, const u8 *cursor); - -void printwire_ping(const char *fieldname, const u8 *cursor); - -void printwire_pong(const char *fieldname, const u8 *cursor); - -void printwire_tx_add_input(const char *fieldname, const u8 *cursor); - -void printwire_tx_add_output(const char *fieldname, const u8 *cursor); - -void printwire_tx_remove_input(const char *fieldname, const u8 *cursor); - -void printwire_tx_remove_output(const char *fieldname, const u8 *cursor); - -void printwire_tx_complete(const char *fieldname, const u8 *cursor); - -void printwire_tx_signatures(const char *fieldname, const u8 *cursor); - -void printwire_open_channel(const char *fieldname, const u8 *cursor); - -void printwire_accept_channel(const char *fieldname, const u8 *cursor); - -void printwire_funding_created(const char *fieldname, const u8 *cursor); - -void printwire_funding_signed(const char *fieldname, const u8 *cursor); - -void printwire_funding_locked(const char *fieldname, const u8 *cursor); - -void printwire_open_channel2(const char *fieldname, const u8 *cursor); - -void printwire_accept_channel2(const char *fieldname, const u8 *cursor); - -void printwire_init_rbf(const char *fieldname, const u8 *cursor); - -void printwire_ack_rbf(const char *fieldname, const u8 *cursor); - -void printwire_shutdown(const char *fieldname, const u8 *cursor); - -void printwire_closing_signed(const char *fieldname, const u8 *cursor); - -void printwire_update_add_htlc(const char *fieldname, const u8 *cursor); - -void printwire_update_fulfill_htlc(const char *fieldname, const u8 *cursor); - -void printwire_update_fail_htlc(const char *fieldname, const u8 *cursor); - -void printwire_update_fail_malformed_htlc(const char *fieldname, const u8 *cursor); - -void printwire_commitment_signed(const char *fieldname, const u8 *cursor); - -void printwire_revoke_and_ack(const char *fieldname, const u8 *cursor); - -void printwire_update_fee(const char *fieldname, const u8 *cursor); - -void printwire_update_blockheight(const char *fieldname, const u8 *cursor); - -void printwire_channel_reestablish(const char *fieldname, const u8 *cursor); - -void printwire_announcement_signatures(const char *fieldname, const u8 *cursor); - -void printwire_channel_announcement(const char *fieldname, const u8 *cursor); - -void printwire_node_announcement(const char *fieldname, const u8 *cursor); - -void printwire_channel_update(const char *fieldname, const u8 *cursor); - -void printwire_query_short_channel_ids(const char *fieldname, const u8 *cursor); - -void printwire_reply_short_channel_ids_end(const char *fieldname, const u8 *cursor); - -void printwire_query_channel_range(const char *fieldname, const u8 *cursor); - -void printwire_reply_channel_range(const char *fieldname, const u8 *cursor); - -void printwire_gossip_timestamp_filter(const char *fieldname, const u8 *cursor); - -void printwire_obs_onion_message(const char *fieldname, const u8 *cursor); - -void printwire_onion_message(const char *fieldname, const u8 *cursor); - - -void printwire_witness_element(const char *fieldname, const u8 **cursor, size_t *plen); -void printwire_lease_rates(const char *fieldname, const u8 **cursor, size_t *plen); -void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor, size_t *plen); -void printwire_channel_update_timestamps(const char *fieldname, const u8 **cursor, size_t *plen); -void printwire_witness_stack(const char *fieldname, const u8 **cursor, size_t *plen); -#endif /* LIGHTNING_WIRE_PEER_PRINTGEN_H */ -// SHA256STAMP:6c0b9a8708efecb98f258c55fb8cc46909b5cf1ea1204cf18cc7b422f3496d41 diff --git a/wire/peer_wiregen.c b/wire/peer_wiregen.c deleted file mode 100644 index dc7f90a6c..000000000 --- a/wire/peer_wiregen.c +++ /dev/null @@ -1,2624 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the .csv file it was generated from. */ -/* Original template can be found at tools/gen/impl_template */ - -#include -#include -#include -#include -#include -#include -#include - -#ifndef SUPERVERBOSE -#define SUPERVERBOSE(...) -#endif - - -const char *peer_wire_name(int e) -{ - static char invalidbuf[sizeof("INVALID ") + STR_MAX_CHARS(e)]; - - switch ((enum peer_wire)e) { - case WIRE_INIT: return "WIRE_INIT"; - case WIRE_ERROR: return "WIRE_ERROR"; - case WIRE_WARNING: return "WIRE_WARNING"; - case WIRE_PING: return "WIRE_PING"; - case WIRE_PONG: return "WIRE_PONG"; - case WIRE_TX_ADD_INPUT: return "WIRE_TX_ADD_INPUT"; - case WIRE_TX_ADD_OUTPUT: return "WIRE_TX_ADD_OUTPUT"; - case WIRE_TX_REMOVE_INPUT: return "WIRE_TX_REMOVE_INPUT"; - case WIRE_TX_REMOVE_OUTPUT: return "WIRE_TX_REMOVE_OUTPUT"; - case WIRE_TX_COMPLETE: return "WIRE_TX_COMPLETE"; - case WIRE_TX_SIGNATURES: return "WIRE_TX_SIGNATURES"; - case WIRE_OPEN_CHANNEL: return "WIRE_OPEN_CHANNEL"; - case WIRE_ACCEPT_CHANNEL: return "WIRE_ACCEPT_CHANNEL"; - case WIRE_FUNDING_CREATED: return "WIRE_FUNDING_CREATED"; - case WIRE_FUNDING_SIGNED: return "WIRE_FUNDING_SIGNED"; - case WIRE_FUNDING_LOCKED: return "WIRE_FUNDING_LOCKED"; - case WIRE_OPEN_CHANNEL2: return "WIRE_OPEN_CHANNEL2"; - case WIRE_ACCEPT_CHANNEL2: return "WIRE_ACCEPT_CHANNEL2"; - case WIRE_INIT_RBF: return "WIRE_INIT_RBF"; - case WIRE_ACK_RBF: return "WIRE_ACK_RBF"; - case WIRE_SHUTDOWN: return "WIRE_SHUTDOWN"; - case WIRE_CLOSING_SIGNED: return "WIRE_CLOSING_SIGNED"; - case WIRE_UPDATE_ADD_HTLC: return "WIRE_UPDATE_ADD_HTLC"; - case WIRE_UPDATE_FULFILL_HTLC: return "WIRE_UPDATE_FULFILL_HTLC"; - case WIRE_UPDATE_FAIL_HTLC: return "WIRE_UPDATE_FAIL_HTLC"; - case WIRE_UPDATE_FAIL_MALFORMED_HTLC: return "WIRE_UPDATE_FAIL_MALFORMED_HTLC"; - case WIRE_COMMITMENT_SIGNED: return "WIRE_COMMITMENT_SIGNED"; - case WIRE_REVOKE_AND_ACK: return "WIRE_REVOKE_AND_ACK"; - case WIRE_UPDATE_FEE: return "WIRE_UPDATE_FEE"; - case WIRE_UPDATE_BLOCKHEIGHT: return "WIRE_UPDATE_BLOCKHEIGHT"; - case WIRE_CHANNEL_REESTABLISH: return "WIRE_CHANNEL_REESTABLISH"; - case WIRE_ANNOUNCEMENT_SIGNATURES: return "WIRE_ANNOUNCEMENT_SIGNATURES"; - case WIRE_CHANNEL_ANNOUNCEMENT: return "WIRE_CHANNEL_ANNOUNCEMENT"; - case WIRE_NODE_ANNOUNCEMENT: return "WIRE_NODE_ANNOUNCEMENT"; - case WIRE_CHANNEL_UPDATE: return "WIRE_CHANNEL_UPDATE"; - case WIRE_QUERY_SHORT_CHANNEL_IDS: return "WIRE_QUERY_SHORT_CHANNEL_IDS"; - case WIRE_REPLY_SHORT_CHANNEL_IDS_END: return "WIRE_REPLY_SHORT_CHANNEL_IDS_END"; - case WIRE_QUERY_CHANNEL_RANGE: return "WIRE_QUERY_CHANNEL_RANGE"; - case WIRE_REPLY_CHANNEL_RANGE: return "WIRE_REPLY_CHANNEL_RANGE"; - case WIRE_GOSSIP_TIMESTAMP_FILTER: return "WIRE_GOSSIP_TIMESTAMP_FILTER"; - case WIRE_OBS_ONION_MESSAGE: return "WIRE_OBS_ONION_MESSAGE"; - case WIRE_ONION_MESSAGE: return "WIRE_ONION_MESSAGE"; - } - - snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); - return invalidbuf; -} - -bool peer_wire_is_defined(u16 type) -{ - switch ((enum peer_wire)type) { - case WIRE_INIT:; - case WIRE_ERROR:; - case WIRE_WARNING:; - case WIRE_PING:; - case WIRE_PONG:; - case WIRE_TX_ADD_INPUT:; - case WIRE_TX_ADD_OUTPUT:; - case WIRE_TX_REMOVE_INPUT:; - case WIRE_TX_REMOVE_OUTPUT:; - case WIRE_TX_COMPLETE:; - case WIRE_TX_SIGNATURES:; - case WIRE_OPEN_CHANNEL:; - case WIRE_ACCEPT_CHANNEL:; - case WIRE_FUNDING_CREATED:; - case WIRE_FUNDING_SIGNED:; - case WIRE_FUNDING_LOCKED:; - case WIRE_OPEN_CHANNEL2:; - case WIRE_ACCEPT_CHANNEL2:; - case WIRE_INIT_RBF:; - case WIRE_ACK_RBF:; - case WIRE_SHUTDOWN:; - case WIRE_CLOSING_SIGNED:; - case WIRE_UPDATE_ADD_HTLC:; - case WIRE_UPDATE_FULFILL_HTLC:; - case WIRE_UPDATE_FAIL_HTLC:; - case WIRE_UPDATE_FAIL_MALFORMED_HTLC:; - case WIRE_COMMITMENT_SIGNED:; - case WIRE_REVOKE_AND_ACK:; - case WIRE_UPDATE_FEE:; - case WIRE_UPDATE_BLOCKHEIGHT:; - case WIRE_CHANNEL_REESTABLISH:; - case WIRE_ANNOUNCEMENT_SIGNATURES:; - case WIRE_CHANNEL_ANNOUNCEMENT:; - case WIRE_NODE_ANNOUNCEMENT:; - case WIRE_CHANNEL_UPDATE:; - case WIRE_QUERY_SHORT_CHANNEL_IDS:; - case WIRE_REPLY_SHORT_CHANNEL_IDS_END:; - case WIRE_QUERY_CHANNEL_RANGE:; - case WIRE_REPLY_CHANNEL_RANGE:; - case WIRE_GOSSIP_TIMESTAMP_FILTER:; - case WIRE_OBS_ONION_MESSAGE:; - case WIRE_ONION_MESSAGE:; - return true; - } - return false; -} - - - - -/* SUBTYPE: WITNESS_ELEMENT */ -void towire_witness_element(u8 **p, const struct witness_element *witness_element) -{ - u16 len = tal_count(witness_element->witness); - - towire_u16(p, len); - towire_u8_array(p, witness_element->witness, len); -} -struct witness_element * -fromwire_witness_element(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct witness_element *witness_element = tal(ctx, struct witness_element); - u16 len; - - len = fromwire_u16(cursor, plen); - witness_element->witness = tal_arr(witness_element, u8, len); -fromwire_u8_array(cursor, plen, witness_element->witness, len); - - return witness_element; -} - -/* SUBTYPE: LEASE_RATES */ -void towire_lease_rates(u8 **p, const struct lease_rates *lease_rates) -{ - - towire_u16(p, lease_rates->funding_weight); - towire_u16(p, lease_rates->lease_fee_basis); - towire_u16(p, lease_rates->channel_fee_max_proportional_thousandths); - towire_u32(p, lease_rates->lease_fee_base_sat); - towire_tu32(p, lease_rates->channel_fee_max_base_msat); -} -void fromwire_lease_rates(const u8 **cursor, size_t *plen, struct lease_rates *lease_rates) -{ - - lease_rates->funding_weight = fromwire_u16(cursor, plen); - lease_rates->lease_fee_basis = fromwire_u16(cursor, plen); - lease_rates->channel_fee_max_proportional_thousandths = fromwire_u16(cursor, plen); - lease_rates->lease_fee_base_sat = fromwire_u32(cursor, plen); - lease_rates->channel_fee_max_base_msat = fromwire_tu32(cursor, plen); -} - -/* SUBTYPE: CHANNEL_UPDATE_CHECKSUMS */ -void towire_channel_update_checksums(u8 **p, const struct channel_update_checksums *channel_update_checksums) -{ - - towire_u32(p, channel_update_checksums->checksum_node_id_1); - towire_u32(p, channel_update_checksums->checksum_node_id_2); -} -void fromwire_channel_update_checksums(const u8 **cursor, size_t *plen, struct channel_update_checksums *channel_update_checksums) -{ - - channel_update_checksums->checksum_node_id_1 = fromwire_u32(cursor, plen); - channel_update_checksums->checksum_node_id_2 = fromwire_u32(cursor, plen); -} - -/* SUBTYPE: CHANNEL_UPDATE_TIMESTAMPS */ -void towire_channel_update_timestamps(u8 **p, const struct channel_update_timestamps *channel_update_timestamps) -{ - - towire_u32(p, channel_update_timestamps->timestamp_node_id_1); - towire_u32(p, channel_update_timestamps->timestamp_node_id_2); -} -void fromwire_channel_update_timestamps(const u8 **cursor, size_t *plen, struct channel_update_timestamps *channel_update_timestamps) -{ - - channel_update_timestamps->timestamp_node_id_1 = fromwire_u32(cursor, plen); - channel_update_timestamps->timestamp_node_id_2 = fromwire_u32(cursor, plen); -} - -/* SUBTYPE: WITNESS_STACK */ -void towire_witness_stack(u8 **p, const struct witness_stack *witness_stack) -{ - u16 num_input_witness = tal_count(witness_stack->witness_element); - - towire_u16(p, num_input_witness); - for (size_t i = 0; i < num_input_witness; i++) - towire_witness_element(p, witness_stack->witness_element[i]); -} -struct witness_stack * -fromwire_witness_stack(const tal_t *ctx, const u8 **cursor, size_t *plen) -{ - struct witness_stack *witness_stack = tal(ctx, struct witness_stack); - u16 num_input_witness; - - num_input_witness = fromwire_u16(cursor, plen); - witness_stack->witness_element = num_input_witness ? tal_arr(witness_stack, struct witness_element *, 0) : NULL; - for (size_t i = 0; i < num_input_witness; i++) { - struct witness_element * tmp; - tmp = fromwire_witness_element(witness_stack, cursor, plen); - tal_arr_expand(&witness_stack->witness_element, tmp); - } - - return witness_stack; -} - - -struct tlv_init_tlvs *tlv_init_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_init_tlvs *inst = talz(ctx, struct tlv_init_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* INIT_TLVS MSG: networks */ -static u8 *towire_tlv_init_tlvs_networks(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_init_tlvs *r = vrecord; - u8 *ptr; - - if (!r->networks) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->networks); i++) - towire_bitcoin_blkid(&ptr, r->networks + i); - return ptr; -} -static void fromwire_tlv_init_tlvs_networks(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_init_tlvs *r = vrecord; - - r->networks = *plen ? tal_arr(r, struct bitcoin_blkid, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct bitcoin_blkid tmp; - fromwire_bitcoin_blkid(cursor, plen, &tmp); - tal_arr_expand(&r->networks, tmp); - } -} - -static const struct tlv_record_type tlvs_init_tlvs[] = { - { 1, towire_tlv_init_tlvs_networks, fromwire_tlv_init_tlvs_networks }, -}; - -void towire_init_tlvs(u8 **pptr, const struct tlv_init_tlvs *record) -{ - towire_tlv(pptr, tlvs_init_tlvs, 1, record); -} - - -bool fromwire_init_tlvs(const u8 **cursor, size_t *max, struct tlv_init_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_init_tlvs, 1, record, &record->fields); -} - -bool init_tlvs_is_valid(const struct tlv_init_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_n1 *tlv_n1_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_n1 *inst = talz(ctx, struct tlv_n1); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* N1 MSG: tlv1 */ -static u8 *towire_tlv_n1_tlv1(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_n1 *r = vrecord; - u8 *ptr; - - if (!r->tlv1) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->tlv1); - return ptr; -} -static void fromwire_tlv_n1_tlv1(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_n1 *r = vrecord; - - r->tlv1 = tal(r, u64); - -*r->tlv1 = fromwire_tu64(cursor, plen); -} -/* N1 MSG: tlv2 */ -static u8 *towire_tlv_n1_tlv2(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_n1 *r = vrecord; - u8 *ptr; - - if (!r->tlv2) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_short_channel_id(&ptr, r->tlv2); - return ptr; -} -static void fromwire_tlv_n1_tlv2(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_n1 *r = vrecord; - - r->tlv2 = tal(r, struct short_channel_id); - -fromwire_short_channel_id(cursor, plen, &*r->tlv2); -} -/* N1 MSG: tlv3 */ -static u8 *towire_tlv_n1_tlv3(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_n1 *r = vrecord; - u8 *ptr; - - if (!r->tlv3) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, &r->tlv3->node_id); - - towire_amount_msat(&ptr, r->tlv3->amount_msat_1); - - towire_amount_msat(&ptr, r->tlv3->amount_msat_2); - return ptr; -} -static void fromwire_tlv_n1_tlv3(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_n1 *r = vrecord; - - r->tlv3 = tal(r, struct tlv_n1_tlv3); - fromwire_pubkey(cursor, plen, &r->tlv3->node_id); - r->tlv3->amount_msat_1 = fromwire_amount_msat(cursor, plen); - r->tlv3->amount_msat_2 = fromwire_amount_msat(cursor, plen); -} -/* N1 MSG: tlv4 */ -static u8 *towire_tlv_n1_tlv4(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_n1 *r = vrecord; - u8 *ptr; - - if (!r->tlv4) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u16(&ptr, *r->tlv4); - return ptr; -} -static void fromwire_tlv_n1_tlv4(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_n1 *r = vrecord; - - r->tlv4 = tal(r, u16); - -*r->tlv4 = fromwire_u16(cursor, plen); -} - -const struct tlv_record_type tlvs_n1[] = { - { 1, towire_tlv_n1_tlv1, fromwire_tlv_n1_tlv1 }, - { 2, towire_tlv_n1_tlv2, fromwire_tlv_n1_tlv2 }, - { 3, towire_tlv_n1_tlv3, fromwire_tlv_n1_tlv3 }, - { 254, towire_tlv_n1_tlv4, fromwire_tlv_n1_tlv4 }, -}; - -void towire_n1(u8 **pptr, const struct tlv_n1 *record) -{ - towire_tlv(pptr, tlvs_n1, 4, record); -} - - -bool fromwire_n1(const u8 **cursor, size_t *max, struct tlv_n1 *record) -{ - return fromwire_tlv(cursor, max, tlvs_n1, 4, record, &record->fields); -} - -bool n1_is_valid(const struct tlv_n1 *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_n2 *tlv_n2_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_n2 *inst = talz(ctx, struct tlv_n2); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* N2 MSG: tlv1 */ -static u8 *towire_tlv_n2_tlv1(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_n2 *r = vrecord; - u8 *ptr; - - if (!r->tlv1) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu64(&ptr, *r->tlv1); - return ptr; -} -static void fromwire_tlv_n2_tlv1(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_n2 *r = vrecord; - - r->tlv1 = tal(r, u64); - -*r->tlv1 = fromwire_tu64(cursor, plen); -} -/* N2 MSG: tlv2 */ -static u8 *towire_tlv_n2_tlv2(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_n2 *r = vrecord; - u8 *ptr; - - if (!r->tlv2) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_tu32(&ptr, *r->tlv2); - return ptr; -} -static void fromwire_tlv_n2_tlv2(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_n2 *r = vrecord; - - r->tlv2 = tal(r, u32); - -*r->tlv2 = fromwire_tu32(cursor, plen); -} - -const struct tlv_record_type tlvs_n2[] = { - { 0, towire_tlv_n2_tlv1, fromwire_tlv_n2_tlv1 }, - { 11, towire_tlv_n2_tlv2, fromwire_tlv_n2_tlv2 }, -}; - -void towire_n2(u8 **pptr, const struct tlv_n2 *record) -{ - towire_tlv(pptr, tlvs_n2, 2, record); -} - - -bool fromwire_n2(const u8 **cursor, size_t *max, struct tlv_n2 *record) -{ - return fromwire_tlv(cursor, max, tlvs_n2, 2, record, &record->fields); -} - -bool n2_is_valid(const struct tlv_n2 *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_open_channel_tlvs *tlv_open_channel_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_open_channel_tlvs *inst = talz(ctx, struct tlv_open_channel_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* OPEN_CHANNEL_TLVS MSG: upfront_shutdown_script */ -static u8 *towire_tlv_open_channel_tlvs_upfront_shutdown_script(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_open_channel_tlvs *r = vrecord; - u8 *ptr; - - if (!r->upfront_shutdown_script) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->upfront_shutdown_script, tal_count(r->upfront_shutdown_script)); - return ptr; -} -static void fromwire_tlv_open_channel_tlvs_upfront_shutdown_script(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_open_channel_tlvs *r = vrecord; - - r->upfront_shutdown_script = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->upfront_shutdown_script, *plen); -} -/* OPEN_CHANNEL_TLVS MSG: channel_type */ -static u8 *towire_tlv_open_channel_tlvs_channel_type(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_open_channel_tlvs *r = vrecord; - u8 *ptr; - - if (!r->channel_type) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->channel_type, tal_count(r->channel_type)); - return ptr; -} -static void fromwire_tlv_open_channel_tlvs_channel_type(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_open_channel_tlvs *r = vrecord; - - r->channel_type = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->channel_type, *plen); -} - -static const struct tlv_record_type tlvs_open_channel_tlvs[] = { - { 0, towire_tlv_open_channel_tlvs_upfront_shutdown_script, fromwire_tlv_open_channel_tlvs_upfront_shutdown_script }, - { 1, towire_tlv_open_channel_tlvs_channel_type, fromwire_tlv_open_channel_tlvs_channel_type }, -}; - -void towire_open_channel_tlvs(u8 **pptr, const struct tlv_open_channel_tlvs *record) -{ - towire_tlv(pptr, tlvs_open_channel_tlvs, 2, record); -} - - -bool fromwire_open_channel_tlvs(const u8 **cursor, size_t *max, struct tlv_open_channel_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_open_channel_tlvs, 2, record, &record->fields); -} - -bool open_channel_tlvs_is_valid(const struct tlv_open_channel_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_accept_channel_tlvs *tlv_accept_channel_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_accept_channel_tlvs *inst = talz(ctx, struct tlv_accept_channel_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* ACCEPT_CHANNEL_TLVS MSG: upfront_shutdown_script */ -static u8 *towire_tlv_accept_channel_tlvs_upfront_shutdown_script(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_accept_channel_tlvs *r = vrecord; - u8 *ptr; - - if (!r->upfront_shutdown_script) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->upfront_shutdown_script, tal_count(r->upfront_shutdown_script)); - return ptr; -} -static void fromwire_tlv_accept_channel_tlvs_upfront_shutdown_script(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_accept_channel_tlvs *r = vrecord; - - r->upfront_shutdown_script = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->upfront_shutdown_script, *plen); -} -/* ACCEPT_CHANNEL_TLVS MSG: channel_type */ -static u8 *towire_tlv_accept_channel_tlvs_channel_type(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_accept_channel_tlvs *r = vrecord; - u8 *ptr; - - if (!r->channel_type) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8_array(&ptr, r->channel_type, tal_count(r->channel_type)); - return ptr; -} -static void fromwire_tlv_accept_channel_tlvs_channel_type(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_accept_channel_tlvs *r = vrecord; - - r->channel_type = tal_arr(r, u8, *plen); -fromwire_u8_array(cursor, plen, r->channel_type, *plen); -} - -static const struct tlv_record_type tlvs_accept_channel_tlvs[] = { - { 0, towire_tlv_accept_channel_tlvs_upfront_shutdown_script, fromwire_tlv_accept_channel_tlvs_upfront_shutdown_script }, - { 1, towire_tlv_accept_channel_tlvs_channel_type, fromwire_tlv_accept_channel_tlvs_channel_type }, -}; - -void towire_accept_channel_tlvs(u8 **pptr, const struct tlv_accept_channel_tlvs *record) -{ - towire_tlv(pptr, tlvs_accept_channel_tlvs, 2, record); -} - - -bool fromwire_accept_channel_tlvs(const u8 **cursor, size_t *max, struct tlv_accept_channel_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_accept_channel_tlvs, 2, record, &record->fields); -} - -bool accept_channel_tlvs_is_valid(const struct tlv_accept_channel_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_opening_tlvs *tlv_opening_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_opening_tlvs *inst = talz(ctx, struct tlv_opening_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* OPENING_TLVS MSG: option_upfront_shutdown_script */ -static u8 *towire_tlv_opening_tlvs_option_upfront_shutdown_script(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_opening_tlvs *r = vrecord; - u8 *ptr; - - if (!r->option_upfront_shutdown_script) - return NULL; - - u16 shutdown_len = tal_count(r->option_upfront_shutdown_script->shutdown_scriptpubkey); - - ptr = tal_arr(ctx, u8, 0); - - towire_u16(&ptr, shutdown_len); - - towire_u8_array(&ptr, r->option_upfront_shutdown_script->shutdown_scriptpubkey, shutdown_len); - return ptr; -} -static void fromwire_tlv_opening_tlvs_option_upfront_shutdown_script(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_opening_tlvs *r = vrecord; - u16 shutdown_len; - - r->option_upfront_shutdown_script = tal(r, struct tlv_opening_tlvs_option_upfront_shutdown_script); - shutdown_len = fromwire_u16(cursor, plen); - r->option_upfront_shutdown_script->shutdown_scriptpubkey = tal_arr(r->option_upfront_shutdown_script, u8, shutdown_len); -fromwire_u8_array(cursor, plen, r->option_upfront_shutdown_script->shutdown_scriptpubkey, shutdown_len); -} -/* OPENING_TLVS MSG: request_funds */ -static u8 *towire_tlv_opening_tlvs_request_funds(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_opening_tlvs *r = vrecord; - u8 *ptr; - - if (!r->request_funds) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u64(&ptr, r->request_funds->requested_sats); - - towire_u32(&ptr, r->request_funds->blockheight); - return ptr; -} -static void fromwire_tlv_opening_tlvs_request_funds(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_opening_tlvs *r = vrecord; - - r->request_funds = tal(r, struct tlv_opening_tlvs_request_funds); - r->request_funds->requested_sats = fromwire_u64(cursor, plen); - r->request_funds->blockheight = fromwire_u32(cursor, plen); -} - -static const struct tlv_record_type tlvs_opening_tlvs[] = { - { 1, towire_tlv_opening_tlvs_option_upfront_shutdown_script, fromwire_tlv_opening_tlvs_option_upfront_shutdown_script }, - { 3, towire_tlv_opening_tlvs_request_funds, fromwire_tlv_opening_tlvs_request_funds }, -}; - -void towire_opening_tlvs(u8 **pptr, const struct tlv_opening_tlvs *record) -{ - towire_tlv(pptr, tlvs_opening_tlvs, 2, record); -} - - -bool fromwire_opening_tlvs(const u8 **cursor, size_t *max, struct tlv_opening_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_opening_tlvs, 2, record, &record->fields); -} - -bool opening_tlvs_is_valid(const struct tlv_opening_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_accept_tlvs *tlv_accept_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_accept_tlvs *inst = talz(ctx, struct tlv_accept_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* ACCEPT_TLVS MSG: option_upfront_shutdown_script */ -static u8 *towire_tlv_accept_tlvs_option_upfront_shutdown_script(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_accept_tlvs *r = vrecord; - u8 *ptr; - - if (!r->option_upfront_shutdown_script) - return NULL; - - u16 shutdown_len = tal_count(r->option_upfront_shutdown_script->shutdown_scriptpubkey); - - ptr = tal_arr(ctx, u8, 0); - - towire_u16(&ptr, shutdown_len); - - towire_u8_array(&ptr, r->option_upfront_shutdown_script->shutdown_scriptpubkey, shutdown_len); - return ptr; -} -static void fromwire_tlv_accept_tlvs_option_upfront_shutdown_script(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_accept_tlvs *r = vrecord; - u16 shutdown_len; - - r->option_upfront_shutdown_script = tal(r, struct tlv_accept_tlvs_option_upfront_shutdown_script); - shutdown_len = fromwire_u16(cursor, plen); - r->option_upfront_shutdown_script->shutdown_scriptpubkey = tal_arr(r->option_upfront_shutdown_script, u8, shutdown_len); -fromwire_u8_array(cursor, plen, r->option_upfront_shutdown_script->shutdown_scriptpubkey, shutdown_len); -} -/* ACCEPT_TLVS MSG: will_fund */ -static u8 *towire_tlv_accept_tlvs_will_fund(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_accept_tlvs *r = vrecord; - u8 *ptr; - - if (!r->will_fund) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_secp256k1_ecdsa_signature(&ptr, &r->will_fund->signature); - - towire_lease_rates(&ptr, &r->will_fund->lease_rates); - return ptr; -} -static void fromwire_tlv_accept_tlvs_will_fund(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_accept_tlvs *r = vrecord; - - r->will_fund = tal(r, struct tlv_accept_tlvs_will_fund); - fromwire_secp256k1_ecdsa_signature(cursor, plen, &r->will_fund->signature); - fromwire_lease_rates(cursor, plen, &r->will_fund->lease_rates); -} - -static const struct tlv_record_type tlvs_accept_tlvs[] = { - { 1, towire_tlv_accept_tlvs_option_upfront_shutdown_script, fromwire_tlv_accept_tlvs_option_upfront_shutdown_script }, - { 2, towire_tlv_accept_tlvs_will_fund, fromwire_tlv_accept_tlvs_will_fund }, -}; - -void towire_accept_tlvs(u8 **pptr, const struct tlv_accept_tlvs *record) -{ - towire_tlv(pptr, tlvs_accept_tlvs, 2, record); -} - - -bool fromwire_accept_tlvs(const u8 **cursor, size_t *max, struct tlv_accept_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_accept_tlvs, 2, record, &record->fields); -} - -bool accept_tlvs_is_valid(const struct tlv_accept_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_shutdown_tlvs *tlv_shutdown_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_shutdown_tlvs *inst = talz(ctx, struct tlv_shutdown_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* SHUTDOWN_TLVS MSG: wrong_funding */ -static u8 *towire_tlv_shutdown_tlvs_wrong_funding(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_shutdown_tlvs *r = vrecord; - u8 *ptr; - - if (!r->wrong_funding) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_bitcoin_txid(&ptr, &r->wrong_funding->txid); - - towire_u32(&ptr, r->wrong_funding->outnum); - return ptr; -} -static void fromwire_tlv_shutdown_tlvs_wrong_funding(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_shutdown_tlvs *r = vrecord; - - r->wrong_funding = tal(r, struct tlv_shutdown_tlvs_wrong_funding); - fromwire_bitcoin_txid(cursor, plen, &r->wrong_funding->txid); - r->wrong_funding->outnum = fromwire_u32(cursor, plen); -} - -static const struct tlv_record_type tlvs_shutdown_tlvs[] = { - { 100, towire_tlv_shutdown_tlvs_wrong_funding, fromwire_tlv_shutdown_tlvs_wrong_funding }, -}; - -void towire_shutdown_tlvs(u8 **pptr, const struct tlv_shutdown_tlvs *record) -{ - towire_tlv(pptr, tlvs_shutdown_tlvs, 1, record); -} - - -bool fromwire_shutdown_tlvs(const u8 **cursor, size_t *max, struct tlv_shutdown_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_shutdown_tlvs, 1, record, &record->fields); -} - -bool shutdown_tlvs_is_valid(const struct tlv_shutdown_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_closing_signed_tlvs *tlv_closing_signed_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_closing_signed_tlvs *inst = talz(ctx, struct tlv_closing_signed_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* CLOSING_SIGNED_TLVS MSG: fee_range */ -static u8 *towire_tlv_closing_signed_tlvs_fee_range(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_closing_signed_tlvs *r = vrecord; - u8 *ptr; - - if (!r->fee_range) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_amount_sat(&ptr, r->fee_range->min_fee_satoshis); - - towire_amount_sat(&ptr, r->fee_range->max_fee_satoshis); - return ptr; -} -static void fromwire_tlv_closing_signed_tlvs_fee_range(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_closing_signed_tlvs *r = vrecord; - - r->fee_range = tal(r, struct tlv_closing_signed_tlvs_fee_range); - r->fee_range->min_fee_satoshis = fromwire_amount_sat(cursor, plen); - r->fee_range->max_fee_satoshis = fromwire_amount_sat(cursor, plen); -} - -static const struct tlv_record_type tlvs_closing_signed_tlvs[] = { - { 1, towire_tlv_closing_signed_tlvs_fee_range, fromwire_tlv_closing_signed_tlvs_fee_range }, -}; - -void towire_closing_signed_tlvs(u8 **pptr, const struct tlv_closing_signed_tlvs *record) -{ - towire_tlv(pptr, tlvs_closing_signed_tlvs, 1, record); -} - - -bool fromwire_closing_signed_tlvs(const u8 **cursor, size_t *max, struct tlv_closing_signed_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_closing_signed_tlvs, 1, record, &record->fields); -} - -bool closing_signed_tlvs_is_valid(const struct tlv_closing_signed_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_node_ann_tlvs *tlv_node_ann_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_node_ann_tlvs *inst = talz(ctx, struct tlv_node_ann_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* NODE_ANN_TLVS MSG: option_will_fund */ -static u8 *towire_tlv_node_ann_tlvs_option_will_fund(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_node_ann_tlvs *r = vrecord; - u8 *ptr; - - if (!r->option_will_fund) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_lease_rates(&ptr, r->option_will_fund); - return ptr; -} -static void fromwire_tlv_node_ann_tlvs_option_will_fund(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_node_ann_tlvs *r = vrecord; - - r->option_will_fund = tal(r, struct lease_rates); - -fromwire_lease_rates(cursor, plen, &*r->option_will_fund); -} - -static const struct tlv_record_type tlvs_node_ann_tlvs[] = { - { 1, towire_tlv_node_ann_tlvs_option_will_fund, fromwire_tlv_node_ann_tlvs_option_will_fund }, -}; - -void towire_node_ann_tlvs(u8 **pptr, const struct tlv_node_ann_tlvs *record) -{ - towire_tlv(pptr, tlvs_node_ann_tlvs, 1, record); -} - - -bool fromwire_node_ann_tlvs(const u8 **cursor, size_t *max, struct tlv_node_ann_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_node_ann_tlvs, 1, record, &record->fields); -} - -bool node_ann_tlvs_is_valid(const struct tlv_node_ann_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_query_short_channel_ids_tlvs *tlv_query_short_channel_ids_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_query_short_channel_ids_tlvs *inst = talz(ctx, struct tlv_query_short_channel_ids_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* QUERY_SHORT_CHANNEL_IDS_TLVS MSG: query_flags */ -static u8 *towire_tlv_query_short_channel_ids_tlvs_query_flags(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_query_short_channel_ids_tlvs *r = vrecord; - u8 *ptr; - - if (!r->query_flags) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8(&ptr, r->query_flags->encoding_type); - - towire_u8_array(&ptr, r->query_flags->encoded_query_flags, tal_count(r->query_flags->encoded_query_flags)); - return ptr; -} -static void fromwire_tlv_query_short_channel_ids_tlvs_query_flags(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_query_short_channel_ids_tlvs *r = vrecord; - - r->query_flags = tal(r, struct tlv_query_short_channel_ids_tlvs_query_flags); - r->query_flags->encoding_type = fromwire_u8(cursor, plen); - r->query_flags->encoded_query_flags = tal_arr(r->query_flags, u8, *plen); -fromwire_u8_array(cursor, plen, r->query_flags->encoded_query_flags, *plen); -} - -static const struct tlv_record_type tlvs_query_short_channel_ids_tlvs[] = { - { 1, towire_tlv_query_short_channel_ids_tlvs_query_flags, fromwire_tlv_query_short_channel_ids_tlvs_query_flags }, -}; - -void towire_query_short_channel_ids_tlvs(u8 **pptr, const struct tlv_query_short_channel_ids_tlvs *record) -{ - towire_tlv(pptr, tlvs_query_short_channel_ids_tlvs, 1, record); -} - - -bool fromwire_query_short_channel_ids_tlvs(const u8 **cursor, size_t *max, struct tlv_query_short_channel_ids_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_query_short_channel_ids_tlvs, 1, record, &record->fields); -} - -bool query_short_channel_ids_tlvs_is_valid(const struct tlv_query_short_channel_ids_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_query_channel_range_tlvs *tlv_query_channel_range_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_query_channel_range_tlvs *inst = talz(ctx, struct tlv_query_channel_range_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* QUERY_CHANNEL_RANGE_TLVS MSG: query_option */ -static u8 *towire_tlv_query_channel_range_tlvs_query_option(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_query_channel_range_tlvs *r = vrecord; - u8 *ptr; - - if (!r->query_option) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_bigsize(&ptr, *r->query_option); - return ptr; -} -static void fromwire_tlv_query_channel_range_tlvs_query_option(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_query_channel_range_tlvs *r = vrecord; - - r->query_option = tal(r, bigsize); - -*r->query_option = fromwire_bigsize(cursor, plen); -} - -static const struct tlv_record_type tlvs_query_channel_range_tlvs[] = { - { 1, towire_tlv_query_channel_range_tlvs_query_option, fromwire_tlv_query_channel_range_tlvs_query_option }, -}; - -void towire_query_channel_range_tlvs(u8 **pptr, const struct tlv_query_channel_range_tlvs *record) -{ - towire_tlv(pptr, tlvs_query_channel_range_tlvs, 1, record); -} - - -bool fromwire_query_channel_range_tlvs(const u8 **cursor, size_t *max, struct tlv_query_channel_range_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_query_channel_range_tlvs, 1, record, &record->fields); -} - -bool query_channel_range_tlvs_is_valid(const struct tlv_query_channel_range_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_reply_channel_range_tlvs *tlv_reply_channel_range_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_reply_channel_range_tlvs *inst = talz(ctx, struct tlv_reply_channel_range_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* REPLY_CHANNEL_RANGE_TLVS MSG: timestamps_tlv */ -static u8 *towire_tlv_reply_channel_range_tlvs_timestamps_tlv(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_reply_channel_range_tlvs *r = vrecord; - u8 *ptr; - - if (!r->timestamps_tlv) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_u8(&ptr, r->timestamps_tlv->encoding_type); - - towire_u8_array(&ptr, r->timestamps_tlv->encoded_timestamps, tal_count(r->timestamps_tlv->encoded_timestamps)); - return ptr; -} -static void fromwire_tlv_reply_channel_range_tlvs_timestamps_tlv(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_reply_channel_range_tlvs *r = vrecord; - - r->timestamps_tlv = tal(r, struct tlv_reply_channel_range_tlvs_timestamps_tlv); - r->timestamps_tlv->encoding_type = fromwire_u8(cursor, plen); - r->timestamps_tlv->encoded_timestamps = tal_arr(r->timestamps_tlv, u8, *plen); -fromwire_u8_array(cursor, plen, r->timestamps_tlv->encoded_timestamps, *plen); -} -/* REPLY_CHANNEL_RANGE_TLVS MSG: checksums_tlv */ -static u8 *towire_tlv_reply_channel_range_tlvs_checksums_tlv(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_reply_channel_range_tlvs *r = vrecord; - u8 *ptr; - - if (!r->checksums_tlv) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - for (size_t i = 0; i < tal_count(r->checksums_tlv); i++) - towire_channel_update_checksums(&ptr, r->checksums_tlv + i); - return ptr; -} -static void fromwire_tlv_reply_channel_range_tlvs_checksums_tlv(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_reply_channel_range_tlvs *r = vrecord; - - r->checksums_tlv = *plen ? tal_arr(r, struct channel_update_checksums, 0) : NULL; - for (size_t i = 0; *plen != 0; i++) { - struct channel_update_checksums tmp; - fromwire_channel_update_checksums(cursor, plen, &tmp); - tal_arr_expand(&r->checksums_tlv, tmp); - } -} - -static const struct tlv_record_type tlvs_reply_channel_range_tlvs[] = { - { 1, towire_tlv_reply_channel_range_tlvs_timestamps_tlv, fromwire_tlv_reply_channel_range_tlvs_timestamps_tlv }, - { 3, towire_tlv_reply_channel_range_tlvs_checksums_tlv, fromwire_tlv_reply_channel_range_tlvs_checksums_tlv }, -}; - -void towire_reply_channel_range_tlvs(u8 **pptr, const struct tlv_reply_channel_range_tlvs *record) -{ - towire_tlv(pptr, tlvs_reply_channel_range_tlvs, 2, record); -} - - -bool fromwire_reply_channel_range_tlvs(const u8 **cursor, size_t *max, struct tlv_reply_channel_range_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_reply_channel_range_tlvs, 2, record, &record->fields); -} - -bool reply_channel_range_tlvs_is_valid(const struct tlv_reply_channel_range_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -struct tlv_obs_onion_message_tlvs *tlv_obs_onion_message_tlvs_new(const tal_t *ctx) -{ - /* Initialize everything to NULL. (Quiet, C pedants!) */ - struct tlv_obs_onion_message_tlvs *inst = talz(ctx, struct tlv_obs_onion_message_tlvs); - - /* Initialized the fields to an empty array. */ - inst->fields = tal_arr(inst, struct tlv_field, 0); - return inst; -} - -/* OBS_ONION_MESSAGE_TLVS MSG: blinding */ -static u8 *towire_tlv_obs_onion_message_tlvs_blinding(const tal_t *ctx, const void *vrecord) -{ - const struct tlv_obs_onion_message_tlvs *r = vrecord; - u8 *ptr; - - if (!r->blinding) - return NULL; - - - ptr = tal_arr(ctx, u8, 0); - - towire_pubkey(&ptr, r->blinding); - return ptr; -} -static void fromwire_tlv_obs_onion_message_tlvs_blinding(const u8 **cursor, size_t *plen, void *vrecord) -{ - struct tlv_obs_onion_message_tlvs *r = vrecord; - - r->blinding = tal(r, struct pubkey); - -fromwire_pubkey(cursor, plen, &*r->blinding); -} - -static const struct tlv_record_type tlvs_obs_onion_message_tlvs[] = { - { 2, towire_tlv_obs_onion_message_tlvs_blinding, fromwire_tlv_obs_onion_message_tlvs_blinding }, -}; - -void towire_obs_onion_message_tlvs(u8 **pptr, const struct tlv_obs_onion_message_tlvs *record) -{ - towire_tlv(pptr, tlvs_obs_onion_message_tlvs, 1, record); -} - - -bool fromwire_obs_onion_message_tlvs(const u8 **cursor, size_t *max, struct tlv_obs_onion_message_tlvs *record) -{ - return fromwire_tlv(cursor, max, tlvs_obs_onion_message_tlvs, 1, record, &record->fields); -} - -bool obs_onion_message_tlvs_is_valid(const struct tlv_obs_onion_message_tlvs *record, size_t *err_index) -{ - return tlv_fields_valid(record->fields, NULL, err_index); -} - - -/* WIRE: INIT */ -u8 *towire_init(const tal_t *ctx, const u8 *globalfeatures, const u8 *features, const struct tlv_init_tlvs *tlvs) -{ - u16 gflen = tal_count(globalfeatures); - u16 flen = tal_count(features); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INIT); - towire_u16(&p, gflen); - towire_u8_array(&p, globalfeatures, gflen); - towire_u16(&p, flen); - towire_u8_array(&p, features, flen); - towire_init_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_init(const tal_t *ctx, const void *p, u8 **globalfeatures, u8 **features, struct tlv_init_tlvs *tlvs) -{ - u16 gflen; - u16 flen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INIT) - return false; - gflen = fromwire_u16(&cursor, &plen); - // 2nd case globalfeatures - *globalfeatures = gflen ? tal_arr(ctx, u8, gflen) : NULL; - fromwire_u8_array(&cursor, &plen, *globalfeatures, gflen); - flen = fromwire_u16(&cursor, &plen); - // 2nd case features - *features = flen ? tal_arr(ctx, u8, flen) : NULL; - fromwire_u8_array(&cursor, &plen, *features, flen); - fromwire_init_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: ERROR */ -u8 *towire_error(const tal_t *ctx, const struct channel_id *channel_id, const u8 *data) -{ - u16 len = tal_count(data); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ERROR); - towire_channel_id(&p, channel_id); - towire_u16(&p, len); - towire_u8_array(&p, data, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_error(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **data) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ERROR) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - len = fromwire_u16(&cursor, &plen); - // 2nd case data - *data = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *data, len); - return cursor != NULL; -} - -/* WIRE: WARNING */ -u8 *towire_warning(const tal_t *ctx, const struct channel_id *channel_id, const u8 *data) -{ - u16 len = tal_count(data); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_WARNING); - towire_channel_id(&p, channel_id); - towire_u16(&p, len); - towire_u8_array(&p, data, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_warning(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **data) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_WARNING) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - len = fromwire_u16(&cursor, &plen); - // 2nd case data - *data = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *data, len); - return cursor != NULL; -} - -/* WIRE: PING */ -u8 *towire_ping(const tal_t *ctx, u16 num_pong_bytes, const u8 *ignored) -{ - u16 byteslen = tal_count(ignored); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_PING); - towire_u16(&p, num_pong_bytes); - towire_u16(&p, byteslen); - towire_u8_array(&p, ignored, byteslen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_ping(const tal_t *ctx, const void *p, u16 *num_pong_bytes, u8 **ignored) -{ - u16 byteslen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_PING) - return false; - *num_pong_bytes = fromwire_u16(&cursor, &plen); - byteslen = fromwire_u16(&cursor, &plen); - // 2nd case ignored - *ignored = byteslen ? tal_arr(ctx, u8, byteslen) : NULL; - fromwire_u8_array(&cursor, &plen, *ignored, byteslen); - return cursor != NULL; -} - -/* WIRE: PONG */ -u8 *towire_pong(const tal_t *ctx, const u8 *ignored) -{ - u16 byteslen = tal_count(ignored); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_PONG); - towire_u16(&p, byteslen); - towire_u8_array(&p, ignored, byteslen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_pong(const tal_t *ctx, const void *p, u8 **ignored) -{ - u16 byteslen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_PONG) - return false; - byteslen = fromwire_u16(&cursor, &plen); - // 2nd case ignored - *ignored = byteslen ? tal_arr(ctx, u8, byteslen) : NULL; - fromwire_u8_array(&cursor, &plen, *ignored, byteslen); - return cursor != NULL; -} - -/* WIRE: TX_ADD_INPUT */ -u8 *towire_tx_add_input(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id, const u8 *prevtx, u32 prevtx_vout, u32 sequence, const u8 *script_sig) -{ - u16 prevtx_len = tal_count(prevtx); - u16 script_sig_len = tal_count(script_sig); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TX_ADD_INPUT); - towire_channel_id(&p, channel_id); - towire_u64(&p, serial_id); - towire_u16(&p, prevtx_len); - towire_u8_array(&p, prevtx, prevtx_len); - towire_u32(&p, prevtx_vout); - towire_u32(&p, sequence); - towire_u16(&p, script_sig_len); - towire_u8_array(&p, script_sig, script_sig_len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_tx_add_input(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *serial_id, u8 **prevtx, u32 *prevtx_vout, u32 *sequence, u8 **script_sig) -{ - u16 prevtx_len; - u16 script_sig_len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TX_ADD_INPUT) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *serial_id = fromwire_u64(&cursor, &plen); - prevtx_len = fromwire_u16(&cursor, &plen); - // 2nd case prevtx - *prevtx = prevtx_len ? tal_arr(ctx, u8, prevtx_len) : NULL; - fromwire_u8_array(&cursor, &plen, *prevtx, prevtx_len); - *prevtx_vout = fromwire_u32(&cursor, &plen); - *sequence = fromwire_u32(&cursor, &plen); - script_sig_len = fromwire_u16(&cursor, &plen); - // 2nd case script_sig - *script_sig = script_sig_len ? tal_arr(ctx, u8, script_sig_len) : NULL; - fromwire_u8_array(&cursor, &plen, *script_sig, script_sig_len); - return cursor != NULL; -} - -/* WIRE: TX_ADD_OUTPUT */ -u8 *towire_tx_add_output(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id, u64 sats, const u8 *script) -{ - u16 scriptlen = tal_count(script); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TX_ADD_OUTPUT); - towire_channel_id(&p, channel_id); - towire_u64(&p, serial_id); - towire_u64(&p, sats); - towire_u16(&p, scriptlen); - towire_u8_array(&p, script, scriptlen); - - return memcheck(p, tal_count(p)); -} -bool fromwire_tx_add_output(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *serial_id, u64 *sats, u8 **script) -{ - u16 scriptlen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TX_ADD_OUTPUT) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *serial_id = fromwire_u64(&cursor, &plen); - *sats = fromwire_u64(&cursor, &plen); - scriptlen = fromwire_u16(&cursor, &plen); - // 2nd case script - *script = scriptlen ? tal_arr(ctx, u8, scriptlen) : NULL; - fromwire_u8_array(&cursor, &plen, *script, scriptlen); - return cursor != NULL; -} - -/* WIRE: TX_REMOVE_INPUT */ -u8 *towire_tx_remove_input(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TX_REMOVE_INPUT); - towire_channel_id(&p, channel_id); - towire_u64(&p, serial_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_tx_remove_input(const void *p, struct channel_id *channel_id, u64 *serial_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TX_REMOVE_INPUT) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *serial_id = fromwire_u64(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: TX_REMOVE_OUTPUT */ -u8 *towire_tx_remove_output(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TX_REMOVE_OUTPUT); - towire_channel_id(&p, channel_id); - towire_u64(&p, serial_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_tx_remove_output(const void *p, struct channel_id *channel_id, u64 *serial_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TX_REMOVE_OUTPUT) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *serial_id = fromwire_u64(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: TX_COMPLETE */ -u8 *towire_tx_complete(const tal_t *ctx, const struct channel_id *channel_id) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TX_COMPLETE); - towire_channel_id(&p, channel_id); - - return memcheck(p, tal_count(p)); -} -bool fromwire_tx_complete(const void *p, struct channel_id *channel_id) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TX_COMPLETE) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - return cursor != NULL; -} - -/* WIRE: TX_SIGNATURES */ -u8 *towire_tx_signatures(const tal_t *ctx, const struct channel_id *channel_id, const struct bitcoin_txid *txid, const struct witness_stack **witness_stack) -{ - u16 num_witnesses = tal_count(witness_stack); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_TX_SIGNATURES); - towire_channel_id(&p, channel_id); - towire_bitcoin_txid(&p, txid); - towire_u16(&p, num_witnesses); - for (size_t i = 0; i < num_witnesses; i++) - towire_witness_stack(&p, witness_stack[i]); - - return memcheck(p, tal_count(p)); -} -bool fromwire_tx_signatures(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct bitcoin_txid *txid, struct witness_stack ***witness_stack) -{ - u16 num_witnesses; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_TX_SIGNATURES) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_bitcoin_txid(&cursor, &plen, txid); - num_witnesses = fromwire_u16(&cursor, &plen); - // 2nd case witness_stack - *witness_stack = num_witnesses ? tal_arr(ctx, struct witness_stack *, num_witnesses) : NULL; - for (size_t i = 0; i < num_witnesses; i++) - (*witness_stack)[i] = fromwire_witness_stack(*witness_stack, &cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OPEN_CHANNEL */ -u8 *towire_open_channel(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, const struct channel_id *temporary_channel_id, struct amount_sat funding_satoshis, struct amount_msat push_msat, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_sat channel_reserve_satoshis, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw, u16 to_self_delay, u16 max_accepted_htlcs, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, u8 channel_flags, const struct tlv_open_channel_tlvs *tlvs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPEN_CHANNEL); - towire_bitcoin_blkid(&p, chain_hash); - towire_channel_id(&p, temporary_channel_id); - towire_amount_sat(&p, funding_satoshis); - towire_amount_msat(&p, push_msat); - towire_amount_sat(&p, dust_limit_satoshis); - towire_amount_msat(&p, max_htlc_value_in_flight_msat); - towire_amount_sat(&p, channel_reserve_satoshis); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, feerate_per_kw); - towire_u16(&p, to_self_delay); - towire_u16(&p, max_accepted_htlcs); - towire_pubkey(&p, funding_pubkey); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, first_per_commitment_point); - towire_u8(&p, channel_flags); - towire_open_channel_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_open_channel(const void *p, struct bitcoin_blkid *chain_hash, struct channel_id *temporary_channel_id, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_sat *channel_reserve_satoshis, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw, u16 *to_self_delay, u16 *max_accepted_htlcs, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, u8 *channel_flags, struct tlv_open_channel_tlvs *tlvs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPEN_CHANNEL) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - fromwire_channel_id(&cursor, &plen, temporary_channel_id); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *push_msat = fromwire_amount_msat(&cursor, &plen); - *dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen); - *max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen); - *channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - *to_self_delay = fromwire_u16(&cursor, &plen); - *max_accepted_htlcs = fromwire_u16(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, funding_pubkey); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, first_per_commitment_point); - *channel_flags = fromwire_u8(&cursor, &plen); - fromwire_open_channel_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: ACCEPT_CHANNEL */ -u8 *towire_accept_channel(const tal_t *ctx, const struct channel_id *temporary_channel_id, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_sat channel_reserve_satoshis, struct amount_msat htlc_minimum_msat, u32 minimum_depth, u16 to_self_delay, u16 max_accepted_htlcs, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, const struct tlv_accept_channel_tlvs *tlvs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ACCEPT_CHANNEL); - towire_channel_id(&p, temporary_channel_id); - towire_amount_sat(&p, dust_limit_satoshis); - towire_amount_msat(&p, max_htlc_value_in_flight_msat); - towire_amount_sat(&p, channel_reserve_satoshis); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, minimum_depth); - towire_u16(&p, to_self_delay); - towire_u16(&p, max_accepted_htlcs); - towire_pubkey(&p, funding_pubkey); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, first_per_commitment_point); - towire_accept_channel_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_accept_channel(const void *p, struct channel_id *temporary_channel_id, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_sat *channel_reserve_satoshis, struct amount_msat *htlc_minimum_msat, u32 *minimum_depth, u16 *to_self_delay, u16 *max_accepted_htlcs, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, struct tlv_accept_channel_tlvs *tlvs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ACCEPT_CHANNEL) - return false; - fromwire_channel_id(&cursor, &plen, temporary_channel_id); - *dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen); - *max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen); - *channel_reserve_satoshis = fromwire_amount_sat(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *minimum_depth = fromwire_u32(&cursor, &plen); - *to_self_delay = fromwire_u16(&cursor, &plen); - *max_accepted_htlcs = fromwire_u16(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, funding_pubkey); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, first_per_commitment_point); - fromwire_accept_channel_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: FUNDING_CREATED */ -u8 *towire_funding_created(const tal_t *ctx, const struct channel_id *temporary_channel_id, const struct bitcoin_txid *funding_txid, u16 funding_output_index, const secp256k1_ecdsa_signature *signature) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_FUNDING_CREATED); - towire_channel_id(&p, temporary_channel_id); - towire_bitcoin_txid(&p, funding_txid); - towire_u16(&p, funding_output_index); - towire_secp256k1_ecdsa_signature(&p, signature); - - return memcheck(p, tal_count(p)); -} -bool fromwire_funding_created(const void *p, struct channel_id *temporary_channel_id, struct bitcoin_txid *funding_txid, u16 *funding_output_index, secp256k1_ecdsa_signature *signature) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_FUNDING_CREATED) - return false; - fromwire_channel_id(&cursor, &plen, temporary_channel_id); - fromwire_bitcoin_txid(&cursor, &plen, funding_txid); - *funding_output_index = fromwire_u16(&cursor, &plen); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - return cursor != NULL; -} - -/* WIRE: FUNDING_SIGNED */ -u8 *towire_funding_signed(const tal_t *ctx, const struct channel_id *channel_id, const secp256k1_ecdsa_signature *signature) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_FUNDING_SIGNED); - towire_channel_id(&p, channel_id); - towire_secp256k1_ecdsa_signature(&p, signature); - - return memcheck(p, tal_count(p)); -} -bool fromwire_funding_signed(const void *p, struct channel_id *channel_id, secp256k1_ecdsa_signature *signature) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_FUNDING_SIGNED) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - return cursor != NULL; -} - -/* WIRE: FUNDING_LOCKED */ -u8 *towire_funding_locked(const tal_t *ctx, const struct channel_id *channel_id, const struct pubkey *next_per_commitment_point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_FUNDING_LOCKED); - towire_channel_id(&p, channel_id); - towire_pubkey(&p, next_per_commitment_point); - - return memcheck(p, tal_count(p)); -} -bool fromwire_funding_locked(const void *p, struct channel_id *channel_id, struct pubkey *next_per_commitment_point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_FUNDING_LOCKED) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_pubkey(&cursor, &plen, next_per_commitment_point); - return cursor != NULL; -} - -/* WIRE: OPEN_CHANNEL2 */ -u8 *towire_open_channel2(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, const struct channel_id *channel_id, u32 funding_feerate_perkw, u32 commitment_feerate_perkw, struct amount_sat funding_satoshis, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u16 to_self_delay, u16 max_accepted_htlcs, u32 locktime, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, u8 channel_flags, const struct tlv_opening_tlvs *tlvs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OPEN_CHANNEL2); - towire_bitcoin_blkid(&p, chain_hash); - towire_channel_id(&p, channel_id); - towire_u32(&p, funding_feerate_perkw); - towire_u32(&p, commitment_feerate_perkw); - towire_amount_sat(&p, funding_satoshis); - towire_amount_sat(&p, dust_limit_satoshis); - towire_amount_msat(&p, max_htlc_value_in_flight_msat); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u16(&p, to_self_delay); - towire_u16(&p, max_accepted_htlcs); - towire_u32(&p, locktime); - towire_pubkey(&p, funding_pubkey); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, first_per_commitment_point); - towire_u8(&p, channel_flags); - towire_opening_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_open_channel2(const void *p, struct bitcoin_blkid *chain_hash, struct channel_id *channel_id, u32 *funding_feerate_perkw, u32 *commitment_feerate_perkw, struct amount_sat *funding_satoshis, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u16 *to_self_delay, u16 *max_accepted_htlcs, u32 *locktime, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, u8 *channel_flags, struct tlv_opening_tlvs *tlvs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OPEN_CHANNEL2) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - fromwire_channel_id(&cursor, &plen, channel_id); - *funding_feerate_perkw = fromwire_u32(&cursor, &plen); - *commitment_feerate_perkw = fromwire_u32(&cursor, &plen); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen); - *max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *to_self_delay = fromwire_u16(&cursor, &plen); - *max_accepted_htlcs = fromwire_u16(&cursor, &plen); - *locktime = fromwire_u32(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, funding_pubkey); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, first_per_commitment_point); - *channel_flags = fromwire_u8(&cursor, &plen); - fromwire_opening_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: ACCEPT_CHANNEL2 */ -u8 *towire_accept_channel2(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat funding_satoshis, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 minimum_depth, u16 to_self_delay, u16 max_accepted_htlcs, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, const struct tlv_accept_tlvs *tlvs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ACCEPT_CHANNEL2); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, funding_satoshis); - towire_amount_sat(&p, dust_limit_satoshis); - towire_amount_msat(&p, max_htlc_value_in_flight_msat); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, minimum_depth); - towire_u16(&p, to_self_delay); - towire_u16(&p, max_accepted_htlcs); - towire_pubkey(&p, funding_pubkey); - towire_pubkey(&p, revocation_basepoint); - towire_pubkey(&p, payment_basepoint); - towire_pubkey(&p, delayed_payment_basepoint); - towire_pubkey(&p, htlc_basepoint); - towire_pubkey(&p, first_per_commitment_point); - towire_accept_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_accept_channel2(const void *p, struct channel_id *channel_id, struct amount_sat *funding_satoshis, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *minimum_depth, u16 *to_self_delay, u16 *max_accepted_htlcs, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, struct tlv_accept_tlvs *tlvs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ACCEPT_CHANNEL2) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *dust_limit_satoshis = fromwire_amount_sat(&cursor, &plen); - *max_htlc_value_in_flight_msat = fromwire_amount_msat(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *minimum_depth = fromwire_u32(&cursor, &plen); - *to_self_delay = fromwire_u16(&cursor, &plen); - *max_accepted_htlcs = fromwire_u16(&cursor, &plen); - fromwire_pubkey(&cursor, &plen, funding_pubkey); - fromwire_pubkey(&cursor, &plen, revocation_basepoint); - fromwire_pubkey(&cursor, &plen, payment_basepoint); - fromwire_pubkey(&cursor, &plen, delayed_payment_basepoint); - fromwire_pubkey(&cursor, &plen, htlc_basepoint); - fromwire_pubkey(&cursor, &plen, first_per_commitment_point); - fromwire_accept_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: INIT_RBF */ -u8 *towire_init_rbf(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat funding_satoshis, u32 locktime, u32 funding_feerate_perkw) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_INIT_RBF); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, funding_satoshis); - towire_u32(&p, locktime); - towire_u32(&p, funding_feerate_perkw); - - return memcheck(p, tal_count(p)); -} -bool fromwire_init_rbf(const void *p, struct channel_id *channel_id, struct amount_sat *funding_satoshis, u32 *locktime, u32 *funding_feerate_perkw) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_INIT_RBF) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - *locktime = fromwire_u32(&cursor, &plen); - *funding_feerate_perkw = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: ACK_RBF */ -u8 *towire_ack_rbf(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat funding_satoshis) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ACK_RBF); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, funding_satoshis); - - return memcheck(p, tal_count(p)); -} -bool fromwire_ack_rbf(const void *p, struct channel_id *channel_id, struct amount_sat *funding_satoshis) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ACK_RBF) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *funding_satoshis = fromwire_amount_sat(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: SHUTDOWN */ -u8 *towire_shutdown(const tal_t *ctx, const struct channel_id *channel_id, const u8 *scriptpubkey, const struct tlv_shutdown_tlvs *tlvs) -{ - u16 len = tal_count(scriptpubkey); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_SHUTDOWN); - towire_channel_id(&p, channel_id); - towire_u16(&p, len); - towire_u8_array(&p, scriptpubkey, len); - towire_shutdown_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_shutdown(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **scriptpubkey, struct tlv_shutdown_tlvs *tlvs) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_SHUTDOWN) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - len = fromwire_u16(&cursor, &plen); - // 2nd case scriptpubkey - *scriptpubkey = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *scriptpubkey, len); - fromwire_shutdown_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: CLOSING_SIGNED */ -u8 *towire_closing_signed(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat fee_satoshis, const secp256k1_ecdsa_signature *signature, const struct tlv_closing_signed_tlvs *tlvs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CLOSING_SIGNED); - towire_channel_id(&p, channel_id); - towire_amount_sat(&p, fee_satoshis); - towire_secp256k1_ecdsa_signature(&p, signature); - towire_closing_signed_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_closing_signed(const void *p, struct channel_id *channel_id, struct amount_sat *fee_satoshis, secp256k1_ecdsa_signature *signature, struct tlv_closing_signed_tlvs *tlvs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CLOSING_SIGNED) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *fee_satoshis = fromwire_amount_sat(&cursor, &plen); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - fromwire_closing_signed_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: UPDATE_ADD_HTLC */ -u8 *towire_update_add_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, struct amount_msat amount_msat, const struct sha256 *payment_hash, u32 cltv_expiry, const u8 onion_routing_packet[1366]) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UPDATE_ADD_HTLC); - towire_channel_id(&p, channel_id); - towire_u64(&p, id); - towire_amount_msat(&p, amount_msat); - towire_sha256(&p, payment_hash); - towire_u32(&p, cltv_expiry); - towire_u8_array(&p, onion_routing_packet, 1366); - - return memcheck(p, tal_count(p)); -} -bool fromwire_update_add_htlc(const void *p, struct channel_id *channel_id, u64 *id, struct amount_msat *amount_msat, struct sha256 *payment_hash, u32 *cltv_expiry, u8 onion_routing_packet[1366]) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_ADD_HTLC) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *id = fromwire_u64(&cursor, &plen); - *amount_msat = fromwire_amount_msat(&cursor, &plen); - fromwire_sha256(&cursor, &plen, payment_hash); - *cltv_expiry = fromwire_u32(&cursor, &plen); - fromwire_u8_array(&cursor, &plen, onion_routing_packet, 1366); - return cursor != NULL; -} - -/* WIRE: UPDATE_FULFILL_HTLC */ -u8 *towire_update_fulfill_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, const struct preimage *payment_preimage) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UPDATE_FULFILL_HTLC); - towire_channel_id(&p, channel_id); - towire_u64(&p, id); - towire_preimage(&p, payment_preimage); - - return memcheck(p, tal_count(p)); -} -bool fromwire_update_fulfill_htlc(const void *p, struct channel_id *channel_id, u64 *id, struct preimage *payment_preimage) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FULFILL_HTLC) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *id = fromwire_u64(&cursor, &plen); - fromwire_preimage(&cursor, &plen, payment_preimage); - return cursor != NULL; -} - -/* WIRE: UPDATE_FAIL_HTLC */ -u8 *towire_update_fail_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, const u8 *reason) -{ - u16 len = tal_count(reason); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UPDATE_FAIL_HTLC); - towire_channel_id(&p, channel_id); - towire_u64(&p, id); - towire_u16(&p, len); - towire_u8_array(&p, reason, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_update_fail_htlc(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *id, u8 **reason) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FAIL_HTLC) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *id = fromwire_u64(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case reason - *reason = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *reason, len); - return cursor != NULL; -} - -/* WIRE: UPDATE_FAIL_MALFORMED_HTLC */ -u8 *towire_update_fail_malformed_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, const struct sha256 *sha256_of_onion, u16 failure_code) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UPDATE_FAIL_MALFORMED_HTLC); - towire_channel_id(&p, channel_id); - towire_u64(&p, id); - towire_sha256(&p, sha256_of_onion); - towire_u16(&p, failure_code); - - return memcheck(p, tal_count(p)); -} -bool fromwire_update_fail_malformed_htlc(const void *p, struct channel_id *channel_id, u64 *id, struct sha256 *sha256_of_onion, u16 *failure_code) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FAIL_MALFORMED_HTLC) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *id = fromwire_u64(&cursor, &plen); - fromwire_sha256(&cursor, &plen, sha256_of_onion); - *failure_code = fromwire_u16(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: COMMITMENT_SIGNED */ -u8 *towire_commitment_signed(const tal_t *ctx, const struct channel_id *channel_id, const secp256k1_ecdsa_signature *signature, const secp256k1_ecdsa_signature *htlc_signature) -{ - u16 num_htlcs = tal_count(htlc_signature); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_COMMITMENT_SIGNED); - towire_channel_id(&p, channel_id); - towire_secp256k1_ecdsa_signature(&p, signature); - towire_u16(&p, num_htlcs); - for (size_t i = 0; i < num_htlcs; i++) - towire_secp256k1_ecdsa_signature(&p, htlc_signature + i); - - return memcheck(p, tal_count(p)); -} -bool fromwire_commitment_signed(const tal_t *ctx, const void *p, struct channel_id *channel_id, secp256k1_ecdsa_signature *signature, secp256k1_ecdsa_signature **htlc_signature) -{ - u16 num_htlcs; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_COMMITMENT_SIGNED) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - num_htlcs = fromwire_u16(&cursor, &plen); - // 2nd case htlc_signature - *htlc_signature = num_htlcs ? tal_arr(ctx, secp256k1_ecdsa_signature, num_htlcs) : NULL; - for (size_t i = 0; i < num_htlcs; i++) - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, *htlc_signature + i); - return cursor != NULL; -} - -/* WIRE: REVOKE_AND_ACK */ -u8 *towire_revoke_and_ack(const tal_t *ctx, const struct channel_id *channel_id, const struct secret *per_commitment_secret, const struct pubkey *next_per_commitment_point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_REVOKE_AND_ACK); - towire_channel_id(&p, channel_id); - towire_secret(&p, per_commitment_secret); - towire_pubkey(&p, next_per_commitment_point); - - return memcheck(p, tal_count(p)); -} -bool fromwire_revoke_and_ack(const void *p, struct channel_id *channel_id, struct secret *per_commitment_secret, struct pubkey *next_per_commitment_point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_REVOKE_AND_ACK) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_secret(&cursor, &plen, per_commitment_secret); - fromwire_pubkey(&cursor, &plen, next_per_commitment_point); - return cursor != NULL; -} - -/* WIRE: UPDATE_FEE */ -u8 *towire_update_fee(const tal_t *ctx, const struct channel_id *channel_id, u32 feerate_per_kw) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UPDATE_FEE); - towire_channel_id(&p, channel_id); - towire_u32(&p, feerate_per_kw); - - return memcheck(p, tal_count(p)); -} -bool fromwire_update_fee(const void *p, struct channel_id *channel_id, u32 *feerate_per_kw) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_FEE) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *feerate_per_kw = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: UPDATE_BLOCKHEIGHT */ -u8 *towire_update_blockheight(const tal_t *ctx, const struct channel_id *channel_id, u32 blockheight) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_UPDATE_BLOCKHEIGHT); - towire_channel_id(&p, channel_id); - towire_u32(&p, blockheight); - - return memcheck(p, tal_count(p)); -} -bool fromwire_update_blockheight(const void *p, struct channel_id *channel_id, u32 *blockheight) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_UPDATE_BLOCKHEIGHT) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *blockheight = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: CHANNEL_REESTABLISH */ -u8 *towire_channel_reestablish(const tal_t *ctx, const struct channel_id *channel_id, u64 next_commitment_number, u64 next_revocation_number, const struct secret *your_last_per_commitment_secret, const struct pubkey *my_current_per_commitment_point) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNEL_REESTABLISH); - towire_channel_id(&p, channel_id); - towire_u64(&p, next_commitment_number); - towire_u64(&p, next_revocation_number); - towire_secret(&p, your_last_per_commitment_secret); - towire_pubkey(&p, my_current_per_commitment_point); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channel_reestablish(const void *p, struct channel_id *channel_id, u64 *next_commitment_number, u64 *next_revocation_number, struct secret *your_last_per_commitment_secret, struct pubkey *my_current_per_commitment_point) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_REESTABLISH) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - *next_commitment_number = fromwire_u64(&cursor, &plen); - *next_revocation_number = fromwire_u64(&cursor, &plen); - fromwire_secret(&cursor, &plen, your_last_per_commitment_secret); - fromwire_pubkey(&cursor, &plen, my_current_per_commitment_point); - return cursor != NULL; -} - -/* WIRE: ANNOUNCEMENT_SIGNATURES */ -u8 *towire_announcement_signatures(const tal_t *ctx, const struct channel_id *channel_id, const struct short_channel_id *short_channel_id, const secp256k1_ecdsa_signature *node_signature, const secp256k1_ecdsa_signature *bitcoin_signature) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ANNOUNCEMENT_SIGNATURES); - towire_channel_id(&p, channel_id); - towire_short_channel_id(&p, short_channel_id); - towire_secp256k1_ecdsa_signature(&p, node_signature); - towire_secp256k1_ecdsa_signature(&p, bitcoin_signature); - - return memcheck(p, tal_count(p)); -} -bool fromwire_announcement_signatures(const void *p, struct channel_id *channel_id, struct short_channel_id *short_channel_id, secp256k1_ecdsa_signature *node_signature, secp256k1_ecdsa_signature *bitcoin_signature) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ANNOUNCEMENT_SIGNATURES) - return false; - fromwire_channel_id(&cursor, &plen, channel_id); - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, node_signature); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, bitcoin_signature); - return cursor != NULL; -} - -/* WIRE: CHANNEL_ANNOUNCEMENT */ -u8 *towire_channel_announcement(const tal_t *ctx, const secp256k1_ecdsa_signature *node_signature_1, const secp256k1_ecdsa_signature *node_signature_2, const secp256k1_ecdsa_signature *bitcoin_signature_1, const secp256k1_ecdsa_signature *bitcoin_signature_2, const u8 *features, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, const struct node_id *node_id_1, const struct node_id *node_id_2, const struct pubkey *bitcoin_key_1, const struct pubkey *bitcoin_key_2) -{ - u16 len = tal_count(features); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNEL_ANNOUNCEMENT); - towire_secp256k1_ecdsa_signature(&p, node_signature_1); - towire_secp256k1_ecdsa_signature(&p, node_signature_2); - towire_secp256k1_ecdsa_signature(&p, bitcoin_signature_1); - towire_secp256k1_ecdsa_signature(&p, bitcoin_signature_2); - towire_u16(&p, len); - towire_u8_array(&p, features, len); - towire_bitcoin_blkid(&p, chain_hash); - towire_short_channel_id(&p, short_channel_id); - towire_node_id(&p, node_id_1); - towire_node_id(&p, node_id_2); - towire_pubkey(&p, bitcoin_key_1); - towire_pubkey(&p, bitcoin_key_2); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channel_announcement(const tal_t *ctx, const void *p, secp256k1_ecdsa_signature *node_signature_1, secp256k1_ecdsa_signature *node_signature_2, secp256k1_ecdsa_signature *bitcoin_signature_1, secp256k1_ecdsa_signature *bitcoin_signature_2, u8 **features, struct bitcoin_blkid *chain_hash, struct short_channel_id *short_channel_id, struct node_id *node_id_1, struct node_id *node_id_2, struct pubkey *bitcoin_key_1, struct pubkey *bitcoin_key_2) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_ANNOUNCEMENT) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, node_signature_1); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, node_signature_2); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, bitcoin_signature_1); - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, bitcoin_signature_2); - len = fromwire_u16(&cursor, &plen); - // 2nd case features - *features = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *features, len); - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - fromwire_node_id(&cursor, &plen, node_id_1); - fromwire_node_id(&cursor, &plen, node_id_2); - fromwire_pubkey(&cursor, &plen, bitcoin_key_1); - fromwire_pubkey(&cursor, &plen, bitcoin_key_2); - return cursor != NULL; -} - -/* WIRE: NODE_ANNOUNCEMENT */ -u8 *towire_node_announcement(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const u8 *features, u32 timestamp, const struct node_id *node_id, const u8 rgb_color[3], const u8 alias[32], const u8 *addresses, const struct tlv_node_ann_tlvs *tlvs) -{ - u16 flen = tal_count(features); - u16 addrlen = tal_count(addresses); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_NODE_ANNOUNCEMENT); - towire_secp256k1_ecdsa_signature(&p, signature); - towire_u16(&p, flen); - towire_u8_array(&p, features, flen); - towire_u32(&p, timestamp); - towire_node_id(&p, node_id); - towire_u8_array(&p, rgb_color, 3); - towire_u8_array(&p, alias, 32); - towire_u16(&p, addrlen); - towire_u8_array(&p, addresses, addrlen); - towire_node_ann_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_node_announcement(const tal_t *ctx, const void *p, secp256k1_ecdsa_signature *signature, u8 **features, u32 *timestamp, struct node_id *node_id, u8 rgb_color[3], u8 alias[32], u8 **addresses, struct tlv_node_ann_tlvs *tlvs) -{ - u16 flen; - u16 addrlen; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_NODE_ANNOUNCEMENT) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - flen = fromwire_u16(&cursor, &plen); - // 2nd case features - *features = flen ? tal_arr(ctx, u8, flen) : NULL; - fromwire_u8_array(&cursor, &plen, *features, flen); - *timestamp = fromwire_u32(&cursor, &plen); - fromwire_node_id(&cursor, &plen, node_id); - fromwire_u8_array(&cursor, &plen, rgb_color, 3); - fromwire_u8_array(&cursor, &plen, alias, 32); - addrlen = fromwire_u16(&cursor, &plen); - // 2nd case addresses - *addresses = addrlen ? tal_arr(ctx, u8, addrlen) : NULL; - fromwire_u8_array(&cursor, &plen, *addresses, addrlen); - fromwire_node_ann_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: CHANNEL_UPDATE */ -u8 *towire_channel_update(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, u32 timestamp, u8 message_flags, u8 channel_flags, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNEL_UPDATE); - towire_secp256k1_ecdsa_signature(&p, signature); - towire_bitcoin_blkid(&p, chain_hash); - towire_short_channel_id(&p, short_channel_id); - towire_u32(&p, timestamp); - towire_u8(&p, message_flags); - towire_u8(&p, channel_flags); - towire_u16(&p, cltv_expiry_delta); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, fee_base_msat); - towire_u32(&p, fee_proportional_millionths); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channel_update(const void *p, secp256k1_ecdsa_signature *signature, struct bitcoin_blkid *chain_hash, struct short_channel_id *short_channel_id, u32 *timestamp, u8 *message_flags, u8 *channel_flags, u16 *cltv_expiry_delta, struct amount_msat *htlc_minimum_msat, u32 *fee_base_msat, u32 *fee_proportional_millionths) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_UPDATE) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - *timestamp = fromwire_u32(&cursor, &plen); - *message_flags = fromwire_u8(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *cltv_expiry_delta = fromwire_u16(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *fee_base_msat = fromwire_u32(&cursor, &plen); - *fee_proportional_millionths = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: QUERY_SHORT_CHANNEL_IDS */ -u8 *towire_query_short_channel_ids(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, const u8 *encoded_short_ids, const struct tlv_query_short_channel_ids_tlvs *tlvs) -{ - u16 len = tal_count(encoded_short_ids); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_QUERY_SHORT_CHANNEL_IDS); - towire_bitcoin_blkid(&p, chain_hash); - towire_u16(&p, len); - towire_u8_array(&p, encoded_short_ids, len); - towire_query_short_channel_ids_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_query_short_channel_ids(const tal_t *ctx, const void *p, struct bitcoin_blkid *chain_hash, u8 **encoded_short_ids, struct tlv_query_short_channel_ids_tlvs *tlvs) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_QUERY_SHORT_CHANNEL_IDS) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - len = fromwire_u16(&cursor, &plen); - // 2nd case encoded_short_ids - *encoded_short_ids = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *encoded_short_ids, len); - fromwire_query_short_channel_ids_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: REPLY_SHORT_CHANNEL_IDS_END */ -u8 *towire_reply_short_channel_ids_end(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u8 full_information) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_REPLY_SHORT_CHANNEL_IDS_END); - towire_bitcoin_blkid(&p, chain_hash); - towire_u8(&p, full_information); - - return memcheck(p, tal_count(p)); -} -bool fromwire_reply_short_channel_ids_end(const void *p, struct bitcoin_blkid *chain_hash, u8 *full_information) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_REPLY_SHORT_CHANNEL_IDS_END) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - *full_information = fromwire_u8(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: QUERY_CHANNEL_RANGE */ -u8 *towire_query_channel_range(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_blocknum, u32 number_of_blocks, const struct tlv_query_channel_range_tlvs *tlvs) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_QUERY_CHANNEL_RANGE); - towire_bitcoin_blkid(&p, chain_hash); - towire_u32(&p, first_blocknum); - towire_u32(&p, number_of_blocks); - towire_query_channel_range_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_query_channel_range(const void *p, struct bitcoin_blkid *chain_hash, u32 *first_blocknum, u32 *number_of_blocks, struct tlv_query_channel_range_tlvs *tlvs) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_QUERY_CHANNEL_RANGE) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - *first_blocknum = fromwire_u32(&cursor, &plen); - *number_of_blocks = fromwire_u32(&cursor, &plen); - fromwire_query_channel_range_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: REPLY_CHANNEL_RANGE */ -u8 *towire_reply_channel_range(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_blocknum, u32 number_of_blocks, u8 sync_complete, const u8 *encoded_short_ids, const struct tlv_reply_channel_range_tlvs *tlvs) -{ - u16 len = tal_count(encoded_short_ids); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_REPLY_CHANNEL_RANGE); - towire_bitcoin_blkid(&p, chain_hash); - towire_u32(&p, first_blocknum); - towire_u32(&p, number_of_blocks); - towire_u8(&p, sync_complete); - towire_u16(&p, len); - towire_u8_array(&p, encoded_short_ids, len); - towire_reply_channel_range_tlvs(&p, tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_reply_channel_range(const tal_t *ctx, const void *p, struct bitcoin_blkid *chain_hash, u32 *first_blocknum, u32 *number_of_blocks, u8 *sync_complete, u8 **encoded_short_ids, struct tlv_reply_channel_range_tlvs *tlvs) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_REPLY_CHANNEL_RANGE) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - *first_blocknum = fromwire_u32(&cursor, &plen); - *number_of_blocks = fromwire_u32(&cursor, &plen); - *sync_complete = fromwire_u8(&cursor, &plen); - len = fromwire_u16(&cursor, &plen); - // 2nd case encoded_short_ids - *encoded_short_ids = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *encoded_short_ids, len); - fromwire_reply_channel_range_tlvs(&cursor, &plen, tlvs); - return cursor != NULL; -} - -/* WIRE: GOSSIP_TIMESTAMP_FILTER */ -u8 *towire_gossip_timestamp_filter(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_timestamp, u32 timestamp_range) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_GOSSIP_TIMESTAMP_FILTER); - towire_bitcoin_blkid(&p, chain_hash); - towire_u32(&p, first_timestamp); - towire_u32(&p, timestamp_range); - - return memcheck(p, tal_count(p)); -} -bool fromwire_gossip_timestamp_filter(const void *p, struct bitcoin_blkid *chain_hash, u32 *first_timestamp, u32 *timestamp_range) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_GOSSIP_TIMESTAMP_FILTER) - return false; - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - *first_timestamp = fromwire_u32(&cursor, &plen); - *timestamp_range = fromwire_u32(&cursor, &plen); - return cursor != NULL; -} - -/* WIRE: OBS_ONION_MESSAGE */ -u8 *towire_obs_onion_message(const tal_t *ctx, const u8 *onionmsg, const struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs) -{ - u16 len = tal_count(onionmsg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_OBS_ONION_MESSAGE); - towire_u16(&p, len); - towire_u8_array(&p, onionmsg, len); - towire_obs_onion_message_tlvs(&p, obs_onion_message_tlvs); - - return memcheck(p, tal_count(p)); -} -bool fromwire_obs_onion_message(const tal_t *ctx, const void *p, u8 **onionmsg, struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_OBS_ONION_MESSAGE) - return false; - len = fromwire_u16(&cursor, &plen); - // 2nd case onionmsg - *onionmsg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *onionmsg, len); - fromwire_obs_onion_message_tlvs(&cursor, &plen, obs_onion_message_tlvs); - return cursor != NULL; -} - -/* WIRE: ONION_MESSAGE */ -u8 *towire_onion_message(const tal_t *ctx, const struct pubkey *blinding, const u8 *onionmsg) -{ - u16 len = tal_count(onionmsg); - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_ONION_MESSAGE); - towire_pubkey(&p, blinding); - towire_u16(&p, len); - towire_u8_array(&p, onionmsg, len); - - return memcheck(p, tal_count(p)); -} -bool fromwire_onion_message(const tal_t *ctx, const void *p, struct pubkey *blinding, u8 **onionmsg) -{ - u16 len; - - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_ONION_MESSAGE) - return false; - fromwire_pubkey(&cursor, &plen, blinding); - len = fromwire_u16(&cursor, &plen); - // 2nd case onionmsg - *onionmsg = len ? tal_arr(ctx, u8, len) : NULL; - fromwire_u8_array(&cursor, &plen, *onionmsg, len); - return cursor != NULL; -} - -/* WIRE: CHANNEL_UPDATE_OPTION_CHANNEL_HTLC_MAX */ -u8 *towire_channel_update_option_channel_htlc_max(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, u32 timestamp, u8 message_flags, u8 channel_flags, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths, struct amount_msat htlc_maximum_msat) -{ - u8 *p = tal_arr(ctx, u8, 0); - - towire_u16(&p, WIRE_CHANNEL_UPDATE); - towire_secp256k1_ecdsa_signature(&p, signature); - towire_bitcoin_blkid(&p, chain_hash); - towire_short_channel_id(&p, short_channel_id); - towire_u32(&p, timestamp); - towire_u8(&p, message_flags); - towire_u8(&p, channel_flags); - towire_u16(&p, cltv_expiry_delta); - towire_amount_msat(&p, htlc_minimum_msat); - towire_u32(&p, fee_base_msat); - towire_u32(&p, fee_proportional_millionths); - towire_amount_msat(&p, htlc_maximum_msat); - - return memcheck(p, tal_count(p)); -} -bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ecdsa_signature *signature, struct bitcoin_blkid *chain_hash, struct short_channel_id *short_channel_id, u32 *timestamp, u8 *message_flags, u8 *channel_flags, u16 *cltv_expiry_delta, struct amount_msat *htlc_minimum_msat, u32 *fee_base_msat, u32 *fee_proportional_millionths, struct amount_msat *htlc_maximum_msat) -{ - const u8 *cursor = p; - size_t plen = tal_count(p); - - if (fromwire_u16(&cursor, &plen) != WIRE_CHANNEL_UPDATE) - return false; - fromwire_secp256k1_ecdsa_signature(&cursor, &plen, signature); - fromwire_bitcoin_blkid(&cursor, &plen, chain_hash); - fromwire_short_channel_id(&cursor, &plen, short_channel_id); - *timestamp = fromwire_u32(&cursor, &plen); - *message_flags = fromwire_u8(&cursor, &plen); - *channel_flags = fromwire_u8(&cursor, &plen); - *cltv_expiry_delta = fromwire_u16(&cursor, &plen); - *htlc_minimum_msat = fromwire_amount_msat(&cursor, &plen); - *fee_base_msat = fromwire_u32(&cursor, &plen); - *fee_proportional_millionths = fromwire_u32(&cursor, &plen); - *htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen); - return cursor != NULL; -} -// SHA256STAMP:6c0b9a8708efecb98f258c55fb8cc46909b5cf1ea1204cf18cc7b422f3496d41 diff --git a/wire/peer_wiregen.h b/wire/peer_wiregen.h deleted file mode 100644 index 7245e55f7..000000000 --- a/wire/peer_wiregen.h +++ /dev/null @@ -1,989 +0,0 @@ -/* This file was generated by generate-wire.py */ -/* Do not modify this file! Modify the _csv file it was generated from. */ -/* Original template can be found at tools/gen/header_template */ - -#ifndef LIGHTNING_WIRE_PEER_WIREGEN_H -#define LIGHTNING_WIRE_PEER_WIREGEN_H -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -enum peer_wire { - WIRE_INIT = 16, - WIRE_ERROR = 17, - WIRE_WARNING = 1, - WIRE_PING = 18, - WIRE_PONG = 19, - WIRE_TX_ADD_INPUT = 66, - WIRE_TX_ADD_OUTPUT = 67, - WIRE_TX_REMOVE_INPUT = 68, - WIRE_TX_REMOVE_OUTPUT = 69, - WIRE_TX_COMPLETE = 70, - WIRE_TX_SIGNATURES = 71, - WIRE_OPEN_CHANNEL = 32, - WIRE_ACCEPT_CHANNEL = 33, - WIRE_FUNDING_CREATED = 34, - WIRE_FUNDING_SIGNED = 35, - WIRE_FUNDING_LOCKED = 36, - WIRE_OPEN_CHANNEL2 = 64, - WIRE_ACCEPT_CHANNEL2 = 65, - WIRE_INIT_RBF = 72, - WIRE_ACK_RBF = 73, - WIRE_SHUTDOWN = 38, - WIRE_CLOSING_SIGNED = 39, - WIRE_UPDATE_ADD_HTLC = 128, - WIRE_UPDATE_FULFILL_HTLC = 130, - WIRE_UPDATE_FAIL_HTLC = 131, - WIRE_UPDATE_FAIL_MALFORMED_HTLC = 135, - WIRE_COMMITMENT_SIGNED = 132, - WIRE_REVOKE_AND_ACK = 133, - WIRE_UPDATE_FEE = 134, - WIRE_UPDATE_BLOCKHEIGHT = 137, - WIRE_CHANNEL_REESTABLISH = 136, - WIRE_ANNOUNCEMENT_SIGNATURES = 259, - WIRE_CHANNEL_ANNOUNCEMENT = 256, - WIRE_NODE_ANNOUNCEMENT = 257, - WIRE_CHANNEL_UPDATE = 258, - WIRE_QUERY_SHORT_CHANNEL_IDS = 261, - WIRE_REPLY_SHORT_CHANNEL_IDS_END = 262, - WIRE_QUERY_CHANNEL_RANGE = 263, - WIRE_REPLY_CHANNEL_RANGE = 264, - WIRE_GOSSIP_TIMESTAMP_FILTER = 265, - WIRE_OBS_ONION_MESSAGE = 385, - WIRE_ONION_MESSAGE = 387, -}; - -const char *peer_wire_name(int e); - -/** - * Determine whether a given message type is defined as a message. - * - * Returns true if the message type is part of the message definitions we have - * generated parsers for, false if it is a custom message that cannot be - * handled internally. - */ -bool peer_wire_is_defined(u16 type); - -struct witness_element { - u8 *witness; -}; -struct lease_rates { - u16 funding_weight; - u16 lease_fee_basis; - u16 channel_fee_max_proportional_thousandths; - u32 lease_fee_base_sat; - u32 channel_fee_max_base_msat; -}; -struct channel_update_checksums { - u32 checksum_node_id_1; - u32 checksum_node_id_2; -}; -struct channel_update_timestamps { - u32 timestamp_node_id_1; - u32 timestamp_node_id_2; -}; -struct witness_stack { - struct witness_element **witness_element; -}; -struct tlv_n1_tlv3 { - struct pubkey node_id; - struct amount_msat amount_msat_1; - struct amount_msat amount_msat_2; -}; -struct tlv_opening_tlvs_option_upfront_shutdown_script { - u8 *shutdown_scriptpubkey; -}; -struct tlv_opening_tlvs_request_funds { - u64 requested_sats; - u32 blockheight; -}; -struct tlv_accept_tlvs_option_upfront_shutdown_script { - u8 *shutdown_scriptpubkey; -}; -struct tlv_accept_tlvs_will_fund { - secp256k1_ecdsa_signature signature; - struct lease_rates lease_rates; -}; -struct tlv_shutdown_tlvs_wrong_funding { - struct bitcoin_txid txid; - u32 outnum; -}; -struct tlv_closing_signed_tlvs_fee_range { - struct amount_sat min_fee_satoshis; - struct amount_sat max_fee_satoshis; -}; -struct tlv_query_short_channel_ids_tlvs_query_flags { - u8 encoding_type; - u8 *encoded_query_flags; -}; -struct tlv_reply_channel_range_tlvs_timestamps_tlv { - u8 encoding_type; - u8 *encoded_timestamps; -}; -struct tlv_init_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct bitcoin_blkid *networks; -}; -struct tlv_n1 { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u64 *tlv1; - struct short_channel_id *tlv2; - struct tlv_n1_tlv3 *tlv3; - u16 *tlv4; -}; -struct tlv_n2 { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u64 *tlv1; - u32 *tlv2; -}; -struct tlv_open_channel_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u8 *upfront_shutdown_script; - u8 *channel_type; -}; -struct tlv_accept_channel_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - u8 *upfront_shutdown_script; - u8 *channel_type; -}; -struct tlv_opening_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_opening_tlvs_option_upfront_shutdown_script *option_upfront_shutdown_script; - struct tlv_opening_tlvs_request_funds *request_funds; -}; -struct tlv_accept_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_accept_tlvs_option_upfront_shutdown_script *option_upfront_shutdown_script; - struct tlv_accept_tlvs_will_fund *will_fund; -}; -struct tlv_shutdown_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_shutdown_tlvs_wrong_funding *wrong_funding; -}; -struct tlv_closing_signed_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_closing_signed_tlvs_fee_range *fee_range; -}; -struct tlv_node_ann_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct lease_rates *option_will_fund; -}; -struct tlv_query_short_channel_ids_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_query_short_channel_ids_tlvs_query_flags *query_flags; -}; -struct tlv_query_channel_range_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - bigsize *query_option; -}; -struct tlv_reply_channel_range_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct tlv_reply_channel_range_tlvs_timestamps_tlv *timestamps_tlv; - struct channel_update_checksums *checksums_tlv; -}; -struct tlv_obs_onion_message_tlvs { - /* Raw fields including unknown ones. */ - struct tlv_field *fields; - - /* TODO The following explicit fields could just point into the - * tlv_field entries above to save on memory. */ - struct pubkey *blinding; -}; - -struct tlv_init_tlvs *tlv_init_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the init_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using init_tlvs_is_valid. - */ -bool fromwire_init_tlvs(const u8 **cursor, size_t *max, - struct tlv_init_tlvs * record); - -/** - * Serialize a TLV stream for the init_tlvs namespace. - * - * This function only considers known fields from the init_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `init_tlvs_is_valid`. - */ -void towire_init_tlvs(u8 **pptr, const struct tlv_init_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool init_tlvs_is_valid(const struct tlv_init_tlvs *record, - size_t *err_index); - -struct tlv_n1 *tlv_n1_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the n1 namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using n1_is_valid. - */ -bool fromwire_n1(const u8 **cursor, size_t *max, - struct tlv_n1 * record); - -/** - * Serialize a TLV stream for the n1 namespace. - * - * This function only considers known fields from the n1 namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `n1_is_valid`. - */ -void towire_n1(u8 **pptr, const struct tlv_n1 *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool n1_is_valid(const struct tlv_n1 *record, - size_t *err_index); - -#define TLVS_ARRAY_SIZE_n1 4 -extern const struct tlv_record_type tlvs_n1[]; - - - -/* Define an enum with the constants */ -enum n1_types { - TLV_N1_TLV1 = 1, - TLV_N1_TLV2 = 2, - TLV_N1_TLV3 = 3, - TLV_N1_TLV4 = 254, -}; - -struct tlv_n2 *tlv_n2_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the n2 namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using n2_is_valid. - */ -bool fromwire_n2(const u8 **cursor, size_t *max, - struct tlv_n2 * record); - -/** - * Serialize a TLV stream for the n2 namespace. - * - * This function only considers known fields from the n2 namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `n2_is_valid`. - */ -void towire_n2(u8 **pptr, const struct tlv_n2 *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool n2_is_valid(const struct tlv_n2 *record, - size_t *err_index); - -#define TLVS_ARRAY_SIZE_n2 2 -extern const struct tlv_record_type tlvs_n2[]; - - - -/* Define an enum with the constants */ -enum n2_types { - TLV_N2_TLV1 = 0, - TLV_N2_TLV2 = 11, -}; - -struct tlv_open_channel_tlvs *tlv_open_channel_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the open_channel_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using open_channel_tlvs_is_valid. - */ -bool fromwire_open_channel_tlvs(const u8 **cursor, size_t *max, - struct tlv_open_channel_tlvs * record); - -/** - * Serialize a TLV stream for the open_channel_tlvs namespace. - * - * This function only considers known fields from the open_channel_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `open_channel_tlvs_is_valid`. - */ -void towire_open_channel_tlvs(u8 **pptr, const struct tlv_open_channel_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool open_channel_tlvs_is_valid(const struct tlv_open_channel_tlvs *record, - size_t *err_index); - -struct tlv_accept_channel_tlvs *tlv_accept_channel_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the accept_channel_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using accept_channel_tlvs_is_valid. - */ -bool fromwire_accept_channel_tlvs(const u8 **cursor, size_t *max, - struct tlv_accept_channel_tlvs * record); - -/** - * Serialize a TLV stream for the accept_channel_tlvs namespace. - * - * This function only considers known fields from the accept_channel_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `accept_channel_tlvs_is_valid`. - */ -void towire_accept_channel_tlvs(u8 **pptr, const struct tlv_accept_channel_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool accept_channel_tlvs_is_valid(const struct tlv_accept_channel_tlvs *record, - size_t *err_index); - -struct tlv_opening_tlvs *tlv_opening_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the opening_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using opening_tlvs_is_valid. - */ -bool fromwire_opening_tlvs(const u8 **cursor, size_t *max, - struct tlv_opening_tlvs * record); - -/** - * Serialize a TLV stream for the opening_tlvs namespace. - * - * This function only considers known fields from the opening_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `opening_tlvs_is_valid`. - */ -void towire_opening_tlvs(u8 **pptr, const struct tlv_opening_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool opening_tlvs_is_valid(const struct tlv_opening_tlvs *record, - size_t *err_index); - -struct tlv_accept_tlvs *tlv_accept_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the accept_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using accept_tlvs_is_valid. - */ -bool fromwire_accept_tlvs(const u8 **cursor, size_t *max, - struct tlv_accept_tlvs * record); - -/** - * Serialize a TLV stream for the accept_tlvs namespace. - * - * This function only considers known fields from the accept_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `accept_tlvs_is_valid`. - */ -void towire_accept_tlvs(u8 **pptr, const struct tlv_accept_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool accept_tlvs_is_valid(const struct tlv_accept_tlvs *record, - size_t *err_index); - -struct tlv_shutdown_tlvs *tlv_shutdown_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the shutdown_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using shutdown_tlvs_is_valid. - */ -bool fromwire_shutdown_tlvs(const u8 **cursor, size_t *max, - struct tlv_shutdown_tlvs * record); - -/** - * Serialize a TLV stream for the shutdown_tlvs namespace. - * - * This function only considers known fields from the shutdown_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `shutdown_tlvs_is_valid`. - */ -void towire_shutdown_tlvs(u8 **pptr, const struct tlv_shutdown_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool shutdown_tlvs_is_valid(const struct tlv_shutdown_tlvs *record, - size_t *err_index); - -struct tlv_closing_signed_tlvs *tlv_closing_signed_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the closing_signed_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using closing_signed_tlvs_is_valid. - */ -bool fromwire_closing_signed_tlvs(const u8 **cursor, size_t *max, - struct tlv_closing_signed_tlvs * record); - -/** - * Serialize a TLV stream for the closing_signed_tlvs namespace. - * - * This function only considers known fields from the closing_signed_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `closing_signed_tlvs_is_valid`. - */ -void towire_closing_signed_tlvs(u8 **pptr, const struct tlv_closing_signed_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool closing_signed_tlvs_is_valid(const struct tlv_closing_signed_tlvs *record, - size_t *err_index); - -struct tlv_node_ann_tlvs *tlv_node_ann_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the node_ann_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using node_ann_tlvs_is_valid. - */ -bool fromwire_node_ann_tlvs(const u8 **cursor, size_t *max, - struct tlv_node_ann_tlvs * record); - -/** - * Serialize a TLV stream for the node_ann_tlvs namespace. - * - * This function only considers known fields from the node_ann_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `node_ann_tlvs_is_valid`. - */ -void towire_node_ann_tlvs(u8 **pptr, const struct tlv_node_ann_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool node_ann_tlvs_is_valid(const struct tlv_node_ann_tlvs *record, - size_t *err_index); - -struct tlv_query_short_channel_ids_tlvs *tlv_query_short_channel_ids_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the query_short_channel_ids_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using query_short_channel_ids_tlvs_is_valid. - */ -bool fromwire_query_short_channel_ids_tlvs(const u8 **cursor, size_t *max, - struct tlv_query_short_channel_ids_tlvs * record); - -/** - * Serialize a TLV stream for the query_short_channel_ids_tlvs namespace. - * - * This function only considers known fields from the query_short_channel_ids_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `query_short_channel_ids_tlvs_is_valid`. - */ -void towire_query_short_channel_ids_tlvs(u8 **pptr, const struct tlv_query_short_channel_ids_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool query_short_channel_ids_tlvs_is_valid(const struct tlv_query_short_channel_ids_tlvs *record, - size_t *err_index); - -struct tlv_query_channel_range_tlvs *tlv_query_channel_range_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the query_channel_range_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using query_channel_range_tlvs_is_valid. - */ -bool fromwire_query_channel_range_tlvs(const u8 **cursor, size_t *max, - struct tlv_query_channel_range_tlvs * record); - -/** - * Serialize a TLV stream for the query_channel_range_tlvs namespace. - * - * This function only considers known fields from the query_channel_range_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `query_channel_range_tlvs_is_valid`. - */ -void towire_query_channel_range_tlvs(u8 **pptr, const struct tlv_query_channel_range_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool query_channel_range_tlvs_is_valid(const struct tlv_query_channel_range_tlvs *record, - size_t *err_index); - -struct tlv_reply_channel_range_tlvs *tlv_reply_channel_range_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the reply_channel_range_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using reply_channel_range_tlvs_is_valid. - */ -bool fromwire_reply_channel_range_tlvs(const u8 **cursor, size_t *max, - struct tlv_reply_channel_range_tlvs * record); - -/** - * Serialize a TLV stream for the reply_channel_range_tlvs namespace. - * - * This function only considers known fields from the reply_channel_range_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `reply_channel_range_tlvs_is_valid`. - */ -void towire_reply_channel_range_tlvs(u8 **pptr, const struct tlv_reply_channel_range_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool reply_channel_range_tlvs_is_valid(const struct tlv_reply_channel_range_tlvs *record, - size_t *err_index); - -struct tlv_obs_onion_message_tlvs *tlv_obs_onion_message_tlvs_new(const tal_t *ctx); - -/** - * Deserialize a TLV stream for the obs_onion_message_tlvs namespace. - * - * This function will parse any TLV stream, as long as the type, length and - * value fields are formatted correctly. Fields that are not known in the - * current namespace are stored in the `fields` member. Validity can be - * checked using obs_onion_message_tlvs_is_valid. - */ -bool fromwire_obs_onion_message_tlvs(const u8 **cursor, size_t *max, - struct tlv_obs_onion_message_tlvs * record); - -/** - * Serialize a TLV stream for the obs_onion_message_tlvs namespace. - * - * This function only considers known fields from the obs_onion_message_tlvs namespace, - * and will ignore any fields that may be stored in the `fields` member. This - * ensures that the resulting stream is valid according to - * `obs_onion_message_tlvs_is_valid`. - */ -void towire_obs_onion_message_tlvs(u8 **pptr, const struct tlv_obs_onion_message_tlvs *record); - -/** - * Check that the TLV stream is valid. - * - * Enforces the followin validity rules: - * - Types must be in monotonic non-repeating order - * - We must understand all even types - * - * Returns false if an error was detected, otherwise returns true. If err_index - * is non-null and we detect an error it is set to the index of the first error - * detected. - */ -bool obs_onion_message_tlvs_is_valid(const struct tlv_obs_onion_message_tlvs *record, - size_t *err_index); - -/* SUBTYPE: WITNESS_ELEMENT */ -void towire_witness_element(u8 **p, const struct witness_element *witness_element); -struct witness_element *fromwire_witness_element(const tal_t *ctx, const u8 **cursor, size_t *plen); - -/* SUBTYPE: LEASE_RATES */ -void towire_lease_rates(u8 **p, const struct lease_rates *lease_rates); -void fromwire_lease_rates(const u8 **cursor, size_t *plen, struct lease_rates *lease_rates); - -/* SUBTYPE: CHANNEL_UPDATE_CHECKSUMS */ -void towire_channel_update_checksums(u8 **p, const struct channel_update_checksums *channel_update_checksums); -void fromwire_channel_update_checksums(const u8 **cursor, size_t *plen, struct channel_update_checksums *channel_update_checksums); - -/* SUBTYPE: CHANNEL_UPDATE_TIMESTAMPS */ -void towire_channel_update_timestamps(u8 **p, const struct channel_update_timestamps *channel_update_timestamps); -void fromwire_channel_update_timestamps(const u8 **cursor, size_t *plen, struct channel_update_timestamps *channel_update_timestamps); - -/* SUBTYPE: WITNESS_STACK */ -void towire_witness_stack(u8 **p, const struct witness_stack *witness_stack); -struct witness_stack *fromwire_witness_stack(const tal_t *ctx, const u8 **cursor, size_t *plen); - -/* WIRE: INIT */ -u8 *towire_init(const tal_t *ctx, const u8 *globalfeatures, const u8 *features, const struct tlv_init_tlvs *tlvs); -bool fromwire_init(const tal_t *ctx, const void *p, u8 **globalfeatures, u8 **features, struct tlv_init_tlvs *tlvs); - -/* WIRE: ERROR */ -u8 *towire_error(const tal_t *ctx, const struct channel_id *channel_id, const u8 *data); -bool fromwire_error(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **data); - -/* WIRE: WARNING */ -u8 *towire_warning(const tal_t *ctx, const struct channel_id *channel_id, const u8 *data); -bool fromwire_warning(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **data); - -/* WIRE: PING */ -u8 *towire_ping(const tal_t *ctx, u16 num_pong_bytes, const u8 *ignored); -bool fromwire_ping(const tal_t *ctx, const void *p, u16 *num_pong_bytes, u8 **ignored); - -/* WIRE: PONG */ -u8 *towire_pong(const tal_t *ctx, const u8 *ignored); -bool fromwire_pong(const tal_t *ctx, const void *p, u8 **ignored); - -/* WIRE: TX_ADD_INPUT */ -u8 *towire_tx_add_input(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id, const u8 *prevtx, u32 prevtx_vout, u32 sequence, const u8 *script_sig); -bool fromwire_tx_add_input(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *serial_id, u8 **prevtx, u32 *prevtx_vout, u32 *sequence, u8 **script_sig); - -/* WIRE: TX_ADD_OUTPUT */ -u8 *towire_tx_add_output(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id, u64 sats, const u8 *script); -bool fromwire_tx_add_output(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *serial_id, u64 *sats, u8 **script); - -/* WIRE: TX_REMOVE_INPUT */ -u8 *towire_tx_remove_input(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id); -bool fromwire_tx_remove_input(const void *p, struct channel_id *channel_id, u64 *serial_id); - -/* WIRE: TX_REMOVE_OUTPUT */ -u8 *towire_tx_remove_output(const tal_t *ctx, const struct channel_id *channel_id, u64 serial_id); -bool fromwire_tx_remove_output(const void *p, struct channel_id *channel_id, u64 *serial_id); - -/* WIRE: TX_COMPLETE */ -u8 *towire_tx_complete(const tal_t *ctx, const struct channel_id *channel_id); -bool fromwire_tx_complete(const void *p, struct channel_id *channel_id); - -/* WIRE: TX_SIGNATURES */ -u8 *towire_tx_signatures(const tal_t *ctx, const struct channel_id *channel_id, const struct bitcoin_txid *txid, const struct witness_stack **witness_stack); -bool fromwire_tx_signatures(const tal_t *ctx, const void *p, struct channel_id *channel_id, struct bitcoin_txid *txid, struct witness_stack ***witness_stack); - -/* WIRE: OPEN_CHANNEL */ -u8 *towire_open_channel(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, const struct channel_id *temporary_channel_id, struct amount_sat funding_satoshis, struct amount_msat push_msat, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_sat channel_reserve_satoshis, struct amount_msat htlc_minimum_msat, u32 feerate_per_kw, u16 to_self_delay, u16 max_accepted_htlcs, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, u8 channel_flags, const struct tlv_open_channel_tlvs *tlvs); -bool fromwire_open_channel(const void *p, struct bitcoin_blkid *chain_hash, struct channel_id *temporary_channel_id, struct amount_sat *funding_satoshis, struct amount_msat *push_msat, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_sat *channel_reserve_satoshis, struct amount_msat *htlc_minimum_msat, u32 *feerate_per_kw, u16 *to_self_delay, u16 *max_accepted_htlcs, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, u8 *channel_flags, struct tlv_open_channel_tlvs *tlvs); - -/* WIRE: ACCEPT_CHANNEL */ -u8 *towire_accept_channel(const tal_t *ctx, const struct channel_id *temporary_channel_id, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_sat channel_reserve_satoshis, struct amount_msat htlc_minimum_msat, u32 minimum_depth, u16 to_self_delay, u16 max_accepted_htlcs, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, const struct tlv_accept_channel_tlvs *tlvs); -bool fromwire_accept_channel(const void *p, struct channel_id *temporary_channel_id, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_sat *channel_reserve_satoshis, struct amount_msat *htlc_minimum_msat, u32 *minimum_depth, u16 *to_self_delay, u16 *max_accepted_htlcs, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, struct tlv_accept_channel_tlvs *tlvs); - -/* WIRE: FUNDING_CREATED */ -u8 *towire_funding_created(const tal_t *ctx, const struct channel_id *temporary_channel_id, const struct bitcoin_txid *funding_txid, u16 funding_output_index, const secp256k1_ecdsa_signature *signature); -bool fromwire_funding_created(const void *p, struct channel_id *temporary_channel_id, struct bitcoin_txid *funding_txid, u16 *funding_output_index, secp256k1_ecdsa_signature *signature); - -/* WIRE: FUNDING_SIGNED */ -u8 *towire_funding_signed(const tal_t *ctx, const struct channel_id *channel_id, const secp256k1_ecdsa_signature *signature); -bool fromwire_funding_signed(const void *p, struct channel_id *channel_id, secp256k1_ecdsa_signature *signature); - -/* WIRE: FUNDING_LOCKED */ -u8 *towire_funding_locked(const tal_t *ctx, const struct channel_id *channel_id, const struct pubkey *next_per_commitment_point); -bool fromwire_funding_locked(const void *p, struct channel_id *channel_id, struct pubkey *next_per_commitment_point); - -/* WIRE: OPEN_CHANNEL2 */ -u8 *towire_open_channel2(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, const struct channel_id *channel_id, u32 funding_feerate_perkw, u32 commitment_feerate_perkw, struct amount_sat funding_satoshis, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u16 to_self_delay, u16 max_accepted_htlcs, u32 locktime, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, u8 channel_flags, const struct tlv_opening_tlvs *tlvs); -bool fromwire_open_channel2(const void *p, struct bitcoin_blkid *chain_hash, struct channel_id *channel_id, u32 *funding_feerate_perkw, u32 *commitment_feerate_perkw, struct amount_sat *funding_satoshis, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u16 *to_self_delay, u16 *max_accepted_htlcs, u32 *locktime, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, u8 *channel_flags, struct tlv_opening_tlvs *tlvs); - -/* WIRE: ACCEPT_CHANNEL2 */ -u8 *towire_accept_channel2(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat funding_satoshis, struct amount_sat dust_limit_satoshis, struct amount_msat max_htlc_value_in_flight_msat, struct amount_msat htlc_minimum_msat, u32 minimum_depth, u16 to_self_delay, u16 max_accepted_htlcs, const struct pubkey *funding_pubkey, const struct pubkey *revocation_basepoint, const struct pubkey *payment_basepoint, const struct pubkey *delayed_payment_basepoint, const struct pubkey *htlc_basepoint, const struct pubkey *first_per_commitment_point, const struct tlv_accept_tlvs *tlvs); -bool fromwire_accept_channel2(const void *p, struct channel_id *channel_id, struct amount_sat *funding_satoshis, struct amount_sat *dust_limit_satoshis, struct amount_msat *max_htlc_value_in_flight_msat, struct amount_msat *htlc_minimum_msat, u32 *minimum_depth, u16 *to_self_delay, u16 *max_accepted_htlcs, struct pubkey *funding_pubkey, struct pubkey *revocation_basepoint, struct pubkey *payment_basepoint, struct pubkey *delayed_payment_basepoint, struct pubkey *htlc_basepoint, struct pubkey *first_per_commitment_point, struct tlv_accept_tlvs *tlvs); - -/* WIRE: INIT_RBF */ -u8 *towire_init_rbf(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat funding_satoshis, u32 locktime, u32 funding_feerate_perkw); -bool fromwire_init_rbf(const void *p, struct channel_id *channel_id, struct amount_sat *funding_satoshis, u32 *locktime, u32 *funding_feerate_perkw); - -/* WIRE: ACK_RBF */ -u8 *towire_ack_rbf(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat funding_satoshis); -bool fromwire_ack_rbf(const void *p, struct channel_id *channel_id, struct amount_sat *funding_satoshis); - -/* WIRE: SHUTDOWN */ -u8 *towire_shutdown(const tal_t *ctx, const struct channel_id *channel_id, const u8 *scriptpubkey, const struct tlv_shutdown_tlvs *tlvs); -bool fromwire_shutdown(const tal_t *ctx, const void *p, struct channel_id *channel_id, u8 **scriptpubkey, struct tlv_shutdown_tlvs *tlvs); - -/* WIRE: CLOSING_SIGNED */ -u8 *towire_closing_signed(const tal_t *ctx, const struct channel_id *channel_id, struct amount_sat fee_satoshis, const secp256k1_ecdsa_signature *signature, const struct tlv_closing_signed_tlvs *tlvs); -bool fromwire_closing_signed(const void *p, struct channel_id *channel_id, struct amount_sat *fee_satoshis, secp256k1_ecdsa_signature *signature, struct tlv_closing_signed_tlvs *tlvs); - -/* WIRE: UPDATE_ADD_HTLC */ -u8 *towire_update_add_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, struct amount_msat amount_msat, const struct sha256 *payment_hash, u32 cltv_expiry, const u8 onion_routing_packet[1366]); -bool fromwire_update_add_htlc(const void *p, struct channel_id *channel_id, u64 *id, struct amount_msat *amount_msat, struct sha256 *payment_hash, u32 *cltv_expiry, u8 onion_routing_packet[1366]); - -/* WIRE: UPDATE_FULFILL_HTLC */ -u8 *towire_update_fulfill_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, const struct preimage *payment_preimage); -bool fromwire_update_fulfill_htlc(const void *p, struct channel_id *channel_id, u64 *id, struct preimage *payment_preimage); - -/* WIRE: UPDATE_FAIL_HTLC */ -u8 *towire_update_fail_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, const u8 *reason); -bool fromwire_update_fail_htlc(const tal_t *ctx, const void *p, struct channel_id *channel_id, u64 *id, u8 **reason); - -/* WIRE: UPDATE_FAIL_MALFORMED_HTLC */ -u8 *towire_update_fail_malformed_htlc(const tal_t *ctx, const struct channel_id *channel_id, u64 id, const struct sha256 *sha256_of_onion, u16 failure_code); -bool fromwire_update_fail_malformed_htlc(const void *p, struct channel_id *channel_id, u64 *id, struct sha256 *sha256_of_onion, u16 *failure_code); - -/* WIRE: COMMITMENT_SIGNED */ -u8 *towire_commitment_signed(const tal_t *ctx, const struct channel_id *channel_id, const secp256k1_ecdsa_signature *signature, const secp256k1_ecdsa_signature *htlc_signature); -bool fromwire_commitment_signed(const tal_t *ctx, const void *p, struct channel_id *channel_id, secp256k1_ecdsa_signature *signature, secp256k1_ecdsa_signature **htlc_signature); - -/* WIRE: REVOKE_AND_ACK */ -u8 *towire_revoke_and_ack(const tal_t *ctx, const struct channel_id *channel_id, const struct secret *per_commitment_secret, const struct pubkey *next_per_commitment_point); -bool fromwire_revoke_and_ack(const void *p, struct channel_id *channel_id, struct secret *per_commitment_secret, struct pubkey *next_per_commitment_point); - -/* WIRE: UPDATE_FEE */ -u8 *towire_update_fee(const tal_t *ctx, const struct channel_id *channel_id, u32 feerate_per_kw); -bool fromwire_update_fee(const void *p, struct channel_id *channel_id, u32 *feerate_per_kw); - -/* WIRE: UPDATE_BLOCKHEIGHT */ -u8 *towire_update_blockheight(const tal_t *ctx, const struct channel_id *channel_id, u32 blockheight); -bool fromwire_update_blockheight(const void *p, struct channel_id *channel_id, u32 *blockheight); - -/* WIRE: CHANNEL_REESTABLISH */ -u8 *towire_channel_reestablish(const tal_t *ctx, const struct channel_id *channel_id, u64 next_commitment_number, u64 next_revocation_number, const struct secret *your_last_per_commitment_secret, const struct pubkey *my_current_per_commitment_point); -bool fromwire_channel_reestablish(const void *p, struct channel_id *channel_id, u64 *next_commitment_number, u64 *next_revocation_number, struct secret *your_last_per_commitment_secret, struct pubkey *my_current_per_commitment_point); - -/* WIRE: ANNOUNCEMENT_SIGNATURES */ -u8 *towire_announcement_signatures(const tal_t *ctx, const struct channel_id *channel_id, const struct short_channel_id *short_channel_id, const secp256k1_ecdsa_signature *node_signature, const secp256k1_ecdsa_signature *bitcoin_signature); -bool fromwire_announcement_signatures(const void *p, struct channel_id *channel_id, struct short_channel_id *short_channel_id, secp256k1_ecdsa_signature *node_signature, secp256k1_ecdsa_signature *bitcoin_signature); - -/* WIRE: CHANNEL_ANNOUNCEMENT */ -u8 *towire_channel_announcement(const tal_t *ctx, const secp256k1_ecdsa_signature *node_signature_1, const secp256k1_ecdsa_signature *node_signature_2, const secp256k1_ecdsa_signature *bitcoin_signature_1, const secp256k1_ecdsa_signature *bitcoin_signature_2, const u8 *features, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, const struct node_id *node_id_1, const struct node_id *node_id_2, const struct pubkey *bitcoin_key_1, const struct pubkey *bitcoin_key_2); -bool fromwire_channel_announcement(const tal_t *ctx, const void *p, secp256k1_ecdsa_signature *node_signature_1, secp256k1_ecdsa_signature *node_signature_2, secp256k1_ecdsa_signature *bitcoin_signature_1, secp256k1_ecdsa_signature *bitcoin_signature_2, u8 **features, struct bitcoin_blkid *chain_hash, struct short_channel_id *short_channel_id, struct node_id *node_id_1, struct node_id *node_id_2, struct pubkey *bitcoin_key_1, struct pubkey *bitcoin_key_2); - -/* WIRE: NODE_ANNOUNCEMENT */ -u8 *towire_node_announcement(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const u8 *features, u32 timestamp, const struct node_id *node_id, const u8 rgb_color[3], const u8 alias[32], const u8 *addresses, const struct tlv_node_ann_tlvs *tlvs); -bool fromwire_node_announcement(const tal_t *ctx, const void *p, secp256k1_ecdsa_signature *signature, u8 **features, u32 *timestamp, struct node_id *node_id, u8 rgb_color[3], u8 alias[32], u8 **addresses, struct tlv_node_ann_tlvs *tlvs); - -/* WIRE: CHANNEL_UPDATE */ -u8 *towire_channel_update(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, u32 timestamp, u8 message_flags, u8 channel_flags, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths); -bool fromwire_channel_update(const void *p, secp256k1_ecdsa_signature *signature, struct bitcoin_blkid *chain_hash, struct short_channel_id *short_channel_id, u32 *timestamp, u8 *message_flags, u8 *channel_flags, u16 *cltv_expiry_delta, struct amount_msat *htlc_minimum_msat, u32 *fee_base_msat, u32 *fee_proportional_millionths); - -/* WIRE: QUERY_SHORT_CHANNEL_IDS */ -u8 *towire_query_short_channel_ids(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, const u8 *encoded_short_ids, const struct tlv_query_short_channel_ids_tlvs *tlvs); -bool fromwire_query_short_channel_ids(const tal_t *ctx, const void *p, struct bitcoin_blkid *chain_hash, u8 **encoded_short_ids, struct tlv_query_short_channel_ids_tlvs *tlvs); - -/* WIRE: REPLY_SHORT_CHANNEL_IDS_END */ -u8 *towire_reply_short_channel_ids_end(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u8 full_information); -bool fromwire_reply_short_channel_ids_end(const void *p, struct bitcoin_blkid *chain_hash, u8 *full_information); - -/* WIRE: QUERY_CHANNEL_RANGE */ -u8 *towire_query_channel_range(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_blocknum, u32 number_of_blocks, const struct tlv_query_channel_range_tlvs *tlvs); -bool fromwire_query_channel_range(const void *p, struct bitcoin_blkid *chain_hash, u32 *first_blocknum, u32 *number_of_blocks, struct tlv_query_channel_range_tlvs *tlvs); - -/* WIRE: REPLY_CHANNEL_RANGE */ -u8 *towire_reply_channel_range(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_blocknum, u32 number_of_blocks, u8 sync_complete, const u8 *encoded_short_ids, const struct tlv_reply_channel_range_tlvs *tlvs); -bool fromwire_reply_channel_range(const tal_t *ctx, const void *p, struct bitcoin_blkid *chain_hash, u32 *first_blocknum, u32 *number_of_blocks, u8 *sync_complete, u8 **encoded_short_ids, struct tlv_reply_channel_range_tlvs *tlvs); - -/* WIRE: GOSSIP_TIMESTAMP_FILTER */ -u8 *towire_gossip_timestamp_filter(const tal_t *ctx, const struct bitcoin_blkid *chain_hash, u32 first_timestamp, u32 timestamp_range); -bool fromwire_gossip_timestamp_filter(const void *p, struct bitcoin_blkid *chain_hash, u32 *first_timestamp, u32 *timestamp_range); - -/* WIRE: OBS_ONION_MESSAGE */ -u8 *towire_obs_onion_message(const tal_t *ctx, const u8 *onionmsg, const struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs); -bool fromwire_obs_onion_message(const tal_t *ctx, const void *p, u8 **onionmsg, struct tlv_obs_onion_message_tlvs *obs_onion_message_tlvs); - -/* WIRE: ONION_MESSAGE */ -u8 *towire_onion_message(const tal_t *ctx, const struct pubkey *blinding, const u8 *onionmsg); -bool fromwire_onion_message(const tal_t *ctx, const void *p, struct pubkey *blinding, u8 **onionmsg); - -/* WIRE: CHANNEL_UPDATE_OPTION_CHANNEL_HTLC_MAX */ -u8 *towire_channel_update_option_channel_htlc_max(const tal_t *ctx, const secp256k1_ecdsa_signature *signature, const struct bitcoin_blkid *chain_hash, const struct short_channel_id *short_channel_id, u32 timestamp, u8 message_flags, u8 channel_flags, u16 cltv_expiry_delta, struct amount_msat htlc_minimum_msat, u32 fee_base_msat, u32 fee_proportional_millionths, struct amount_msat htlc_maximum_msat); -bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ecdsa_signature *signature, struct bitcoin_blkid *chain_hash, struct short_channel_id *short_channel_id, u32 *timestamp, u8 *message_flags, u8 *channel_flags, u16 *cltv_expiry_delta, struct amount_msat *htlc_minimum_msat, u32 *fee_base_msat, u32 *fee_proportional_millionths, struct amount_msat *htlc_maximum_msat); - - -#endif /* LIGHTNING_WIRE_PEER_WIREGEN_H */ -// SHA256STAMP:6c0b9a8708efecb98f258c55fb8cc46909b5cf1ea1204cf18cc7b422f3496d41