diff --git a/channeld/channeld.c b/channeld/channeld.c index d33e9da1e2fe..305de7e9eb34 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -290,7 +290,7 @@ static void maybe_send_stfu(struct peer *peer) if (!peer->stfu) return; - if (!peer->stfu_sent[LOCAL] && !pending_updates(peer->channel, LOCAL)) { + if (!peer->stfu_sent[LOCAL] && !pending_updates(peer->channel, LOCAL, false)) { u8 *msg = towire_stfu(NULL, &peer->channel_id, peer->stfu_initiator == LOCAL); sync_crypto_write(peer->pps, take(msg)); @@ -323,7 +323,7 @@ static void handle_stfu(struct peer *peer, const u8 *stfu) } /* Sanity check */ - if (pending_updates(peer->channel, REMOTE)) + if (pending_updates(peer->channel, REMOTE, false)) peer_failed_warn(peer->pps, &peer->channel_id, "STFU but you still have updates pending?"); @@ -368,6 +368,50 @@ static bool handle_master_request_later(struct peer *peer, const u8 *msg) } return false; } + +static bool channel_type_eq(const struct channel_type *a, + const struct channel_type *b) +{ + return featurebits_eq(a->features, b->features); +} + +static bool match_type(const struct channel_type *desired, + const struct channel_type *current, + struct channel_type **upgradable) +{ + /* Missing fields are possible. */ + if (!desired || !current) + return false; + + if (channel_type_eq(desired, current)) + return true; + + for (size_t i = 0; i < tal_count(upgradable); i++) { + if (channel_type_eq(desired, upgradable[i])) + return true; + } + + return false; +} + +static void set_channel_type(struct channel *channel, + const struct channel_type *type) +{ + const struct channel_type *cur = channel_type(tmpctx, channel); + + if (channel_type_eq(cur, type)) + return; + + /* We only allow one upgrade at the moment, so that's it. */ + assert(!channel->option_static_remotekey); + assert(feature_offered(type->features, OPT_STATIC_REMOTEKEY)); + + /* Do upgrade, tell master. */ + channel->option_static_remotekey = true; + status_unusual("Upgraded channel to [%s]", + fmt_featurebits(tmpctx, type->features)); + wire_sync_write(MASTER_FD, take(towire_channeld_upgraded(NULL, true))); +} #else /* !EXPERIMENTAL_FEATURES */ static bool handle_master_request_later(struct peer *peer, const u8 *msg) { @@ -1141,7 +1185,7 @@ static void send_commit(struct peer *peer) /* FIXME: We occasionally desynchronize with LND here, so * don't stress things by having more than one feerate change * in-flight! */ - if (feerate_changes_done(peer->channel->fee_states)) { + if (feerate_changes_done(peer->channel->fee_states, false)) { u8 *msg; if (!channel_update_feerate(peer->channel, feerate_target)) @@ -1930,12 +1974,19 @@ static void handle_unexpected_reestablish(struct peer *peer, const u8 *msg) u64 next_revocation_number; struct secret your_last_per_commitment_secret; struct pubkey my_current_per_commitment_point; +#if EXPERIMENTAL_FEATURES + struct tlv_channel_reestablish_tlvs *tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); +#endif if (!fromwire_channel_reestablish(msg, &channel_id, &next_commitment_number, &next_revocation_number, &your_last_per_commitment_secret, - &my_current_per_commitment_point)) + &my_current_per_commitment_point +#if EXPERIMENTAL_FEATURES + , tlvs +#endif + )) peer_failed_warn(peer->pps, &peer->channel_id, "Bad channel_reestablish %s", tal_hex(peer, msg)); @@ -2474,6 +2525,9 @@ static void peer_reconnect(struct peer *peer, struct secret last_local_per_commitment_secret; bool dataloss_protect, check_extra_fields; const u8 **premature_msgs = tal_arr(peer, const u8 *, 0); +#if EXPERIMENTAL_FEATURES + struct tlv_channel_reestablish_tlvs *send_tlvs, *recv_tlvs; +#endif dataloss_protect = feature_negotiated(peer->our_features, peer->their_features, @@ -2488,6 +2542,39 @@ static void peer_reconnect(struct peer *peer, get_per_commitment_point(peer->next_index[LOCAL] - 1, &my_current_per_commitment_point, NULL); +#if EXPERIMENTAL_FEATURES + /* Subtle: we free tmpctx below as we loop, so tal off peer */ + send_tlvs = tlv_channel_reestablish_tlvs_new(peer); + /* BOLT-upgrade_protocol #2: + * A node sending `channel_reestablish`, if it supports upgrading channels: + * - MUST set `next_to_send` the commitment number of the next + * `commitment_signed` it expects to send. + */ + send_tlvs->next_to_send = tal_dup(send_tlvs, u64, &peer->next_index[REMOTE]); + + /* BOLT-upgrade_protocol #2: + * - if it initiated the channel: + * - MUST set `desired_type` to the channel_type it wants for the + * channel. + */ + if (peer->channel->opener == LOCAL) + send_tlvs->desired_type = channel_desired_type(send_tlvs, + peer->channel); + else { + /* BOLT-upgrade_protocol #2: + * - otherwise: + * - MUST set `current_type` to the current channel_type of the + * channel. + * - MUST set `upgradable` to the channel types it could change + * to. + * - MAY not set `upgradable` if it would be empty. + */ + send_tlvs->current_type = channel_type(send_tlvs, peer->channel); + send_tlvs->upgradable = channel_upgradable_types(send_tlvs, + peer->channel); + } +#endif + /* BOLT #2: * * - upon reconnection: @@ -2525,14 +2612,22 @@ static void peer_reconnect(struct peer *peer, peer->revocations_received, last_remote_per_commit_secret, /* Can send any (valid) point here */ - &peer->remote_per_commit); + &peer->remote_per_commit +#if EXPERIMENTAL_FEATURES + , send_tlvs +#endif + ); } else { msg = towire_channel_reestablish (NULL, &peer->channel_id, peer->next_index[LOCAL], peer->revocations_received, last_remote_per_commit_secret, - &my_current_per_commitment_point); + &my_current_per_commitment_point +#if EXPERIMENTAL_FEATURES + , send_tlvs +#endif + ); } sync_crypto_write(peer->pps, take(msg)); @@ -2552,12 +2647,20 @@ static void peer_reconnect(struct peer *peer, msg) || capture_premature_msg(&premature_msgs, msg)); +#if EXPERIMENTAL_FEATURES + recv_tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); +#endif + if (!fromwire_channel_reestablish(msg, &channel_id, &next_commitment_number, &next_revocation_number, &last_local_per_commitment_secret, - &remote_current_per_commitment_point)) { + &remote_current_per_commitment_point +#if EXPERIMENTAL_FEATURES + , recv_tlvs +#endif + )) { peer_failed_warn(peer->pps, &peer->channel_id, "bad reestablish msg: %s %s", @@ -2725,6 +2828,88 @@ static void peer_reconnect(struct peer *peer, /* (If we had sent `closing_signed`, we'd be in closingd). */ maybe_send_shutdown(peer); +#if EXPERIMENTAL_FEATURES + if (recv_tlvs->desired_type) + status_debug("They sent desired_type [%s]", + fmt_featurebits(tmpctx, + recv_tlvs->desired_type->features)); + if (recv_tlvs->current_type) + status_debug("They sent current_type [%s]", + fmt_featurebits(tmpctx, + recv_tlvs->current_type->features)); + + for (size_t i = 0; i < tal_count(recv_tlvs->upgradable); i++) { + status_debug("They offered upgrade to [%s]", + fmt_featurebits(tmpctx, + recv_tlvs->upgradable[i]->features)); + } + + /* BOLT-upgrade_protocol #2: + * + * A node receiving `channel_reestablish`: + * - if it has to retransmit `commitment_signed` or `revoke_and_ack`: + * - MUST consider the channel feature change failed. + */ + if (retransmit_commitment_signed || retransmit_revoke_and_ack) { + status_debug("No upgrade: we retransmitted"); + /* BOLT-upgrade_protocol #2: + * + * - if `next_to_send` is missing, or not equal to the + * `next_commitment_number` it sent: + * - MUST consider the channel feature change failed. + */ + } else if (!recv_tlvs->next_to_send) { + status_debug("No upgrade: no next_to_send received"); + } else if (*recv_tlvs->next_to_send != peer->next_index[LOCAL]) { + status_debug("No upgrade: they're retransmitting"); + /* BOLT-upgrade_protocol #2: + * + * - if updates are pending on either sides' commitment transaction: + * - MUST consider the channel feature change failed. + */ + /* Note that we can have HTLCs we *want* to add or remove + * but haven't yet: thats OK! */ + } else if (pending_updates(peer->channel, LOCAL, true) + || pending_updates(peer->channel, REMOTE, true)) { + status_debug("No upgrade: pending changes"); + } else { + const struct tlv_channel_reestablish_tlvs *initr, *ninitr; + const struct channel_type *type; + + if (peer->channel->opener == LOCAL) { + initr = send_tlvs; + ninitr = recv_tlvs; + } else { + initr = recv_tlvs; + ninitr = send_tlvs; + } + + /* BOLT-upgrade_protocol #2: + * + * - if `desired_type` matches `current_type` or any + * `upgradable` `upgrades`: + * - MUST consider the channel type to be `desired_type`. + * - otherwise: + * - MUST consider the channel feature change failed. + * - if there is a `current_type` field: + * - MUST consider the channel type to be `current_type`. + */ + /* Note: returns NULL on missing fields, aka NULL */ + if (match_type(initr->desired_type, + ninitr->current_type, ninitr->upgradable)) + type = initr->desired_type; + else if (ninitr->current_type) + type = ninitr->current_type; + else + type = NULL; + + if (type) + set_channel_type(peer->channel, type); + } + tal_free(send_tlvs); + +#endif /* EXPERIMENTAL_FEATURES */ + /* Corner case: we didn't send shutdown before because update_add_htlc * pending, but now they're cleared by restart, and we're actually * complete. In that case, their `shutdown` will trigger us. */ @@ -3172,6 +3357,7 @@ static void req_in(struct peer *peer, const u8 *msg) case WIRE_CHANNELD_DEV_MEMLEAK_REPLY: case WIRE_CHANNELD_SEND_ERROR_REPLY: case WIRE_CHANNELD_DEV_QUIESCE_REPLY: + case WIRE_CHANNELD_UPGRADED: break; } @@ -3279,6 +3465,9 @@ static void init_channel(struct peer *peer) master_badmsg(WIRE_CHANNELD_INIT, msg); } + status_debug("option_static_remotekey = %u, option_anchor_outputs = %u", + option_static_remotekey, option_anchor_outputs); + /* Keeping an array of pointers is better since it allows us to avoid * extra allocations later. */ peer->pbases = tal_arr(peer, struct penalty_base *, 0); diff --git a/channeld/channeld_wire.csv b/channeld/channeld_wire.csv index a376f5a6536f..8af0756a34a1 100644 --- a/channeld/channeld_wire.csv +++ b/channeld/channeld_wire.csv @@ -221,3 +221,7 @@ msgtype,channeld_send_error_reply,1108 # Ask channeld to quiesce. msgtype,channeld_dev_quiesce,1009 msgtype,channeld_dev_quiesce_reply,1109 + +# Tell master we're upgrading the commitment tx. +msgtype,channeld_upgraded,1011 +msgdata,channeld_upgraded,option_static_remotekey,bool, diff --git a/channeld/channeld_wiregen.c b/channeld/channeld_wiregen.c index 4d4fe6c676e4..0a4d375bc327 100644 --- a/channeld/channeld_wiregen.c +++ b/channeld/channeld_wiregen.c @@ -48,6 +48,7 @@ const char *channeld_wire_name(int e) 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"; } snprintf(invalidbuf, sizeof(invalidbuf), "INVALID %i", e); @@ -85,6 +86,7 @@ bool channeld_wire_is_defined(u16 type) case WIRE_CHANNELD_SEND_ERROR_REPLY:; case WIRE_CHANNELD_DEV_QUIESCE:; case WIRE_CHANNELD_DEV_QUIESCE_REPLY:; + case WIRE_CHANNELD_UPGRADED:; return true; } return false; @@ -1113,4 +1115,26 @@ bool fromwire_channeld_dev_quiesce_reply(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:720f9917311384d373593dc1550619ddf461bdabde8b312ed6dc632cb7860c34 + +/* WIRE: CHANNELD_UPGRADED */ +/* Tell master we're upgrading the commitment tx. */ +u8 *towire_channeld_upgraded(const tal_t *ctx, bool option_static_remotekey) +{ + u8 *p = tal_arr(ctx, u8, 0); + + towire_u16(&p, WIRE_CHANNELD_UPGRADED); + towire_bool(&p, option_static_remotekey); + + return memcheck(p, tal_count(p)); +} +bool fromwire_channeld_upgraded(const void *p, bool *option_static_remotekey) +{ + const u8 *cursor = p; + size_t plen = tal_count(p); + + if (fromwire_u16(&cursor, &plen) != WIRE_CHANNELD_UPGRADED) + return false; + *option_static_remotekey = fromwire_bool(&cursor, &plen); + return cursor != NULL; +} +// SHA256STAMP:2d7b763e89512ad8c5921b90c13f37ac83ab0016384c38e8c8e831683d668651 diff --git a/channeld/channeld_wiregen.h b/channeld/channeld_wiregen.h index 7d6f16c5426d..3dde409668f6 100644 --- a/channeld/channeld_wiregen.h +++ b/channeld/channeld_wiregen.h @@ -73,6 +73,8 @@ enum channeld_wire { /* 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, }; const char *channeld_wire_name(int e); @@ -223,6 +225,11 @@ bool fromwire_channeld_dev_quiesce(const void *p); 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, bool option_static_remotekey); +bool fromwire_channeld_upgraded(const void *p, bool *option_static_remotekey); + #endif /* LIGHTNING_CHANNELD_CHANNELD_WIREGEN_H */ -// SHA256STAMP:720f9917311384d373593dc1550619ddf461bdabde8b312ed6dc632cb7860c34 +// SHA256STAMP:2d7b763e89512ad8c5921b90c13f37ac83ab0016384c38e8c8e831683d668651 diff --git a/channeld/full_channel.c b/channeld/full_channel.c index 55ae6214c0b3..eb6f0375d1ec 100644 --- a/channeld/full_channel.c +++ b/channeld/full_channel.c @@ -1252,26 +1252,38 @@ static bool adjust_balance(struct balance view_owed[NUM_SIDES][NUM_SIDES], return true; } -bool pending_updates(const struct channel *channel, enum side side) +bool pending_updates(const struct channel *channel, + enum side side, + bool uncommitted_ok) { struct htlc_map_iter it; const struct htlc *htlc; /* Initiator might have fee changes in play. */ if (side == channel->opener) { - if (!feerate_changes_done(channel->fee_states)) + if (!feerate_changes_done(channel->fee_states, uncommitted_ok)) return true; } for (htlc = htlc_map_first(channel->htlcs, &it); htlc; htlc = htlc_map_next(channel->htlcs, &it)) { - /* If it's still being added, it's owner added it. */ - if (htlc_state_flags(htlc->state) & HTLC_ADDING) { + int flags = htlc_state_flags(htlc->state); + + /* If it's still being added, its owner added it. */ + if (flags & HTLC_ADDING) { + /* It might be OK if it's added, but not committed */ + if (uncommitted_ok + && (flags & HTLC_FLAG(!side, HTLC_F_PENDING))) + continue; if (htlc_owner(htlc) == side) return true; /* If it's being removed, non-owner removed it */ } else if (htlc_state_flags(htlc->state) & HTLC_REMOVING) { + /* It might be OK if it's removed, but not committed */ + if (uncommitted_ok + && (flags & HTLC_FLAG(!side, HTLC_F_PENDING))) + continue; if (htlc_owner(htlc) != side) return true; } diff --git a/channeld/full_channel.h b/channeld/full_channel.h index 8f04547eb70b..e23deb3b11fa 100644 --- a/channeld/full_channel.h +++ b/channeld/full_channel.h @@ -258,8 +258,10 @@ void dump_htlcs(const struct channel *channel, const char *prefix); * pending_updates: does this side have updates pending in channel? * @channel: the channel * @side: the side who is offering or failing/fulfilling HTLC, or feechange + * @uncommitted_ok: don't count uncommitted changes. */ -bool pending_updates(const struct channel *channel, enum side side); +bool pending_updates(const struct channel *channel, enum side side, + bool uncommitted_ok); const char *channel_add_err_name(enum channel_add_err e); const char *channel_remove_err_name(enum channel_remove_err e); diff --git a/channeld/test/run-full_channel.c b/channeld/test/run-full_channel.c index acee63ef097a..89eb791e758b 100644 --- a/channeld/test/run-full_channel.c +++ b/channeld/test/run-full_channel.c @@ -29,6 +29,9 @@ void memleak_add_helper_(const tal_t *p UNNEEDED, void (*cb)(struct htable *memt /* Generated stub for memleak_remove_htable */ void memleak_remove_htable(struct htable *memtable UNNEEDED, const struct htable *ht UNNEEDED) { fprintf(stderr, "memleak_remove_htable called!\n"); abort(); } +/* Generated stub for set_feature_bit */ +void set_feature_bit(u8 **ptr UNNEEDED, u32 bit UNNEEDED) +{ fprintf(stderr, "set_feature_bit called!\n"); abort(); } /* Generated stub for status_failed */ void status_failed(enum status_failreason code UNNEEDED, const char *fmt UNNEEDED, ...) diff --git a/closingd/closingd.c b/closingd/closingd.c index 80c10adcaa87..1184b12a712a 100644 --- a/closingd/closingd.c +++ b/closingd/closingd.c @@ -176,6 +176,9 @@ static void do_reconnect(struct per_peer_state *pps, struct pubkey my_current_per_commitment_point, next_commitment_point; struct secret their_secret; struct tlv_shutdown_tlvs *tlvs; +#if EXPERIMENTAL_FEATURES + struct tlv_channel_reestablish_tlvs *reestablish_tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); +#endif my_current_per_commitment_point = get_per_commitment_point(next_index[LOCAL]-1); @@ -201,7 +204,11 @@ static void do_reconnect(struct per_peer_state *pps, next_index[LOCAL], revocations_received, last_remote_per_commit_secret, - &my_current_per_commitment_point); + &my_current_per_commitment_point +#if EXPERIMENTAL_FEATURES + , reestablish_tlvs +#endif + ); sync_crypto_write(pps, take(msg)); /* They might have already sent reestablish, which triggered us */ @@ -217,11 +224,19 @@ static void do_reconnect(struct per_peer_state *pps, != WIRE_CHANNEL_REESTABLISH); } +#if EXPERIMENTAL_FEATURES + reestablish_tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); +#endif + if (!fromwire_channel_reestablish(channel_reestablish, &their_channel_id, &next_local_commitment_number, &next_remote_revocation_number, &their_secret, - &next_commitment_point)) { + &next_commitment_point +#if EXPERIMENTAL_FEATURES + , reestablish_tlvs +#endif + )) { peer_failed_warn(pps, channel_id, "bad reestablish msg: %s %s", peer_wire_name(fromwire_peektype(channel_reestablish)), diff --git a/closingd/closingd_wiregen.c b/closingd/closingd_wiregen.c index 91f2693f80ca..d1a94dfb55f4 100644 --- a/closingd/closingd_wiregen.c +++ b/closingd/closingd_wiregen.c @@ -213,4 +213,4 @@ bool fromwire_closingd_complete(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:95043321951ace6f7a5ee9f1dc0ae57c8a6427644b8b79d3e08e521dc9b3b49f +// SHA256STAMP:8a13df246be151bcef3dae15a9853016119248d330e76ab79d7013a11d5ecd23 diff --git a/closingd/closingd_wiregen.h b/closingd/closingd_wiregen.h index ea2aa4f2e144..9f46a12b97fe 100644 --- a/closingd/closingd_wiregen.h +++ b/closingd/closingd_wiregen.h @@ -56,4 +56,4 @@ bool fromwire_closingd_complete(const void *p); #endif /* LIGHTNING_CLOSINGD_CLOSINGD_WIREGEN_H */ -// SHA256STAMP:95043321951ace6f7a5ee9f1dc0ae57c8a6427644b8b79d3e08e521dc9b3b49f +// SHA256STAMP:8a13df246be151bcef3dae15a9853016119248d330e76ab79d7013a11d5ecd23 diff --git a/common/features.c b/common/features.c index 681fdc334e99..d77f514666e3 100644 --- a/common/features.c +++ b/common/features.c @@ -476,6 +476,20 @@ u8 *featurebits_or(const tal_t *ctx, const u8 *f1 TAKES, const u8 *f2 TAKES) return result; } +bool featurebits_eq(const u8 *f1, const u8 *f2) +{ + size_t len = tal_bytelen(f1); + + if (tal_bytelen(f2) > len) + len = tal_bytelen(f2); + + for (size_t i = 0; i < len * 8; i++) { + if (feature_is_set(f1, i) != feature_is_set(f2, i)) + return false; + } + return true; +} + struct feature_set *fromwire_feature_set(const tal_t *ctx, const u8 **cursor, size_t *max) { @@ -497,3 +511,18 @@ void towire_feature_set(u8 **pptr, const struct feature_set *fset) towire_u8_array(pptr, fset->bits[i], tal_bytelen(fset->bits[i])); } } + +const char *fmt_featurebits(const tal_t *ctx, const u8 *featurebits) +{ + size_t size = tal_count(featurebits); + char *fmt = tal_strdup(ctx, ""); + const char *prefix = ""; + + for (size_t i = 0; i < size * 8; i++) { + if (feature_is_set(featurebits, i)) { + tal_append_fmt(&fmt, "%s%zu", prefix, i); + prefix = ","; + } + } + return fmt; +} diff --git a/common/features.h b/common/features.h index a03d6b5ced8e..0de7c31c9571 100644 --- a/common/features.h +++ b/common/features.h @@ -71,6 +71,13 @@ void set_feature_bit(u8 **ptr, u32 bit); /* Given two featurebit vectors, combine them by applying a logical OR. */ u8 *featurebits_or(const tal_t *ctx, const u8 *f1 TAKES, const u8 *f2 TAKES); +/* Are these two feature bitsets functionally equal (one may have + * trailing zeroes)? */ +bool featurebits_eq(const u8 *f1, const u8 *f2); + +/* Good for debugging: returns comma-separated string of bits. */ +const char *fmt_featurebits(const tal_t *ctx, const u8 *featurebits); + /* BOLT #9: * * Flags are numbered from the least-significant bit, at bit 0 (i.e. 0x1, diff --git a/common/fee_states.c b/common/fee_states.c index c12470911e1d..451d3849f150 100644 --- a/common/fee_states.c +++ b/common/fee_states.c @@ -74,10 +74,14 @@ u32 get_feerate(const struct fee_states *fee_states, } /* Are feerates all agreed by both sides? */ -bool feerate_changes_done(const struct fee_states *fee_states) +bool feerate_changes_done(const struct fee_states *fee_states, + bool ignore_uncommitted) { size_t num_feerates = 0; for (size_t i = 0; i < ARRAY_SIZE(fee_states->feerate); i++) { + if (ignore_uncommitted + && (i == RCVD_ADD_HTLC || i == SENT_ADD_HTLC)) + continue; num_feerates += (fee_states->feerate[i] != NULL); } return num_feerates == 1; diff --git a/common/fee_states.h b/common/fee_states.h index 40cc18ddccd3..cf846002b90e 100644 --- a/common/fee_states.h +++ b/common/fee_states.h @@ -86,7 +86,8 @@ struct fee_states *fromwire_fee_states(const tal_t *ctx, */ bool fee_states_valid(const struct fee_states *fee_states, enum side opener); -/* Are therre no more fee changes in-flight? */ -bool feerate_changes_done(const struct fee_states *fee_states); +/* Are there no more fee changes in-flight? */ +bool feerate_changes_done(const struct fee_states *fee_states, + bool ignore_uncommitted); #endif /* LIGHTNING_COMMON_FEE_STATES_H */ diff --git a/common/initial_channel.c b/common/initial_channel.c index fef91fb3ca70..8270f4a1bf16 100644 --- a/common/initial_channel.c +++ b/common/initial_channel.c @@ -6,12 +6,14 @@ #include #include #include +#include #include #include #include #include #include #include +#include struct channel *new_initial_channel(const tal_t *ctx, const struct channel_id *cid, @@ -136,6 +138,74 @@ u32 channel_feerate(const struct channel *channel, enum side side) return get_feerate(channel->fee_states, channel->opener, side); } +#if EXPERIMENTAL_FEATURES +/* BOLT-upgrade_protocol #2: + * Channel features are explicitly enumerated as `channel_type` bitfields, + * using odd features bits. The currently defined types are: + * - no features (no bits set) + * - `option_static_remotekey` (bit 13) + * - `option_anchor_outputs` and `option_static_remotekey` (bits 21 and 13) + * - `option_anchors_zero_fee_htlc_tx` and `option_static_remotekey` (bits 23 + * and 13) + */ +static struct channel_type *new_channel_type(const tal_t *ctx) +{ + struct channel_type *type = tal(ctx, struct channel_type); + + type->features = tal_arr(type, u8, 0); + return type; +} + +static struct channel_type *type_static_remotekey(const tal_t *ctx) +{ + struct channel_type *type = new_channel_type(ctx); + + set_feature_bit(&type->features, + OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY)); + return type; +} + +static struct channel_type *type_anchor_outputs(const tal_t *ctx) +{ + struct channel_type *type = new_channel_type(ctx); + + set_feature_bit(&type->features, + OPTIONAL_FEATURE(OPT_ANCHOR_OUTPUTS)); + set_feature_bit(&type->features, + OPTIONAL_FEATURE(OPT_STATIC_REMOTEKEY)); + return type; +} + +struct channel_type *channel_type(const tal_t *ctx, + const struct channel *channel) +{ + if (channel->option_anchor_outputs) + return type_anchor_outputs(ctx); + if (channel->option_static_remotekey) + return type_static_remotekey(ctx); + + return new_channel_type(ctx); +} + +struct channel_type **channel_upgradable_types(const tal_t *ctx, + const struct channel *channel) +{ + struct channel_type **arr = tal_arr(ctx, struct channel_type *, 0); + + if (!channel->option_static_remotekey) + tal_arr_expand(&arr, type_static_remotekey(arr)); + + return arr; +} + +struct channel_type *channel_desired_type(const tal_t *ctx, + const struct channel *channel) +{ + /* For now, we just want option_static_remotekey */ + return type_static_remotekey(ctx); +} +#endif /* EXPERIMENTAL_FEATURES */ + static char *fmt_channel_view(const tal_t *ctx, const struct channel_view *view) { return tal_fmt(ctx, "{ owed_local=%s," diff --git a/common/initial_channel.h b/common/initial_channel.h index a70649afed8f..09f2e86a16b2 100644 --- a/common/initial_channel.h +++ b/common/initial_channel.h @@ -140,4 +140,21 @@ struct bitcoin_tx *initial_channel_tx(const tal_t *ctx, */ u32 channel_feerate(const struct channel *channel, enum side side); +#if EXPERIMENTAL_FEATURES +/* BOLT-upgrade_protocol #2: + * Channel features are explicitly enumerated as `channel_type` bitfields, + * using odd features bits. + */ +struct channel_type *channel_type(const tal_t *ctx, + const struct channel *channel); + +/* What features can we upgrade? (Returns NULL if none). */ +struct channel_type **channel_upgradable_types(const tal_t *ctx, + const struct channel *channel); + +/* What features do we want? */ +struct channel_type *channel_desired_type(const tal_t *ctx, + const struct channel *channel); +#endif /* EXPERIMENTAL_FEATURES */ + #endif /* LIGHTNING_COMMON_INITIAL_CHANNEL_H */ diff --git a/common/peer_status_wiregen.c b/common/peer_status_wiregen.c index 08982e737f80..0f12fa92a76f 100644 --- a/common/peer_status_wiregen.c +++ b/common/peer_status_wiregen.c @@ -80,4 +80,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_ fromwire_u8_array(&cursor, &plen, *error_for_them, len); return cursor != NULL; } -// SHA256STAMP:c002247f54d5016e614dd6d757c7d06f65c713c3e19d17901f7f685a6bd4b9d9 +// SHA256STAMP:9d6739d97294bd0ec0691772616c4d3d0328d399ed2bef6c943f912aca7d438a diff --git a/common/peer_status_wiregen.h b/common/peer_status_wiregen.h index a95a6f27524e..52d7941aecff 100644 --- a/common/peer_status_wiregen.h +++ b/common/peer_status_wiregen.h @@ -34,4 +34,4 @@ bool fromwire_status_peer_error(const tal_t *ctx, const void *p, struct channel_ #endif /* LIGHTNING_COMMON_PEER_STATUS_WIREGEN_H */ -// SHA256STAMP:c002247f54d5016e614dd6d757c7d06f65c713c3e19d17901f7f685a6bd4b9d9 +// SHA256STAMP:9d6739d97294bd0ec0691772616c4d3d0328d399ed2bef6c943f912aca7d438a diff --git a/common/status_wiregen.c b/common/status_wiregen.c index e56e59aac151..d97b9ee0f765 100644 --- a/common/status_wiregen.c +++ b/common/status_wiregen.c @@ -214,4 +214,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi *version = fromwire_wirestring(ctx, &cursor, &plen); return cursor != NULL; } -// SHA256STAMP:8e1ba9cbc812c8aad76c5049fcecefea2d706a100423c93d3c3be0afcbee851e +// SHA256STAMP:3164c82c28124ba916aebd075baa2315cd82cee0d785908da25c6aa6c5b11f22 diff --git a/common/status_wiregen.h b/common/status_wiregen.h index c41cb23111ee..9a45697e02bc 100644 --- a/common/status_wiregen.h +++ b/common/status_wiregen.h @@ -58,4 +58,4 @@ bool fromwire_status_version(const tal_t *ctx, const void *p, wirestring **versi #endif /* LIGHTNING_COMMON_STATUS_WIREGEN_H */ -// SHA256STAMP:8e1ba9cbc812c8aad76c5049fcecefea2d706a100423c93d3c3be0afcbee851e +// SHA256STAMP:3164c82c28124ba916aebd075baa2315cd82cee0d785908da25c6aa6c5b11f22 diff --git a/connectd/connectd_gossipd_wiregen.c b/connectd/connectd_gossipd_wiregen.c index 7332fec6bcc1..ac2856c3abe5 100644 --- a/connectd/connectd_gossipd_wiregen.c +++ b/connectd/connectd_gossipd_wiregen.c @@ -161,4 +161,4 @@ bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wi fromwire_wireaddr(&cursor, &plen, *addrs + i); return cursor != NULL; } -// SHA256STAMP:3843c1c89472b3084feca4bb6d0a39598f768d4c4ff866f8dc94169716b6fadd +// SHA256STAMP:6bfe0677cb910aba63f79cfc4164ce26034da95e16341eab3aac6fddcc04e3e9 diff --git a/connectd/connectd_gossipd_wiregen.h b/connectd/connectd_gossipd_wiregen.h index 2bc0fb24721a..5c391775adcd 100644 --- a/connectd/connectd_gossipd_wiregen.h +++ b/connectd/connectd_gossipd_wiregen.h @@ -54,4 +54,4 @@ bool fromwire_gossipd_get_addrs_reply(const tal_t *ctx, const void *p, struct wi #endif /* LIGHTNING_CONNECTD_CONNECTD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:3843c1c89472b3084feca4bb6d0a39598f768d4c4ff866f8dc94169716b6fadd +// SHA256STAMP:6bfe0677cb910aba63f79cfc4164ce26034da95e16341eab3aac6fddcc04e3e9 diff --git a/connectd/connectd_wiregen.c b/connectd/connectd_wiregen.c index a76e3e007f5a..3ee9ea506f2e 100644 --- a/connectd/connectd_wiregen.c +++ b/connectd/connectd_wiregen.c @@ -443,4 +443,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:7c9585941825eab65d734eb1c233eee5c78b5792e19ec68f0a9986abca2b0ffe +// SHA256STAMP:042c0ae692c223da86af3f09977fdc5f19655e99b928ab05812dd4c1ed95f1c5 diff --git a/connectd/connectd_wiregen.h b/connectd/connectd_wiregen.h index 46e1ecb00c77..34ad8ca34f41 100644 --- a/connectd/connectd_wiregen.h +++ b/connectd/connectd_wiregen.h @@ -110,4 +110,4 @@ bool fromwire_connectd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_CONNECTD_CONNECTD_WIREGEN_H */ -// SHA256STAMP:7c9585941825eab65d734eb1c233eee5c78b5792e19ec68f0a9986abca2b0ffe +// SHA256STAMP:042c0ae692c223da86af3f09977fdc5f19655e99b928ab05812dd4c1ed95f1c5 diff --git a/gossipd/gossip_store_wiregen.c b/gossipd/gossip_store_wiregen.c index d4c464481687..90cbd0b07a7b 100644 --- a/gossipd/gossip_store_wiregen.c +++ b/gossipd/gossip_store_wiregen.c @@ -210,4 +210,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str fromwire_u8_array(&cursor, &plen, *features, flen); return cursor != NULL; } -// SHA256STAMP:18d52e526a219c3a8bb29c6a29b7bd82880c5befdde88c12424d57cb98a28b17 +// SHA256STAMP:3e6e23b99855a3be9305cbc297d59d818cc193d6ebe5c2ca78dfb6ec5df31e94 diff --git a/gossipd/gossip_store_wiregen.h b/gossipd/gossip_store_wiregen.h index 2ff5bc91b8fc..0941d51e6151 100644 --- a/gossipd/gossip_store_wiregen.h +++ b/gossipd/gossip_store_wiregen.h @@ -63,4 +63,4 @@ bool fromwire_gossipd_local_add_channel_obs(const tal_t *ctx, const void *p, str #endif /* LIGHTNING_GOSSIPD_GOSSIP_STORE_WIREGEN_H */ -// SHA256STAMP:18d52e526a219c3a8bb29c6a29b7bd82880c5befdde88c12424d57cb98a28b17 +// SHA256STAMP:3e6e23b99855a3be9305cbc297d59d818cc193d6ebe5c2ca78dfb6ec5df31e94 diff --git a/gossipd/gossipd_peerd_wiregen.c b/gossipd/gossipd_peerd_wiregen.c index 4a8710da0e25..a6ff50636ec1 100644 --- a/gossipd/gossipd_peerd_wiregen.c +++ b/gossipd/gossipd_peerd_wiregen.c @@ -161,4 +161,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p fromwire_u8_array(&cursor, &plen, *cannount, len); return cursor != NULL; } -// SHA256STAMP:2ef99c782b9877add7912c680d3a48bed3372c6a6fe2410716651dbe777493eb +// SHA256STAMP:e55284452718ed1baf12a38736b4bfeecc8bb18dac8ad4f0ee0b5dc8904fbdc2 diff --git a/gossipd/gossipd_peerd_wiregen.h b/gossipd/gossipd_peerd_wiregen.h index e20d4a5f3f32..8240e6616c78 100644 --- a/gossipd/gossipd_peerd_wiregen.h +++ b/gossipd/gossipd_peerd_wiregen.h @@ -57,4 +57,4 @@ bool fromwire_gossipd_local_channel_announcement(const tal_t *ctx, const void *p #endif /* LIGHTNING_GOSSIPD_GOSSIPD_PEERD_WIREGEN_H */ -// SHA256STAMP:2ef99c782b9877add7912c680d3a48bed3372c6a6fe2410716651dbe777493eb +// SHA256STAMP:e55284452718ed1baf12a38736b4bfeecc8bb18dac8ad4f0ee0b5dc8904fbdc2 diff --git a/gossipd/gossipd_wiregen.c b/gossipd/gossipd_wiregen.c index c0a3b279e432..6e86ca01e0e8 100644 --- a/gossipd/gossipd_wiregen.c +++ b/gossipd/gossipd_wiregen.c @@ -1057,4 +1057,4 @@ bool fromwire_gossipd_addgossip_reply(const tal_t *ctx, const void *p, wirestrin *err = fromwire_wirestring(ctx, &cursor, &plen); return cursor != NULL; } -// SHA256STAMP:5fb4bcc3bb8c5f312041142d4bf555a2187c82d82921b819d5a45410efddf6f3 +// SHA256STAMP:a0d7494995d7f95fb7df295bab9d865e18670f15243116a0aaa9b9548534b922 diff --git a/gossipd/gossipd_wiregen.h b/gossipd/gossipd_wiregen.h index 5bbfca57c60b..0e989c517672 100644 --- a/gossipd/gossipd_wiregen.h +++ b/gossipd/gossipd_wiregen.h @@ -225,4 +225,4 @@ bool fromwire_gossipd_addgossip_reply(const tal_t *ctx, const void *p, wirestrin #endif /* LIGHTNING_GOSSIPD_GOSSIPD_WIREGEN_H */ -// SHA256STAMP:5fb4bcc3bb8c5f312041142d4bf555a2187c82d82921b819d5a45410efddf6f3 +// SHA256STAMP:a0d7494995d7f95fb7df295bab9d865e18670f15243116a0aaa9b9548534b922 diff --git a/hsmd/hsmd_wiregen.c b/hsmd/hsmd_wiregen.c index a664c0472d23..048a49a282d6 100644 --- a/hsmd/hsmd_wiregen.c +++ b/hsmd/hsmd_wiregen.c @@ -1278,4 +1278,4 @@ bool fromwire_hsmd_sign_bolt12_reply(const void *p, struct bip340sig *sig) fromwire_bip340sig(&cursor, &plen, sig); return cursor != NULL; } -// SHA256STAMP:b419989953cbf50796fc237b5d7e2043f96cb838a1356dbdb27943b341f611a8 +// SHA256STAMP:535c69a065c06a2e2ea151154ae83b53283d1c5b34e18b43a2c12c9444472548 diff --git a/hsmd/hsmd_wiregen.h b/hsmd/hsmd_wiregen.h index a86a7da16474..1da52edbcb21 100644 --- a/hsmd/hsmd_wiregen.h +++ b/hsmd/hsmd_wiregen.h @@ -283,4 +283,4 @@ bool fromwire_hsmd_sign_bolt12_reply(const void *p, struct bip340sig *sig); #endif /* LIGHTNING_HSMD_HSMD_WIREGEN_H */ -// SHA256STAMP:b419989953cbf50796fc237b5d7e2043f96cb838a1356dbdb27943b341f611a8 +// SHA256STAMP:535c69a065c06a2e2ea151154ae83b53283d1c5b34e18b43a2c12c9444472548 diff --git a/lightningd/channel.c b/lightningd/channel.c index a6ef05ea51c0..074a058efb18 100644 --- a/lightningd/channel.c +++ b/lightningd/channel.c @@ -263,7 +263,8 @@ struct channel *new_unsaved_channel(struct peer *peer, * | Use v2 of channel open, enables dual funding * | IN9 * | `option_anchor_outputs` */ - channel->option_static_remotekey = true; + channel->static_remotekey_start[LOCAL] + = channel->static_remotekey_start[REMOTE] = 0; channel->option_anchor_outputs = true; channel->future_per_commitment_point = NULL; @@ -334,7 +335,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid, u32 feerate_base, u32 feerate_ppm, const u8 *remote_upfront_shutdown_script, - bool option_static_remotekey, + u64 local_static_remotekey_start, + u64 remote_static_remotekey_start, bool option_anchor_outputs, enum side closer, enum state_change reason, @@ -423,7 +425,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid, channel->feerate_ppm = feerate_ppm; channel->remote_upfront_shutdown_script = tal_steal(channel, remote_upfront_shutdown_script); - channel->option_static_remotekey = option_static_remotekey; + channel->static_remotekey_start[LOCAL] = local_static_remotekey_start; + channel->static_remotekey_start[REMOTE] = remote_static_remotekey_start; channel->option_anchor_outputs = option_anchor_outputs; channel->forgets = tal_arr(channel, struct command *, 0); diff --git a/lightningd/channel.h b/lightningd/channel.h index d04746450baf..0ea0ca451a12 100644 --- a/lightningd/channel.h +++ b/lightningd/channel.h @@ -188,8 +188,8 @@ struct channel { /* If they used option_upfront_shutdown_script. */ const u8 *remote_upfront_shutdown_script; - /* Was this negotiated with `option_static_remotekey? */ - bool option_static_remotekey; + /* At what commit numbers does `option_static_remotekey` apply? */ + u64 static_remotekey_start[NUM_SIDES]; /* Was this negotiated with `option_anchor_outputs? */ bool option_anchor_outputs; @@ -267,7 +267,8 @@ struct channel *new_channel(struct peer *peer, u64 dbid, u32 feerate_ppm, /* NULL or stolen */ const u8 *remote_upfront_shutdown_script STEALS, - bool option_static_remotekey, + u64 local_static_remotekey_start, + u64 remote_static_remotekey_start, bool option_anchor_outputs, enum side closer, enum state_change reason, diff --git a/lightningd/channel_control.c b/lightningd/channel_control.c index bf9f91cf52ff..e8c87401af1d 100644 --- a/lightningd/channel_control.c +++ b/lightningd/channel_control.c @@ -275,12 +275,6 @@ void channel_fallen_behind(struct channel *channel, const u8 *msg) * use its presence as a flag so set it any valid key in that case. */ if (!channel->future_per_commitment_point) { struct pubkey *any = tal(channel, struct pubkey); - if (!channel->option_static_remotekey) { - channel_internal_error(channel, - "bad channel_fail_fallen_behind %s", - tal_hex(tmpctx, msg)); - return; - } if (!pubkey_from_node_id(any, &channel->peer->ld->id)) fatal("Our own id invalid?"); channel->future_per_commitment_point = any; @@ -376,6 +370,29 @@ void forget_channel(struct channel *channel, const char *why) forget(channel); } +#if EXPERIMENTAL_FEATURES +static void handle_channel_upgrade(struct channel *channel, + const u8 *msg) +{ + bool option_static_remotekey; + + if (!fromwire_channeld_upgraded(msg, &option_static_remotekey)) { + channel_internal_error(channel, "bad handle_channel_upgrade: %s", + tal_hex(tmpctx, msg)); + return; + } + + channel->static_remotekey_start[LOCAL] = channel->next_index[LOCAL]; + channel->static_remotekey_start[REMOTE] = channel->next_index[REMOTE]; + log_debug(channel->log, + "option_static_remotekey enabled at %"PRIu64"/%"PRIu64, + channel->static_remotekey_start[LOCAL], + channel->static_remotekey_start[REMOTE]); + + wallet_channel_save(channel->peer->ld->wallet, channel); +} +#endif /* EXPERIMENTAL_FEATURES */ + static unsigned channel_msg(struct subd *sd, const u8 *msg, const int *fds) { enum channeld_wire t = fromwire_peektype(msg); @@ -411,6 +428,13 @@ static unsigned channel_msg(struct subd *sd, const u8 *msg, const int *fds) case WIRE_CHANNELD_SEND_ERROR_REPLY: handle_error_channel(sd->channel, msg); break; +#if EXPERIMENTAL_FEATURES + case WIRE_CHANNELD_UPGRADED: + handle_channel_upgrade(sd->channel, msg); + break; +#else + case WIRE_CHANNELD_UPGRADED: +#endif /* And we never get these from channeld. */ case WIRE_CHANNELD_INIT: case WIRE_CHANNELD_FUNDING_DEPTH: @@ -608,7 +632,7 @@ void peer_start_channeld(struct channel *channel, remote_ann_bitcoin_sig, /* Set at channel open, even if not * negotiated now! */ - channel->option_static_remotekey, + channel->next_index[LOCAL] >= channel->static_remotekey_start[LOCAL], channel->option_anchor_outputs, IFDEV(ld->dev_fast_gossip, false), IFDEV(dev_fail_process_onionpacket, false), diff --git a/lightningd/onchain_control.c b/lightningd/onchain_control.c index fd6d8e7ea7d5..759ae4180333 100644 --- a/lightningd/onchain_control.c +++ b/lightningd/onchain_control.c @@ -657,6 +657,9 @@ enum watch_result onchaind_funding_spent(struct channel *channel, } } + log_debug(channel->log, "channel->static_remotekey_start[LOCAL] %"PRIu64, + channel->static_remotekey_start[LOCAL]); + msg = towire_onchaind_init(channel, &channel->their_shachain.chain, chainparams, @@ -694,7 +697,8 @@ enum watch_result onchaind_funding_spent(struct channel *channel, channel->future_per_commitment_point, &channel->local_funding_pubkey, &channel->channel_info.remote_fundingkey, - channel->option_static_remotekey, + channel->static_remotekey_start[LOCAL], + channel->static_remotekey_start[REMOTE], channel->option_anchor_outputs, is_replay, feerate_min(ld, NULL)); diff --git a/lightningd/opening_control.c b/lightningd/opening_control.c index 684c472b154e..7a1ffe91e7d6 100644 --- a/lightningd/opening_control.c +++ b/lightningd/opening_control.c @@ -103,7 +103,7 @@ wallet_commit_channel(struct lightningd *ld, struct amount_msat our_msat; struct amount_sat local_funding; s64 final_key_idx; - bool option_static_remotekey; + u64 static_remotekey_start; bool option_anchor_outputs; /* We cannot both be the fundee *and* have a `fundchannel_start` @@ -153,10 +153,13 @@ wallet_commit_channel(struct lightningd *ld, * transactions */ /* i.e. We set it now for the channel permanently. */ - option_static_remotekey - = feature_negotiated(ld->our_features, - uc->peer->their_features, - OPT_STATIC_REMOTEKEY); + if (feature_negotiated(ld->our_features, + uc->peer->their_features, + OPT_STATIC_REMOTEKEY)) + static_remotekey_start = 0; + else + static_remotekey_start = 0x7FFFFFFFFFFFFFFF; + option_anchor_outputs = feature_negotiated(ld->our_features, uc->peer->their_features, @@ -209,7 +212,7 @@ wallet_commit_channel(struct lightningd *ld, ld->config.fee_base, ld->config.fee_per_satoshi, remote_upfront_shutdown_script, - option_static_remotekey, + static_remotekey_start, static_remotekey_start, option_anchor_outputs, NUM_SIDES, /* closer not yet known */ uc->fc ? REASON_USER : REASON_REMOTE, diff --git a/lightningd/peer_control.c b/lightningd/peer_control.c index 812e3f12168d..86d2c69993c5 100644 --- a/lightningd/peer_control.c +++ b/lightningd/peer_control.c @@ -848,7 +848,7 @@ static void json_add_channel(struct lightningd *ld, json_add_null(response, "closer"); json_array_start(response, "features"); - if (channel->option_static_remotekey) + if (channel->static_remotekey_start[LOCAL] != 0x7FFFFFFFFFFFFFFF) json_add_string(response, NULL, "option_static_remotekey"); if (channel->option_anchor_outputs) json_add_string(response, NULL, "option_anchor_outputs"); diff --git a/onchaind/onchaind.c b/onchaind/onchaind.c index 1e1857fa085b..22b6413ce780 100644 --- a/onchaind/onchaind.c +++ b/onchaind/onchaind.c @@ -84,8 +84,8 @@ static struct amount_msat our_msat; /* Needed for anchor outputs */ static struct pubkey funding_pubkey[NUM_SIDES]; -/* Does option_static_remotekey apply to this commitment tx? */ -static bool option_static_remotekey; +/* At what commit number does option_static_remotekey apply? */ +static u64 static_remotekey_start[NUM_SIDES]; /* Does option_anchor_outputs apply to this commitment tx? */ static bool option_anchor_outputs; @@ -2615,7 +2615,7 @@ static void handle_our_unilateral(const struct tx_parts *tx, if (!derive_keyset(&local_per_commitment_point, &basepoints[LOCAL], &basepoints[REMOTE], - option_static_remotekey, + commit_num >= static_remotekey_start[LOCAL], ks)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Deriving keyset for %"PRIu64, commit_num); @@ -3050,7 +3050,7 @@ static void handle_their_cheat(const struct tx_parts *tx, if (!derive_keyset(remote_per_commitment_point, &basepoints[REMOTE], &basepoints[LOCAL], - option_static_remotekey, + commit_num >= static_remotekey_start[REMOTE], ks)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Deriving keyset for %"PRIu64, commit_num); @@ -3063,7 +3063,7 @@ static void handle_their_cheat(const struct tx_parts *tx, " other_payment_key: %s" " self_htlc_key: %s" " other_htlc_key: %s" - " (option_static_remotekey = %i)", + " (static_remotekey = %"PRIu64"/%"PRIu64")", commit_num, type_to_string(tmpctx, struct pubkey, &keyset->self_revocation_key), @@ -3077,7 +3077,8 @@ static void handle_their_cheat(const struct tx_parts *tx, &keyset->self_htlc_key), type_to_string(tmpctx, struct pubkey, &keyset->other_htlc_key), - option_static_remotekey); + static_remotekey_start[LOCAL], + static_remotekey_start[REMOTE]); remote_wscript = to_self_wscript(tmpctx, to_self_delay[REMOTE], keyset); @@ -3154,7 +3155,7 @@ static void handle_their_cheat(const struct tx_parts *tx, tx_blockheight, script[LOCAL], remote_per_commitment_point, - option_static_remotekey); + commit_num >= static_remotekey_start[REMOTE]); script[LOCAL] = NULL; add_amt(&total_outs, amt); continue; @@ -3206,10 +3207,10 @@ static void handle_their_cheat(const struct tx_parts *tx, } matches = match_htlc_output(tmpctx, tx->outputs[i], htlc_scripts); - if (tal_count(matches) == 0) - status_failed(STATUS_FAIL_INTERNAL_ERROR, - "Could not find resolution for output %zu", - i); + if (tal_count(matches) == 0) { + status_broken("Could not find resolution for output %zu: did *we* cheat?", i); + continue; + } /* In this case, we don't care which HTLC we choose; so pick first one */ @@ -3334,7 +3335,7 @@ static void handle_their_unilateral(const struct tx_parts *tx, if (!derive_keyset(remote_per_commitment_point, &basepoints[REMOTE], &basepoints[LOCAL], - option_static_remotekey, + commit_num >= static_remotekey_start[REMOTE], ks)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Deriving keyset for %"PRIu64, commit_num); @@ -3434,7 +3435,7 @@ static void handle_their_unilateral(const struct tx_parts *tx, tx_blockheight, script[LOCAL], remote_per_commitment_point, - option_static_remotekey); + commit_num >= static_remotekey_start[REMOTE]); script[LOCAL] = NULL; add_amt(&our_outs, amt); continue; @@ -3585,7 +3586,6 @@ static void update_ledger_unknown(const struct bitcoin_txid *txid, static void handle_unknown_commitment(const struct tx_parts *tx, u32 tx_blockheight, - u64 commit_num, const struct pubkey *possible_remote_per_commitment_point, const struct basepoints basepoints[NUM_SIDES], const struct htlc_stub *htlcs, @@ -3594,79 +3594,86 @@ static void handle_unknown_commitment(const struct tx_parts *tx, bool is_replay) { int to_us_output = -1; - u8 *local_script; + /* We have two possible local scripts, depending on options */ + u8 *local_scripts[2]; struct amount_sat amt_salvaged = AMOUNT_SAT(0); onchain_annotate_txin(&tx->txid, 0, TX_CHANNEL_UNILATERAL | TX_THEIRS); resolved_by_other(outs[0], &tx->txid, UNKNOWN_UNILATERAL); - /* If they don't give us a per-commitment point and we rotate keys, - * we're out of luck. */ - if (!possible_remote_per_commitment_point - && !option_static_remotekey) { - goto search_done; - } - - if (!option_static_remotekey) { + /* This is the not-option_static_remotekey case, if we got a hint + * from them about the per-commitment point */ + if (possible_remote_per_commitment_point) { struct keyset *ks = tal(tmpctx, struct keyset); if (!derive_keyset(possible_remote_per_commitment_point, &basepoints[REMOTE], &basepoints[LOCAL], - option_static_remotekey, + false, ks)) status_failed(STATUS_FAIL_INTERNAL_ERROR, "Deriving keyset for possible_remote_per_commitment_point %s", type_to_string(tmpctx, struct pubkey, possible_remote_per_commitment_point)); - local_script = scriptpubkey_p2wpkh(tmpctx, - &ks->other_payment_key); + local_scripts[0] = scriptpubkey_p2wpkh(tmpctx, + &ks->other_payment_key); } else { - local_script = scriptpubkey_to_remote(tmpctx, - &basepoints[LOCAL].payment); + local_scripts[0] = NULL; } + /* Other possible local script is for option_static_remotekey */ + local_scripts[1] = scriptpubkey_to_remote(tmpctx, + &basepoints[LOCAL].payment); + for (size_t i = 0; i < tal_count(tx->outputs); i++) { struct tracked_output *out; struct amount_asset asset = wally_tx_output_get_amount(tx->outputs[i]); struct amount_sat amt; + int which_script; + assert(amount_asset_is_main(&asset)); amt = amount_asset_to_sat(&asset); - if (local_script - && wally_tx_output_scripteq(tx->outputs[i], - local_script)) { - /* BOLT #5: - * - * - MAY take no action in regard to the associated - * `to_remote`, which is simply a P2WPKH output to - * the *local node*. - * - Note: `to_remote` is considered *resolved* by the - * commitment transaction itself. - */ - out = new_tracked_output(&outs, &tx->txid, tx_blockheight, - UNKNOWN_UNILATERAL, - i, amt, - OUTPUT_TO_US, NULL, NULL, NULL); - ignore_output(out); + /* Elements can have empty output scripts (fee output) */ + if (local_scripts[0] + && wally_tx_output_scripteq(tx->outputs[i], local_scripts[0])) + which_script = 0; + else if (local_scripts[1] + && wally_tx_output_scripteq(tx->outputs[i], + local_scripts[1])) + which_script = 1; + else + continue; - if (!is_replay) - record_channel_withdrawal(&tx->txid, tx_blockheight, out); + /* BOLT #5: + * + * - MAY take no action in regard to the associated + * `to_remote`, which is simply a P2WPKH output to + * the *local node*. + * - Note: `to_remote` is considered *resolved* by the + * commitment transaction itself. + */ + out = new_tracked_output(&outs, &tx->txid, tx_blockheight, + UNKNOWN_UNILATERAL, + i, amt, + OUTPUT_TO_US, NULL, NULL, NULL); + ignore_output(out); - add_amt(&amt_salvaged, amt); + if (!is_replay) + record_channel_withdrawal(&tx->txid, tx_blockheight, out); - tell_wallet_to_remote(tx, i, - tx_blockheight, - local_script, - possible_remote_per_commitment_point, - option_static_remotekey); - local_script = NULL; - to_us_output = i; - } + add_amt(&amt_salvaged, amt); + + tell_wallet_to_remote(tx, i, + tx_blockheight, + local_scripts[which_script], + possible_remote_per_commitment_point, + which_script == 1); + local_scripts[0] = local_scripts[1] = NULL; + to_us_output = i; } -search_done: if (to_us_output == -1) { status_broken("FUNDS LOST. Unknown commitment #%"PRIu64"!", commit_num); @@ -3769,7 +3776,8 @@ int main(int argc, char *argv[]) &possible_remote_per_commitment_point, &funding_pubkey[LOCAL], &funding_pubkey[REMOTE], - &option_static_remotekey, + &static_remotekey_start[LOCAL], + &static_remotekey_start[REMOTE], &option_anchor_outputs, &open_is_replay, &min_relay_feerate)) { @@ -3905,7 +3913,6 @@ int main(int argc, char *argv[]) open_is_replay); } else { handle_unknown_commitment(tx, tx_blockheight, - commit_num, possible_remote_per_commitment_point, basepoints, htlcs, diff --git a/onchaind/onchaind_wire.csv b/onchaind/onchaind_wire.csv index d0e88eef2889..926ffb3924de 100644 --- a/onchaind/onchaind_wire.csv +++ b/onchaind/onchaind_wire.csv @@ -46,7 +46,8 @@ msgdata,onchaind_init,max_possible_feerate,u32, msgdata,onchaind_init,possible_remote_per_commit_point,?pubkey, msgdata,onchaind_init,local_funding_pubkey,pubkey, msgdata,onchaind_init,remote_funding_pubkey,pubkey, -msgdata,onchaind_init,option_static_remotekey,bool, +msgdata,onchaind_init,local_static_remotekey_start,u64, +msgdata,onchaind_init,remote_static_remotekey_start,u64, msgdata,onchaind_init,option_anchor_outputs,bool, msgdata,onchaind_init,is_replay,bool, # We need this for BIP125 rule 4 diff --git a/onchaind/onchaind_wiregen.c b/onchaind/onchaind_wiregen.c index 155bffbcd37b..381c0376cdd6 100644 --- a/onchaind/onchaind_wiregen.c +++ b/onchaind/onchaind_wiregen.c @@ -76,7 +76,7 @@ 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, bool option_static_remotekey, bool option_anchor_outputs, bool is_replay, u32 min_relay_feerate) +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); @@ -130,7 +130,8 @@ u8 *towire_onchaind_init(const tal_t *ctx, const struct shachain *shachain, cons } towire_pubkey(&p, local_funding_pubkey); towire_pubkey(&p, remote_funding_pubkey); - towire_bool(&p, option_static_remotekey); + 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 */ @@ -138,7 +139,7 @@ u8 *towire_onchaind_init(const tal_t *ctx, const struct shachain *shachain, cons 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, bool *option_static_remotekey, 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) { u16 local_scriptpubkey_len; u16 remote_scriptpubkey_len; @@ -201,7 +202,8 @@ bool fromwire_onchaind_init(const tal_t *ctx, const void *p, struct shachain *sh } fromwire_pubkey(&cursor, &plen, local_funding_pubkey); fromwire_pubkey(&cursor, &plen, remote_funding_pubkey); - *option_static_remotekey = fromwire_bool(&cursor, &plen); + *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 */ @@ -635,4 +637,4 @@ bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt fromwire_chain_coin_mvt(&cursor, &plen, mvt); return cursor != NULL; } -// SHA256STAMP:ef6140d74f021a554c055b0f9b6322334559e6c2059ea51abf1bda2bc90add41 +// SHA256STAMP:66e19538be7f5a9e9076bfe995a9bf0cbb5d303df8f6c383e427c11ef2e85e2e diff --git a/onchaind/onchaind_wiregen.h b/onchaind/onchaind_wiregen.h index e557d6dc3305..48692bae739b 100644 --- a/onchaind/onchaind_wiregen.h +++ b/onchaind/onchaind_wiregen.h @@ -69,8 +69,8 @@ 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, bool option_static_remotekey, 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, bool *option_static_remotekey, bool *option_anchor_outputs, bool *is_replay, u32 *min_relay_feerate); +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 */ @@ -161,4 +161,4 @@ bool fromwire_onchaind_notify_coin_mvt(const void *p, struct chain_coin_mvt *mvt #endif /* LIGHTNING_ONCHAIND_ONCHAIND_WIREGEN_H */ -// SHA256STAMP:ef6140d74f021a554c055b0f9b6322334559e6c2059ea51abf1bda2bc90add41 +// SHA256STAMP:66e19538be7f5a9e9076bfe995a9bf0cbb5d303df8f6c383e427c11ef2e85e2e diff --git a/onchaind/test/onchainstress-data.gz b/onchaind/test/onchainstress-data.gz index fa43fb21a13e..cdf57c1a1b25 100644 Binary files a/onchaind/test/onchainstress-data.gz and b/onchaind/test/onchainstress-data.gz differ diff --git a/onchaind/test/run-grind_feerate-bug.c b/onchaind/test/run-grind_feerate-bug.c index b38812c7558d..f6a77c2ecb62 100644 --- a/onchaind/test/run-grind_feerate-bug.c +++ b/onchaind/test/run-grind_feerate-bug.c @@ -50,7 +50,7 @@ bool fromwire_onchaind_dev_memleak(const void *p UNNEEDED) bool fromwire_onchaind_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED) { fprintf(stderr, "fromwire_onchaind_htlc called!\n"); abort(); } /* Generated stub for fromwire_onchaind_init */ -bool fromwire_onchaind_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, bool *option_static_remotekey UNNEEDED, bool *option_anchor_outputs UNNEEDED, bool *is_replay UNNEEDED, u32 *min_relay_feerate UNNEEDED) +bool fromwire_onchaind_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, u64 *local_static_remotekey_start UNNEEDED, u64 *remote_static_remotekey_start UNNEEDED, bool *option_anchor_outputs UNNEEDED, bool *is_replay UNNEEDED, u32 *min_relay_feerate UNNEEDED) { fprintf(stderr, "fromwire_onchaind_init called!\n"); abort(); } /* Generated stub for fromwire_onchaind_known_preimage */ bool fromwire_onchaind_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED, bool *is_replay UNNEEDED) diff --git a/onchaind/test/run-grind_feerate.c b/onchaind/test/run-grind_feerate.c index 6c794b4ad8e1..0a9b3d4ca945 100644 --- a/onchaind/test/run-grind_feerate.c +++ b/onchaind/test/run-grind_feerate.c @@ -54,7 +54,7 @@ bool fromwire_onchaind_dev_memleak(const void *p UNNEEDED) bool fromwire_onchaind_htlc(const void *p UNNEEDED, struct htlc_stub *htlc UNNEEDED, bool *tell_if_missing UNNEEDED, bool *tell_immediately UNNEEDED) { fprintf(stderr, "fromwire_onchaind_htlc called!\n"); abort(); } /* Generated stub for fromwire_onchaind_init */ -bool fromwire_onchaind_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, bool *option_static_remotekey UNNEEDED, bool *option_anchor_outputs UNNEEDED, bool *is_replay UNNEEDED, u32 *min_relay_feerate UNNEEDED) +bool fromwire_onchaind_init(const tal_t *ctx UNNEEDED, const void *p UNNEEDED, struct shachain *shachain UNNEEDED, const struct chainparams **chainparams UNNEEDED, struct amount_sat *funding_amount_satoshi UNNEEDED, struct amount_msat *our_msat UNNEEDED, struct pubkey *old_remote_per_commitment_point UNNEEDED, struct pubkey *remote_per_commitment_point UNNEEDED, u32 *local_to_self_delay UNNEEDED, u32 *remote_to_self_delay UNNEEDED, u32 *delayed_to_us_feerate UNNEEDED, u32 *htlc_feerate UNNEEDED, u32 *penalty_feerate UNNEEDED, struct amount_sat *local_dust_limit_satoshi UNNEEDED, struct bitcoin_txid *our_broadcast_txid UNNEEDED, u8 **local_scriptpubkey UNNEEDED, u8 **remote_scriptpubkey UNNEEDED, struct pubkey *ourwallet_pubkey UNNEEDED, enum side *opener UNNEEDED, struct basepoints *local_basepoints UNNEEDED, struct basepoints *remote_basepoints UNNEEDED, struct tx_parts **tx_parts UNNEEDED, u32 *locktime UNNEEDED, u32 *tx_blockheight UNNEEDED, u32 *reasonable_depth UNNEEDED, struct bitcoin_signature **htlc_signature UNNEEDED, u64 *num_htlcs UNNEEDED, u32 *min_possible_feerate UNNEEDED, u32 *max_possible_feerate UNNEEDED, struct pubkey **possible_remote_per_commit_point UNNEEDED, struct pubkey *local_funding_pubkey UNNEEDED, struct pubkey *remote_funding_pubkey UNNEEDED, u64 *local_static_remotekey_start UNNEEDED, u64 *remote_static_remotekey_start UNNEEDED, bool *option_anchor_outputs UNNEEDED, bool *is_replay UNNEEDED, u32 *min_relay_feerate UNNEEDED) { fprintf(stderr, "fromwire_onchaind_init called!\n"); abort(); } /* Generated stub for fromwire_onchaind_known_preimage */ bool fromwire_onchaind_known_preimage(const void *p UNNEEDED, struct preimage *preimage UNNEEDED, bool *is_replay UNNEEDED) diff --git a/openingd/dualopend.c b/openingd/dualopend.c index 5ebae60b291f..ed5f58300198 100644 --- a/openingd/dualopend.c +++ b/openingd/dualopend.c @@ -3164,6 +3164,9 @@ static void do_reconnect_dance(struct state *state) last_remote_per_commit_secret; struct pubkey remote_current_per_commit_point; struct tx_state *tx_state = state->tx_state; +#if EXPERIMENTAL_FEATURES + struct tlv_channel_reestablish_tlvs *tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); +#endif /* BOLT #2: * - if `next_revocation_number` equals 0: @@ -3177,7 +3180,11 @@ static void do_reconnect_dance(struct state *state) msg = towire_channel_reestablish (NULL, &state->channel_id, 1, 0, &last_remote_per_commit_secret, - &state->first_per_commitment_point[LOCAL]); + &state->first_per_commitment_point[LOCAL] +#if EXPERIMENTAL_FEATURES + , tlvs +#endif + ); sync_crypto_write(state->pps, take(msg)); peer_billboard(false, "Sent reestablish, waiting for theirs"); @@ -3200,7 +3207,11 @@ static void do_reconnect_dance(struct state *state) &next_commitment_number, &next_revocation_number, &last_local_per_commit_secret, - &remote_current_per_commit_point)) + &remote_current_per_commit_point +#if EXPERIMENTAL_FEATURES + , tlvs +#endif + )) open_err_fatal(state, "Bad reestablish msg: %s %s", peer_wire_name(fromwire_peektype(msg)), tal_hex(msg, msg)); diff --git a/openingd/dualopend_wiregen.c b/openingd/dualopend_wiregen.c index 21ace02e4cb4..21d658ecb710 100644 --- a/openingd/dualopend_wiregen.c +++ b/openingd/dualopend_wiregen.c @@ -912,4 +912,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:0cbaf66a07e1ffa2e01a85398b6937391af66eb78302e22fe7b9a3076963db4e +// SHA256STAMP:0a1ed6e8461512630be3bb328083495d5c5f682c59dfb24561024ba8fa0d3b70 diff --git a/openingd/dualopend_wiregen.h b/openingd/dualopend_wiregen.h index ac4c0597a1f2..de36baf2f782 100644 --- a/openingd/dualopend_wiregen.h +++ b/openingd/dualopend_wiregen.h @@ -216,4 +216,4 @@ bool fromwire_dualopend_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_DUALOPEND_WIREGEN_H */ -// SHA256STAMP:0cbaf66a07e1ffa2e01a85398b6937391af66eb78302e22fe7b9a3076963db4e +// SHA256STAMP:0a1ed6e8461512630be3bb328083495d5c5f682c59dfb24561024ba8fa0d3b70 diff --git a/openingd/openingd_wiregen.c b/openingd/openingd_wiregen.c index 28442fda3cea..7f615aa0996d 100644 --- a/openingd/openingd_wiregen.c +++ b/openingd/openingd_wiregen.c @@ -569,4 +569,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak) *leak = fromwire_bool(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:edd7ee392dff0ddd0dff3a383692ba852a403e64e43290dba5dece69ae438e61 +// SHA256STAMP:d2fcabdf157b098608e47dcdc37db0f46fe8d466d74159969544d7c4bb77f061 diff --git a/openingd/openingd_wiregen.h b/openingd/openingd_wiregen.h index ba64e5567272..047c82110783 100644 --- a/openingd/openingd_wiregen.h +++ b/openingd/openingd_wiregen.h @@ -121,4 +121,4 @@ bool fromwire_openingd_dev_memleak_reply(const void *p, bool *leak); #endif /* LIGHTNING_OPENINGD_OPENINGD_WIREGEN_H */ -// SHA256STAMP:edd7ee392dff0ddd0dff3a383692ba852a403e64e43290dba5dece69ae438e61 +// SHA256STAMP:d2fcabdf157b098608e47dcdc37db0f46fe8d466d74159969544d7c4bb77f061 diff --git a/tests/test_connection.py b/tests/test_connection.py index e2ede44dfe8a..ecadb4b208a5 100644 --- a/tests/test_connection.py +++ b/tests/test_connection.py @@ -3478,6 +3478,181 @@ def test_openchannel_init_alternate(node_factory, executor): print("nothing to do") +@unittest.skipIf(not EXPERIMENTAL_FEATURES, "upgrade protocol not available") +@pytest.mark.developer("dev-force-features required") +def test_upgrade_statickey(node_factory, executor): + """l1 doesn't have option_static_remotekey, l2 offers it.""" + l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True, + 'dev-force-features': ["-13", "-21"]}, + {'may_reconnect': True}]) + + l1.rpc.disconnect(l2.info['id'], force=True) + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + + l1.daemon.wait_for_logs([r"They sent current_type \[\]", + r"They offered upgrade to \[13\]"]) + l2.daemon.wait_for_log(r"They sent desired_type \[13\]") + + l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + l2.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + + # Make sure it's committed to db! + wait_for(lambda: l1.db_query('SELECT local_static_remotekey_start, remote_static_remotekey_start FROM channels;') == [{'local_static_remotekey_start': 1, 'remote_static_remotekey_start': 1}]) + + # They will consider themselves upgraded. + l1.rpc.disconnect(l2.info['id'], force=True) + # They won't offer upgrade! + assert not l1.daemon.is_in_log("They offered upgrade", + start=l1.daemon.logsearch_start) + l1.daemon.wait_for_log(r"They sent current_type \[13\]") + l2.daemon.wait_for_log(r"They sent desired_type \[13\]") + + +@unittest.skipIf(not EXPERIMENTAL_FEATURES, "upgrade protocol not available") +@pytest.mark.developer("dev-force-features required") +def test_upgrade_statickey_onchaind(node_factory, executor, bitcoind): + """We test penalty before/after, and unilateral before/after""" + l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True, + 'dev-force-features': ["-13", "-21"], + # We try to cheat! + 'allow_broken_log': True}, + {'may_reconnect': True}]) + + # TEST 1: Cheat from pre-upgrade. + tx = l1.rpc.dev_sign_last_tx(l2.info['id'])['tx'] + + l1.rpc.disconnect(l2.info['id'], force=True) + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + + # Pre-statickey penalty works. + bitcoind.rpc.sendrawtransaction(tx) + bitcoind.generate_block(1) + + l2.wait_for_onchaind_broadcast('OUR_PENALTY_TX', + 'THEIR_REVOKED_UNILATERAL/DELAYED_CHEAT_OUTPUT_TO_THEM') + bitcoind.generate_block(100) + wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 0) + + # TEST 2: Cheat from post-upgrade. + node_factory.join_nodes([l1, l2]) + l1.rpc.disconnect(l2.info['id'], force=True) + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + + l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + l2.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + + l1.pay(l2, 1000000) + + # We will try to cheat later. + tx = l1.rpc.dev_sign_last_tx(l2.info['id'])['tx'] + + l1.pay(l2, 1000000) + + # Pre-statickey penalty works. + bitcoind.rpc.sendrawtransaction(tx) + bitcoind.generate_block(1) + + l2.wait_for_onchaind_broadcast('OUR_PENALTY_TX', + 'THEIR_REVOKED_UNILATERAL/DELAYED_CHEAT_OUTPUT_TO_THEM') + bitcoind.generate_block(100) + wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 0) + + # TEST 3: Unilateral close from pre-upgrade + node_factory.join_nodes([l1, l2]) + + # Give them both something for onchain close. + l1.pay(l2, 1000000) + + # Make sure it's completely quiescent. + l1.daemon.wait_for_log("chan#3: Removing out HTLC 0 state RCVD_REMOVE_ACK_REVOCATION FULFILLED") + + l1.rpc.disconnect(l2.info['id'], force=True) + l1.daemon.wait_for_log('option_static_remotekey enabled at 3/3') + + # But this is the *pre*-update commit tx! + l2.stop() + l1.rpc.close(l2.info['id'], unilateraltimeout=1) + bitcoind.generate_block(1, wait_for_mempool=1) + l2.start() + + # They should both handle it fine. + l1.daemon.wait_for_log('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks') + l2.daemon.wait_for_logs(['Ignoring output .*: THEIR_UNILATERAL/OUTPUT_TO_US', + 'Ignoring output .*: THEIR_UNILATERAL/DELAYED_OUTPUT_TO_THEM']) + bitcoind.generate_block(5) + bitcoind.generate_block(100, wait_for_mempool=1) + + wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 0) + + # TEST 4: Unilateral close from post-upgrade + node_factory.join_nodes([l1, l2]) + + l1.rpc.disconnect(l2.info['id'], force=True) + l1.daemon.wait_for_log('option_static_remotekey enabled at 1/1') + + # Move to static_remotekey. + l1.pay(l2, 1000000) + + l2.stop() + l1.rpc.close(l2.info['id'], unilateraltimeout=1) + bitcoind.generate_block(1, wait_for_mempool=1) + l2.start() + + # They should both handle it fine. + l1.daemon.wait_for_log('Propose handling OUR_UNILATERAL/DELAYED_OUTPUT_TO_US by OUR_DELAYED_RETURN_TO_WALLET .* after 5 blocks') + l2.daemon.wait_for_logs(['Ignoring output .*: THEIR_UNILATERAL/OUTPUT_TO_US', + 'Ignoring output .*: THEIR_UNILATERAL/DELAYED_OUTPUT_TO_THEM']) + + bitcoind.generate_block(5) + bitcoind.generate_block(100, wait_for_mempool=1) + + wait_for(lambda: len(l2.rpc.listpeers()['peers']) == 0) + + +@unittest.skipIf(not EXPERIMENTAL_FEATURES, "upgrade protocol not available") +@pytest.mark.developer("dev-force-features, dev-disconnect required") +def test_upgrade_statickey_fail(node_factory, executor, bitcoind): + """We reconnect at all points during retransmit, and we won't upgrade.""" + l1_disconnects = ['-WIRE_COMMITMENT_SIGNED', + '-WIRE_REVOKE_AND_ACK'] + l2_disconnects = ['-WIRE_REVOKE_AND_ACK', + '-WIRE_COMMITMENT_SIGNED', + '=WIRE_UPDATE_FAIL_HTLC-nocommit'] + + l1, l2 = node_factory.line_graph(2, opts=[{'may_reconnect': True, + 'dev-no-reconnect': None, + 'disconnect': l1_disconnects, + 'dev-force-features': ["-13", "-21"], + # Don't have feerate changes! + 'feerates': (7500, 7500, 7500, 7500)}, + {'may_reconnect': True, + 'dev-no-reconnect': None, + 'disconnect': l2_disconnects}]) + + # This HTLC will fail + l1.rpc.sendpay([{'msatoshi': 1000, 'id': l2.info['id'], 'delay': 5, 'channel': '1x1x1'}], '00' * 32) + + # Each one should cause one disconnection, no upgrade. + for d in l1_disconnects + l2_disconnects[:-1]: + l1.daemon.wait_for_log('Peer connection lost') + l2.daemon.wait_for_log('Peer connection lost') + assert not l1.daemon.is_in_log('option_static_remotekey enabled') + assert not l2.daemon.is_in_log('option_static_remotekey enabled') + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + + # On the last reconnect, it retransmitted revoke_and_ack. + l1.daemon.wait_for_log('No upgrade: we retransmitted') + l2.daemon.wait_for_log('No upgrade: pending changes') + + # Now when we reconnect, despite having an HTLC, we're quiescent. + l1.rpc.disconnect(l2.info['id'], force=True) + l1.rpc.connect(l2.info['id'], 'localhost', l2.port) + + l1.daemon.wait_for_log('option_static_remotekey enabled at 2/2') + l2.daemon.wait_for_log('option_static_remotekey enabled at 2/2') + + @unittest.skipIf(not EXPERIMENTAL_FEATURES, "quiescence is experimental") @pytest.mark.developer("quiescence triggering is dev only") def test_quiescence(node_factory, executor): diff --git a/tools/gen/impl_template b/tools/gen/impl_template index 0d1cc6991453..8df0bb035fa1 100644 --- a/tools/gen/impl_template +++ b/tools/gen/impl_template @@ -244,7 +244,7 @@ static void fromwire_${msg.struct_name()}(const u8 **cursor, size_t *plen, void fieldname = 'r->{}->{}'.format(msg.name, f.name) ctx = 'r->{}'.format(msg.name) %>\ - ${fromwire_subtype_field(fieldname, f, ctx, msg.singleton())}\ + ${fromwire_subtype_field(fieldname, f, ctx, msg.singleton() and not f.type_obj.is_varsize())}\ % endfor } % endfor diff --git a/tools/test/test_cases b/tools/test/test_cases index 4854a1dbfa16..6ff99f53afd4 100644 --- a/tools/test/test_cases +++ b/tools/test/test_cases @@ -148,3 +148,10 @@ tlvdata,test_n3,tlv3,len_varlenvarsize,u8, tlvdata,test_n3,tlv3,varlen_varsize,test_features,len_varlenvarsize # implicit length tlvdata,test_n3,tlv3,remainder,byte,... +# Singletons which needs a context. +tlvtype,test_n3,tlv4,4 +tlvdata,test_n3,tlv4,singleton_varlen,subtype_var_len, +tlvtype,test_n3,tlv5,5 +tlvdata,test_n3,tlv5,singleton_varlen_arr,subtype_var_len,... +tlvtype,test_n3,tlv6,6 +tlvdata,test_n3,tlv6,singleton_varlen_assign,subtype_var_assign, diff --git a/wallet/db.c b/wallet/db.c index 60e5b73396f6..be0fc74d42ff 100644 --- a/wallet/db.c +++ b/wallet/db.c @@ -717,6 +717,17 @@ static struct migration dbmigrations[] = { {SQL("ALTER TABLE channels ADD shutdown_wrong_txid BLOB DEFAULT NULL"), NULL}, {SQL("ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL"), NULL}, {NULL, migrate_inflight_last_tx_to_psbt}, + /* Channels can now change their type at specific commit indexes. */ + {SQL("ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0"), + NULL}, + {SQL("ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0"), + NULL}, + /* Set counter past 2^48 if they don't have option */ + {SQL("UPDATE channels SET" + " remote_static_remotekey_start = 9223372036854775807," + " local_static_remotekey_start = 9223372036854775807" + " WHERE option_static_remotekey = 0"), + NULL}, }; /* Leak tracking. */ diff --git a/wallet/db_postgres_sqlgen.c b/wallet/db_postgres_sqlgen.c index 1e4899c67f3c..fdc08f9dd521 100644 --- a/wallet/db_postgres_sqlgen.c +++ b/wallet/db_postgres_sqlgen.c @@ -938,6 +938,24 @@ struct db_query db_postgres_queries[] = { .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 = "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", @@ -1305,8 +1323,8 @@ struct db_query db_postgres_queries[] = { .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, option_static_remotekey, 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 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, option_static_remotekey, 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 FROM channels WHERE state != $1;", + .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 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 FROM channels WHERE state != $1;", .placeholders = 1, .readonly = true, }, @@ -1371,9 +1389,9 @@ struct db_query db_postgres_queries[] = { .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=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? 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, option_static_remotekey=$31, option_anchor_outputs=$32, shutdown_scriptpubkey_local=$33, closer=$34, state_change_reason=$35, shutdown_wrong_txid=$36, shutdown_wrong_outnum=$37 WHERE id=$38", - .placeholders = 38, + .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=? 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 WHERE id=$39", + .placeholders = 39, .readonly = false, }, { @@ -1900,10 +1918,10 @@ struct db_query db_postgres_queries[] = { }, }; -#define DB_POSTGRES_QUERY_COUNT 315 +#define DB_POSTGRES_QUERY_COUNT 318 #endif /* HAVE_POSTGRES */ #endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */ -// SHA256STAMP:2839b3ea02654d43cce04742850e4c42541818c1641ab5119f077d859a288e5a +// SHA256STAMP:8881af1d864eeb8541b44a9dbbd48b8be848146d60ef45011e91c6e3009e9c75 diff --git a/wallet/db_sqlite3_sqlgen.c b/wallet/db_sqlite3_sqlgen.c index 79582f04f224..be9d769fb831 100644 --- a/wallet/db_sqlite3_sqlgen.c +++ b/wallet/db_sqlite3_sqlgen.c @@ -938,6 +938,24 @@ struct db_query db_sqlite3_queries[] = { .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 = "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 = ?", @@ -1305,8 +1323,8 @@ struct db_query db_sqlite3_queries[] = { .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, option_static_remotekey, 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 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, option_static_remotekey, 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 FROM channels WHERE state != ?;", + .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 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 FROM channels WHERE state != ?;", .placeholders = 1, .readonly = true, }, @@ -1371,9 +1389,9 @@ struct db_query db_sqlite3_queries[] = { .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=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? 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=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? WHERE id=?", - .placeholders = 38, + .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=? 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=? WHERE id=?", + .placeholders = 39, .readonly = false, }, { @@ -1900,10 +1918,10 @@ struct db_query db_sqlite3_queries[] = { }, }; -#define DB_SQLITE3_QUERY_COUNT 315 +#define DB_SQLITE3_QUERY_COUNT 318 #endif /* HAVE_SQLITE3 */ #endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */ -// SHA256STAMP:2839b3ea02654d43cce04742850e4c42541818c1641ab5119f077d859a288e5a +// SHA256STAMP:8881af1d864eeb8541b44a9dbbd48b8be848146d60ef45011e91c6e3009e9c75 diff --git a/wallet/statements_gettextgen.po b/wallet/statements_gettextgen.po index f41b5e86ab1b..0e9325b6037c 100644 --- a/wallet/statements_gettextgen.po +++ b/wallet/statements_gettextgen.po @@ -618,83 +618,95 @@ msgstr "" msgid "ALTER TABLE channels ADD shutdown_wrong_outnum INTEGER DEFAULT NULL" msgstr "" -#: wallet/db.c:946 +#: wallet/db.c:721 +msgid "ALTER TABLE channels ADD local_static_remotekey_start BIGINT DEFAULT 0" +msgstr "" + +#: wallet/db.c:723 +msgid "ALTER TABLE channels ADD remote_static_remotekey_start BIGINT DEFAULT 0" +msgstr "" + +#: wallet/db.c:726 +msgid "UPDATE channels SET remote_static_remotekey_start = 9223372036854775807, local_static_remotekey_start = 9223372036854775807 WHERE option_static_remotekey = 0" +msgstr "" + +#: wallet/db.c:957 msgid "UPDATE vars SET intval = intval + 1 WHERE name = 'data_version' AND intval = ?" msgstr "" -#: wallet/db.c:1046 +#: wallet/db.c:1057 msgid "SELECT version FROM version LIMIT 1" msgstr "" -#: wallet/db.c:1108 +#: wallet/db.c:1119 msgid "UPDATE version SET version=?;" msgstr "" -#: wallet/db.c:1116 +#: wallet/db.c:1127 msgid "INSERT INTO db_upgrades VALUES (?, ?);" msgstr "" -#: wallet/db.c:1128 +#: wallet/db.c:1139 msgid "SELECT intval FROM vars WHERE name = 'data_version'" msgstr "" -#: wallet/db.c:1155 +#: wallet/db.c:1166 msgid "SELECT intval FROM vars WHERE name= ? LIMIT 1" msgstr "" -#: wallet/db.c:1171 +#: wallet/db.c:1182 msgid "UPDATE vars SET intval=? WHERE name=?;" msgstr "" -#: wallet/db.c:1180 +#: wallet/db.c:1191 msgid "INSERT INTO vars (name, intval) VALUES (?, ?);" msgstr "" -#: wallet/db.c:1194 +#: wallet/db.c:1205 msgid "UPDATE channels SET feerate_base = ?, feerate_ppm = ?;" msgstr "" -#: wallet/db.c:1215 +#: wallet/db.c:1226 msgid "UPDATE channels SET our_funding_satoshi = funding_satoshi WHERE funder = 0;" msgstr "" -#: wallet/db.c:1231 +#: wallet/db.c:1242 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:1293 +#: wallet/db.c:1304 msgid "UPDATE outputs SET scriptpubkey = ? WHERE prev_out_tx = ? AND prev_out_index = ?" msgstr "" -#: wallet/db.c:1318 +#: wallet/db.c:1329 msgid "SELECT id, funding_tx_id, funding_tx_outnum FROM channels;" msgstr "" -#: wallet/db.c:1337 +#: wallet/db.c:1348 msgid "UPDATE channels SET full_channel_id = ? WHERE id = ?;" msgstr "" -#: wallet/db.c:1358 +#: wallet/db.c:1369 msgid "SELECT channels.id, peers.node_id FROM channels JOIN peers ON (peers.id = channels.peer_id)" msgstr "" -#: wallet/db.c:1391 +#: wallet/db.c:1402 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:1417 +#: wallet/db.c:1428 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:1484 +#: wallet/db.c:1495 msgid "UPDATE channel_funding_inflights SET last_tx = ? WHERE channel_id = ? AND funding_tx_id = ?;" msgstr "" -#: wallet/db.c:1508 +#: wallet/db.c:1519 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:1575 +#: wallet/db.c:1586 msgid "UPDATE channels SET last_tx = ? WHERE id = ?;" msgstr "" @@ -858,387 +870,387 @@ msgstr "" 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 FROM channel_funding_inflights WHERE channel_id = ? ORDER BY funding_feerate" msgstr "" -#: wallet/wallet.c:1308 +#: wallet/wallet.c:1309 msgid "SELECT id FROM channels ORDER BY id DESC LIMIT 1;" msgstr "" -#: wallet/wallet.c:1325 -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, option_static_remotekey, 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 FROM channels WHERE state != ?;" +#: wallet/wallet.c:1326 +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 FROM channels WHERE state != ?;" msgstr "" -#: wallet/wallet.c:1432 +#: wallet/wallet.c:1434 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:1438 +#: wallet/wallet.c:1440 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:1444 +#: wallet/wallet.c:1446 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:1450 +#: wallet/wallet.c:1452 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:1495 +#: wallet/wallet.c:1497 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:1524 +#: wallet/wallet.c:1526 msgid "SELECT MIN(height), MAX(height) FROM blocks;" msgstr "" -#: wallet/wallet.c:1546 +#: wallet/wallet.c:1548 msgid "INSERT INTO channel_configs DEFAULT VALUES;" msgstr "" -#: wallet/wallet.c:1558 +#: wallet/wallet.c:1560 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:1582 +#: wallet/wallet.c:1584 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:1616 +#: wallet/wallet.c:1618 msgid "UPDATE channels SET remote_ann_node_sig=?, remote_ann_bitcoin_sig=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1635 -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=?, option_static_remotekey=?, option_anchor_outputs=?, shutdown_scriptpubkey_local=?, closer=?, state_change_reason=?, shutdown_wrong_txid=?, shutdown_wrong_outnum=? WHERE id=?" +#: wallet/wallet.c:1637 +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=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1727 +#: wallet/wallet.c:1731 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:1754 +#: wallet/wallet.c:1758 msgid "DELETE FROM channel_feerates WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1764 +#: wallet/wallet.c:1768 msgid "INSERT INTO channel_feerates VALUES(?, ?, ?)" msgstr "" -#: wallet/wallet.c:1781 +#: wallet/wallet.c:1785 msgid "UPDATE channels SET last_sent_commit=? WHERE id=?" msgstr "" -#: wallet/wallet.c:1804 +#: wallet/wallet.c:1808 msgid "INSERT INTO channel_state_changes ( channel_id, timestamp, old_state, new_state, cause, message) VALUES (?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:1832 +#: wallet/wallet.c:1836 msgid "SELECT timestamp, old_state, new_state, cause, message FROM channel_state_changes WHERE channel_id = ? ORDER BY timestamp ASC;" msgstr "" -#: wallet/wallet.c:1861 +#: wallet/wallet.c:1865 msgid "SELECT id FROM peers WHERE node_id = ?" msgstr "" -#: wallet/wallet.c:1873 +#: wallet/wallet.c:1877 msgid "UPDATE peers SET address = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:1882 +#: wallet/wallet.c:1886 msgid "INSERT INTO peers (node_id, address) VALUES (?, ?);" msgstr "" -#: wallet/wallet.c:1903 +#: wallet/wallet.c:1907 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:1944 +#: wallet/wallet.c:1948 msgid "DELETE FROM channel_htlcs WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1950 +#: wallet/wallet.c:1954 msgid "DELETE FROM htlc_sigs WHERE channelid=?" msgstr "" -#: wallet/wallet.c:1956 +#: wallet/wallet.c:1960 msgid "DELETE FROM channeltxs WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1963 +#: wallet/wallet.c:1967 msgid "DELETE FROM channel_funding_inflights WHERE channel_id=?" msgstr "" -#: wallet/wallet.c:1969 +#: wallet/wallet.c:1973 msgid "DELETE FROM shachains WHERE id IN ( SELECT shachain_remote_id FROM channels WHERE channels.id=?)" msgstr "" -#: wallet/wallet.c:1979 +#: wallet/wallet.c:1983 msgid "UPDATE channels SET state=?, peer_id=? WHERE channels.id=?" msgstr "" -#: wallet/wallet.c:1993 +#: wallet/wallet.c:1997 msgid "SELECT * FROM channels WHERE peer_id = ?;" msgstr "" -#: wallet/wallet.c:2001 +#: wallet/wallet.c:2005 msgid "DELETE FROM peers WHERE id=?" msgstr "" -#: wallet/wallet.c:2012 +#: wallet/wallet.c:2016 msgid "UPDATE outputs SET confirmation_height = ? WHERE prev_out_tx = ?" msgstr "" -#: wallet/wallet.c:2115 +#: wallet/wallet.c:2119 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:2168 +#: wallet/wallet.c:2172 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:2229 +#: wallet/wallet.c:2233 msgid "UPDATE channel_htlcs SET hstate=?, payment_key=?, malformed_onion=?, failuremsg=?, localfailmsg=?, we_filled=? WHERE id=?" msgstr "" -#: wallet/wallet.c:2445 +#: wallet/wallet.c:2449 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:2492 +#: wallet/wallet.c:2496 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:2623 +#: wallet/wallet.c:2627 msgid "SELECT channel_id, direction, cltv_expiry, channel_htlc_id, payment_hash FROM channel_htlcs WHERE channel_id = ?;" msgstr "" -#: wallet/wallet.c:2657 +#: wallet/wallet.c:2661 msgid "DELETE FROM channel_htlcs WHERE direction = ? AND origin_htlc = ? AND payment_hash = ? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2710 +#: wallet/wallet.c:2714 msgid "SELECT status FROM payments WHERE payment_hash=? AND partid = ?;" msgstr "" -#: wallet/wallet.c:2728 +#: wallet/wallet.c:2732 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:2817 +#: wallet/wallet.c:2821 msgid "DELETE FROM payments WHERE payment_hash = ? AND partid = ?" msgstr "" -#: wallet/wallet.c:2831 +#: wallet/wallet.c:2835 msgid "DELETE FROM payments WHERE payment_hash = ?" msgstr "" -#: wallet/wallet.c:2932 +#: wallet/wallet.c:2936 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:2982 +#: wallet/wallet.c:2986 msgid "UPDATE payments SET status=? WHERE payment_hash=? AND partid=?" msgstr "" -#: wallet/wallet.c:2992 +#: wallet/wallet.c:2996 msgid "UPDATE payments SET payment_preimage=? WHERE payment_hash=? AND partid=?" msgstr "" -#: wallet/wallet.c:3002 +#: wallet/wallet.c:3006 msgid "UPDATE payments SET path_secrets = NULL , route_nodes = NULL , route_channels = NULL WHERE payment_hash = ? AND partid = ?;" msgstr "" -#: wallet/wallet.c:3034 +#: wallet/wallet.c:3038 msgid "SELECT failonionreply, faildestperm, failindex, failcode, failnode, failchannel, failupdate, faildetail, faildirection FROM payments WHERE payment_hash=? AND partid=?;" msgstr "" -#: wallet/wallet.c:3101 +#: wallet/wallet.c:3105 msgid "UPDATE payments SET failonionreply=? , faildestperm=? , failindex=? , failcode=? , failnode=? , failchannel=? , failupdate=? , faildetail=? , faildirection=? WHERE payment_hash=? AND partid=?;" msgstr "" -#: wallet/wallet.c:3160 +#: wallet/wallet.c:3164 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 = ? ORDER BY id;" msgstr "" -#: wallet/wallet.c:3183 +#: wallet/wallet.c:3187 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 ORDER BY id;" msgstr "" -#: wallet/wallet.c:3234 +#: wallet/wallet.c:3238 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:3279 +#: wallet/wallet.c:3283 msgid "DELETE FROM htlc_sigs WHERE channelid = ?" msgstr "" -#: wallet/wallet.c:3286 +#: wallet/wallet.c:3290 msgid "INSERT INTO htlc_sigs (channelid, signature) VALUES (?, ?)" msgstr "" -#: wallet/wallet.c:3298 +#: wallet/wallet.c:3302 msgid "SELECT blobval FROM vars WHERE name='genesis_hash'" msgstr "" -#: wallet/wallet.c:3322 +#: wallet/wallet.c:3326 msgid "INSERT INTO vars (name, blobval) VALUES ('genesis_hash', ?);" msgstr "" -#: wallet/wallet.c:3340 +#: wallet/wallet.c:3344 msgid "SELECT txid, outnum FROM utxoset WHERE spendheight < ?" msgstr "" -#: wallet/wallet.c:3352 +#: wallet/wallet.c:3356 msgid "DELETE FROM utxoset WHERE spendheight < ?" msgstr "" -#: wallet/wallet.c:3360 wallet/wallet.c:3474 +#: wallet/wallet.c:3364 wallet/wallet.c:3478 msgid "INSERT INTO blocks (height, hash, prev_hash) VALUES (?, ?, ?);" msgstr "" -#: wallet/wallet.c:3379 +#: wallet/wallet.c:3383 msgid "DELETE FROM blocks WHERE hash = ?" msgstr "" -#: wallet/wallet.c:3385 +#: wallet/wallet.c:3389 msgid "SELECT * FROM blocks WHERE height >= ?;" msgstr "" -#: wallet/wallet.c:3394 +#: wallet/wallet.c:3398 msgid "DELETE FROM blocks WHERE height > ?" msgstr "" -#: wallet/wallet.c:3406 +#: wallet/wallet.c:3410 msgid "UPDATE outputs SET spend_height = ?, status = ? WHERE prev_out_tx = ? AND prev_out_index = ?" msgstr "" -#: wallet/wallet.c:3424 +#: wallet/wallet.c:3428 msgid "UPDATE utxoset SET spendheight = ? WHERE txid = ? AND outnum = ?" msgstr "" -#: wallet/wallet.c:3447 wallet/wallet.c:3485 +#: wallet/wallet.c:3451 wallet/wallet.c:3489 msgid "INSERT INTO utxoset ( txid, outnum, blockheight, spendheight, txindex, scriptpubkey, satoshis) VALUES(?, ?, ?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3511 +#: wallet/wallet.c:3515 msgid "SELECT height FROM blocks WHERE height = ?" msgstr "" -#: wallet/wallet.c:3524 +#: wallet/wallet.c:3528 msgid "SELECT txid, spendheight, scriptpubkey, satoshis FROM utxoset WHERE blockheight = ? AND txindex = ? AND outnum = ? AND spendheight IS NULL" msgstr "" -#: wallet/wallet.c:3566 +#: wallet/wallet.c:3570 msgid "SELECT blockheight, txindex, outnum FROM utxoset WHERE spendheight = ?" msgstr "" -#: wallet/wallet.c:3597 wallet/wallet.c:3757 +#: wallet/wallet.c:3601 wallet/wallet.c:3761 msgid "SELECT blockheight FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3607 +#: wallet/wallet.c:3611 msgid "INSERT INTO transactions ( id, blockheight, txindex, rawtx) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3628 +#: wallet/wallet.c:3632 msgid "UPDATE transactions SET blockheight = ?, txindex = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:3645 +#: wallet/wallet.c:3649 msgid "INSERT INTO transaction_annotations (txid, idx, location, type, channel) VALUES (?, ?, ?, ?, ?) ON CONFLICT(txid,idx) DO NOTHING;" msgstr "" -#: wallet/wallet.c:3677 +#: wallet/wallet.c:3681 msgid "SELECT type, channel_id FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3693 +#: wallet/wallet.c:3697 msgid "UPDATE transactions SET type = ?, channel_id = ? WHERE id = ?" msgstr "" -#: wallet/wallet.c:3712 +#: wallet/wallet.c:3716 msgid "SELECT type FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3735 +#: wallet/wallet.c:3739 msgid "SELECT rawtx FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3781 +#: wallet/wallet.c:3785 msgid "SELECT blockheight, txindex FROM transactions WHERE id=?" msgstr "" -#: wallet/wallet.c:3809 +#: wallet/wallet.c:3813 msgid "SELECT id FROM transactions WHERE blockheight=?" msgstr "" -#: wallet/wallet.c:3828 +#: wallet/wallet.c:3832 msgid "INSERT INTO channeltxs ( channel_id, type, transaction_id, input_num, blockheight) VALUES (?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:3852 +#: wallet/wallet.c:3856 msgid "SELECT DISTINCT(channel_id) FROM channeltxs WHERE type = ?;" msgstr "" -#: wallet/wallet.c:3873 +#: wallet/wallet.c:3877 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:3918 +#: wallet/wallet.c:3922 msgid "UPDATE forwarded_payments SET in_msatoshi=?, out_msatoshi=?, state=?, resolved_time=?, failcode=? WHERE in_htlc_id=?" msgstr "" -#: wallet/wallet.c:3976 +#: wallet/wallet.c:3980 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:4035 +#: wallet/wallet.c:4039 msgid "SELECT CAST(COALESCE(SUM(in_msatoshi - out_msatoshi), 0) AS BIGINT)FROM forwarded_payments WHERE state = ?;" msgstr "" -#: wallet/wallet.c:4084 +#: wallet/wallet.c:4088 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:4206 +#: wallet/wallet.c:4210 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:4300 +#: wallet/wallet.c:4304 msgid "INSERT INTO penalty_bases ( channel_id, commitnum, txid, outnum, amount) VALUES (?, ?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4325 +#: wallet/wallet.c:4329 msgid "SELECT commitnum, txid, outnum, amount FROM penalty_bases WHERE channel_id = ?" msgstr "" -#: wallet/wallet.c:4349 +#: wallet/wallet.c:4353 msgid "DELETE FROM penalty_bases WHERE channel_id = ? AND commitnum = ?" msgstr "" -#: wallet/wallet.c:4367 +#: wallet/wallet.c:4371 msgid "SELECT 1 FROM offers WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4380 +#: wallet/wallet.c:4384 msgid "INSERT INTO offers ( offer_id, bolt12, label, status) VALUES (?, ?, ?, ?);" msgstr "" -#: wallet/wallet.c:4407 +#: wallet/wallet.c:4411 msgid "SELECT bolt12, label, status FROM offers WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4435 +#: wallet/wallet.c:4439 msgid "SELECT offer_id FROM offers;" msgstr "" -#: wallet/wallet.c:4461 +#: wallet/wallet.c:4465 msgid "UPDATE offers SET status=? WHERE offer_id = ?;" msgstr "" -#: wallet/wallet.c:4472 +#: wallet/wallet.c:4476 msgid "UPDATE invoices SET state=? WHERE state=? AND local_offer_id = ?;" msgstr "" -#: wallet/wallet.c:4500 +#: wallet/wallet.c:4504 msgid "SELECT status FROM offers WHERE offer_id = ?;" msgstr "" @@ -1257,4 +1269,4 @@ msgstr "" #: wallet/test/run-wallet.c:1649 msgid "INSERT INTO channels (id) VALUES (1);" msgstr "" -# SHA256STAMP:61244f420c5eefe9cf60f0599cdd6c17d38f719ed2bc5acac93ee1109f121dcf +# SHA256STAMP:16bc289317e93dbae2af010cde394060c0d5cbf610e5fcb995d6fa5ad4587bf1 diff --git a/wallet/test/run-wallet.c b/wallet/test/run-wallet.c index e93ebe418c85..ede16ddd6795 100644 --- a/wallet/test/run-wallet.c +++ b/wallet/test/run-wallet.c @@ -1521,7 +1521,7 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx) &txid, 1, funding_sats, AMOUNT_MSAT(0), our_sats, - false, false, + 0, false, &cid, AMOUNT_MSAT(3333333000), AMOUNT_MSAT(33333), @@ -1540,7 +1540,7 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx) &basepoints, &pk, NULL, 1000, 100, - NULL, true, true, + NULL, 0, 0, true, LOCAL, REASON_UNKNOWN, NULL); db_begin_transaction(w->db); CHECK(!wallet_err); diff --git a/wallet/wallet.c b/wallet/wallet.c index 70a895e6bf0f..c3336c915955 100644 --- a/wallet/wallet.c +++ b/wallet/wallet.c @@ -1154,7 +1154,7 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm ok &= wallet_shachain_load(w, db_column_u64(stmt, 29), &wshachain); remote_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 30, u8); - local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 49, u8); + local_shutdown_scriptpubkey = db_column_arr(tmpctx, stmt, 50, u8); /* Do we have a last_sent_commit, if yes, populate */ if (!db_column_is_null(stmt, 43)) { @@ -1222,17 +1222,17 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm return NULL; } - db_column_pubkey(stmt, 52, &local_basepoints.revocation); - db_column_pubkey(stmt, 53, &local_basepoints.payment); - db_column_pubkey(stmt, 54, &local_basepoints.htlc); - db_column_pubkey(stmt, 55, &local_basepoints.delayed_payment); - db_column_pubkey(stmt, 56, &local_funding_pubkey); - if (db_column_is_null(stmt, 57)) + db_column_pubkey(stmt, 53, &local_basepoints.revocation); + db_column_pubkey(stmt, 54, &local_basepoints.payment); + db_column_pubkey(stmt, 55, &local_basepoints.htlc); + db_column_pubkey(stmt, 56, &local_basepoints.delayed_payment); + db_column_pubkey(stmt, 57, &local_funding_pubkey); + if (db_column_is_null(stmt, 58)) shutdown_wrong_funding = NULL; else { shutdown_wrong_funding = tal(tmpctx, struct bitcoin_outpoint); - db_column_txid(stmt, 57, &shutdown_wrong_funding->txid); - shutdown_wrong_funding->n = db_column_int(stmt, 58); + db_column_txid(stmt, 58, &shutdown_wrong_funding->txid); + shutdown_wrong_funding->n = db_column_int(stmt, 59); } db_column_amount_sat(stmt, 15, &funding_sat); @@ -1269,7 +1269,7 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm &last_sig, wallet_htlc_sigs_load(tmpctx, w, db_column_u64(stmt, 0), - db_column_int(stmt, 48)), + db_column_int(stmt, 49)), &channel_info, take(fee_states), remote_shutdown_scriptpubkey, @@ -1287,10 +1287,11 @@ static struct channel *wallet_stmt2channel(struct wallet *w, struct db_stmt *stm db_column_int(stmt, 44), db_column_int(stmt, 45), db_column_arr(tmpctx, stmt, 46, u8), - db_column_int(stmt, 47), - db_column_int(stmt, 48), - db_column_int(stmt, 50), + db_column_u64(stmt, 47), + db_column_u64(stmt, 48), + db_column_int(stmt, 49), db_column_int(stmt, 51), + db_column_int(stmt, 52), shutdown_wrong_funding); if (!wallet_channel_load_inflights(w, chan)) { @@ -1370,18 +1371,19 @@ static bool wallet_channels_load_active(struct wallet *w) ", feerate_base" // 44 ", feerate_ppm" // 45 ", remote_upfront_shutdown_script" // 46 - ", option_static_remotekey" // 47 - ", option_anchor_outputs" // 48 - ", shutdown_scriptpubkey_local" // 49 - ", closer" // 50 - ", state_change_reason" // 51 - ", revocation_basepoint_local" // 52 - ", payment_basepoint_local" // 53 - ", htlc_basepoint_local" // 54 - ", delayed_payment_basepoint_local" // 55 - ", funding_pubkey_local" // 56 - ", shutdown_wrong_txid" // 57 - ", shutdown_wrong_outnum" // 58 + ", local_static_remotekey_start" // 47 + ", remote_static_remotekey_start" // 48 + ", option_anchor_outputs" // 49 + ", shutdown_scriptpubkey_local" // 50 + ", closer" // 51 + ", state_change_reason" // 52 + ", revocation_basepoint_local" // 53 + ", payment_basepoint_local" // 54 + ", htlc_basepoint_local" // 55 + ", delayed_payment_basepoint_local" // 56 + ", funding_pubkey_local" // 57 + ", shutdown_wrong_txid" // 58 + ", shutdown_wrong_outnum" // 59 " FROM channels" " WHERE state != ?;")); //? 0 db_bind_int(stmt, 0, CLOSED); @@ -1661,15 +1663,16 @@ void wallet_channel_save(struct wallet *w, struct channel *chan) " msatoshi_to_us_max=?," // 26 " feerate_base=?," // 27 " feerate_ppm=?," // 28 - " remote_upfront_shutdown_script=?," - " option_static_remotekey=?," // 30 - " option_anchor_outputs=?," // 31 - " shutdown_scriptpubkey_local=?," // 32 - " closer=?," // 33 - " state_change_reason=?," // 34 - " shutdown_wrong_txid=?," // 35 - " shutdown_wrong_outnum=?" // 36 - " WHERE id=?")); // 37 + " remote_upfront_shutdown_script=?," // 29 + " local_static_remotekey_start=?," // 30 + " remote_static_remotekey_start=?," // 31 + " option_anchor_outputs=?," // 32 + " shutdown_scriptpubkey_local=?," // 33 + " closer=?," // 34 + " state_change_reason=?," // 35 + " shutdown_wrong_txid=?," // 36 + " shutdown_wrong_outnum=?" // 37 + " WHERE id=?")); // 38 db_bind_u64(stmt, 0, chan->their_shachain.id); if (chan->scid) db_bind_short_channel_id(stmt, 1, chan->scid); @@ -1708,19 +1711,20 @@ void wallet_channel_save(struct wallet *w, struct channel *chan) db_bind_int(stmt, 27, chan->feerate_base); db_bind_int(stmt, 28, chan->feerate_ppm); db_bind_talarr(stmt, 29, chan->remote_upfront_shutdown_script); - db_bind_int(stmt, 30, chan->option_static_remotekey); - db_bind_int(stmt, 31, chan->option_anchor_outputs); - db_bind_talarr(stmt, 32, chan->shutdown_scriptpubkey[LOCAL]); - db_bind_int(stmt, 33, chan->closer); - db_bind_int(stmt, 34, chan->state_change_cause); + db_bind_u64(stmt, 30, chan->static_remotekey_start[LOCAL]); + db_bind_u64(stmt, 31, chan->static_remotekey_start[REMOTE]); + db_bind_int(stmt, 32, chan->option_anchor_outputs); + db_bind_talarr(stmt, 33, chan->shutdown_scriptpubkey[LOCAL]); + db_bind_int(stmt, 34, chan->closer); + db_bind_int(stmt, 35, chan->state_change_cause); if (chan->shutdown_wrong_funding) { - db_bind_txid(stmt, 35, &chan->shutdown_wrong_funding->txid); - db_bind_int(stmt, 36, chan->shutdown_wrong_funding->n); + db_bind_txid(stmt, 36, &chan->shutdown_wrong_funding->txid); + db_bind_int(stmt, 37, chan->shutdown_wrong_funding->n); } else { - db_bind_null(stmt, 35); db_bind_null(stmt, 36); + db_bind_null(stmt, 37); } - db_bind_u64(stmt, 37, chan->dbid); + db_bind_u64(stmt, 38, chan->dbid); db_exec_prepared_v2(take(stmt)); wallet_channel_config_save(w, &chan->channel_info.their_config); diff --git a/wire/bolt12_wiregen.c b/wire/bolt12_wiregen.c index eadac6be9eab..9624c2129123 100644 --- a/wire/bolt12_wiregen.c +++ b/wire/bolt12_wiregen.c @@ -1562,4 +1562,4 @@ bool invoice_error_is_valid(const struct tlv_invoice_error *record, size_t *err_ return tlv_fields_valid(record->fields, err_index); } -// SHA256STAMP:3c8dc54796300320573ccf24c2ec022c4f95f545576e909e55da001c1d04392d +// SHA256STAMP:85a22376bfbb4d4b5c1104ae7823b477443ac693db9b2ee53c16b777b74f7d2a diff --git a/wire/bolt12_wiregen.h b/wire/bolt12_wiregen.h index 182bf4d98561..b8859094ac7c 100644 --- a/wire/bolt12_wiregen.h +++ b/wire/bolt12_wiregen.h @@ -316,4 +316,4 @@ struct fallback_address *fromwire_fallback_address(const tal_t *ctx, const u8 ** #endif /* LIGHTNING_WIRE_BOLT12_WIREGEN_H */ -// SHA256STAMP:3c8dc54796300320573ccf24c2ec022c4f95f545576e909e55da001c1d04392d +// SHA256STAMP:85a22376bfbb4d4b5c1104ae7823b477443ac693db9b2ee53c16b777b74f7d2a diff --git a/wire/common_wiregen.c b/wire/common_wiregen.c index a855dfd58194..1355150fd480 100644 --- a/wire/common_wiregen.c +++ b/wire/common_wiregen.c @@ -100,4 +100,4 @@ bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg) fromwire_u8_array(&cursor, &plen, *msg, msg_len); return cursor != NULL; } -// SHA256STAMP:4498506058a2fd50f9b5adca97e08dce48d1812157ee24829b962eff59e3afa6 +// SHA256STAMP:a747ee0bc8a91c00e719bae883b505d6e7c85b33165a9156a571a0aa171a7256 diff --git a/wire/common_wiregen.h b/wire/common_wiregen.h index fc33a4afa27c..9efd995e40c3 100644 --- a/wire/common_wiregen.h +++ b/wire/common_wiregen.h @@ -41,4 +41,4 @@ bool fromwire_custommsg_out(const tal_t *ctx, const void *p, u8 **msg); #endif /* LIGHTNING_WIRE_COMMON_WIREGEN_H */ -// SHA256STAMP:4498506058a2fd50f9b5adca97e08dce48d1812157ee24829b962eff59e3afa6 +// SHA256STAMP:a747ee0bc8a91c00e719bae883b505d6e7c85b33165a9156a571a0aa171a7256 diff --git a/wire/extracted_peer_exp_upgradable.patch b/wire/extracted_peer_exp_upgradable.patch new file mode 100644 index 000000000000..db26af74680e --- /dev/null +++ b/wire/extracted_peer_exp_upgradable.patch @@ -0,0 +1,21 @@ +--- wire/peer_wire.csv 2021-05-09 15:44:59.166135652 +0930 ++++ wire/peer_wire.csv.raw 2021-05-11 09:59:31.695459756 +0930 +@@ -221,6 +131,18 @@ + msgdata,channel_reestablish,next_revocation_number,u64, + msgdata,channel_reestablish,your_last_per_commitment_secret,byte,32 + msgdata,channel_reestablish,my_current_per_commitment_point,point, ++msgdata,channel_reestablish,tlvs,channel_reestablish_tlvs, ++tlvtype,channel_reestablish_tlvs,next_to_send,1 ++tlvdata,channel_reestablish_tlvs,next_to_send,commitment_number,tu64, ++tlvtype,channel_reestablish_tlvs,desired_type,3 ++tlvdata,channel_reestablish_tlvs,desired_type,type,channel_type, ++tlvtype,channel_reestablish_tlvs,current_type,5 ++tlvdata,channel_reestablish_tlvs,current_type,type,channel_type, ++tlvtype,channel_reestablish_tlvs,upgradable,7 ++tlvdata,channel_reestablish_tlvs,upgradable,upgrades,channel_type,... ++subtype,channel_type ++subtypedata,channel_type,len,u16, ++subtypedata,channel_type,features,byte,len + msgtype,announcement_signatures,259 + msgdata,announcement_signatures,channel_id,channel_id, + msgdata,announcement_signatures,short_channel_id,short_channel_id, diff --git a/wire/onion_printgen.c b/wire/onion_printgen.c index 7d6d7d734d02..8ea922f610e5 100644 --- a/wire/onion_printgen.c +++ b/wire/onion_printgen.c @@ -859,4 +859,4 @@ void printonion_wire_tlv_message(const char *tlv_name, const u8 *msg) { printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_encmsg_tlvs, ARRAY_SIZE(print_tlvs_encmsg_tlvs)); } } -// SHA256STAMP:474b138bc0e571b8e5b3a9ce48b263b13b9dc3d516eaada1154e3c3d518d46f9 +// SHA256STAMP:c3ff8c1573066a7cae73a1e5ce1c8c5b5dd7e241129393e600eaf2a4fd6b9f3e diff --git a/wire/onion_printgen.h b/wire/onion_printgen.h index fa89d3865984..7a7a1ea743b4 100644 --- a/wire/onion_printgen.h +++ b/wire/onion_printgen.h @@ -58,4 +58,4 @@ 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:474b138bc0e571b8e5b3a9ce48b263b13b9dc3d516eaada1154e3c3d518d46f9 +// SHA256STAMP:c3ff8c1573066a7cae73a1e5ce1c8c5b5dd7e241129393e600eaf2a4fd6b9f3e diff --git a/wire/onion_wiregen.c b/wire/onion_wiregen.c index 8083c45de98d..425ad34f79ad 100644 --- a/wire/onion_wiregen.c +++ b/wire/onion_wiregen.c @@ -1026,4 +1026,4 @@ bool fromwire_mpp_timeout(const void *p) return false; return cursor != NULL; } -// SHA256STAMP:474b138bc0e571b8e5b3a9ce48b263b13b9dc3d516eaada1154e3c3d518d46f9 +// SHA256STAMP:c3ff8c1573066a7cae73a1e5ce1c8c5b5dd7e241129393e600eaf2a4fd6b9f3e diff --git a/wire/onion_wiregen.h b/wire/onion_wiregen.h index e7b95a7c3899..5ca402e6d232 100644 --- a/wire/onion_wiregen.h +++ b/wire/onion_wiregen.h @@ -317,4 +317,4 @@ bool fromwire_mpp_timeout(const void *p); #endif /* LIGHTNING_WIRE_ONION_WIREGEN_H */ -// SHA256STAMP:474b138bc0e571b8e5b3a9ce48b263b13b9dc3d516eaada1154e3c3d518d46f9 +// SHA256STAMP:c3ff8c1573066a7cae73a1e5ce1c8c5b5dd7e241129393e600eaf2a4fd6b9f3e diff --git a/wire/peer_printgen.c b/wire/peer_printgen.c index 42b8111a5d01..b2ae43f11b83 100644 --- a/wire/peer_printgen.c +++ b/wire/peer_printgen.c @@ -2935,4 +2935,4 @@ void printpeer_wire_tlv_message(const char *tlv_name, const u8 *msg) { printwire_tlvs(tlv_name, &msg, &plen, print_tlvs_onion_message_tlvs, ARRAY_SIZE(print_tlvs_onion_message_tlvs)); } } -// SHA256STAMP:aecb66d3600732f50b4279272e4c057d1ea410bddf41cbb01b6326320f5b9de8 +// SHA256STAMP:3ecafff6be37e4049f121dcd6816aada2818fc7c02099372d1358d1b5b9da1ca diff --git a/wire/peer_printgen.h b/wire/peer_printgen.h index c482da369df7..7e494852b018 100644 --- a/wire/peer_printgen.h +++ b/wire/peer_printgen.h @@ -96,4 +96,4 @@ void printwire_channel_update_checksums(const char *fieldname, const u8 **cursor 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:aecb66d3600732f50b4279272e4c057d1ea410bddf41cbb01b6326320f5b9de8 +// SHA256STAMP:3ecafff6be37e4049f121dcd6816aada2818fc7c02099372d1358d1b5b9da1ca diff --git a/wire/peer_wire.c b/wire/peer_wire.c index 1f8fc3731306..afc60a2203bb 100644 --- a/wire/peer_wire.c +++ b/wire/peer_wire.c @@ -124,10 +124,17 @@ bool extract_channel_id(const u8 *in_pkt, struct channel_id *channel_id) struct bitcoin_blkid ignored_chainhash; struct secret ignored_secret; struct tlv_open_channel_tlvs *tlvs = tlv_open_channel_tlvs_new(tmpctx); +#if EXPERIMENTAL_FEATURES + struct tlv_channel_reestablish_tlvs *reestab_tlvs = tlv_channel_reestablish_tlvs_new(tmpctx); +#endif if (fromwire_channel_reestablish(in_pkt, channel_id, &ignored_u64, &ignored_u64, - &ignored_secret, &ignored_pubkey)) + &ignored_secret, &ignored_pubkey +#if EXPERIMENTAL_FEATURES + , reestab_tlvs +#endif + )) return true; if (fromwire_open_channel(in_pkt, &ignored_chainhash, channel_id, &ignored_sat, diff --git a/wire/peer_wiregen.c b/wire/peer_wiregen.c index 0f4a630e893a..d025048e5afb 100644 --- a/wire/peer_wiregen.c +++ b/wire/peer_wiregen.c @@ -2330,4 +2330,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec *htlc_maximum_msat = fromwire_amount_msat(&cursor, &plen); return cursor != NULL; } -// SHA256STAMP:aecb66d3600732f50b4279272e4c057d1ea410bddf41cbb01b6326320f5b9de8 +// SHA256STAMP:3ecafff6be37e4049f121dcd6816aada2818fc7c02099372d1358d1b5b9da1ca diff --git a/wire/peer_wiregen.h b/wire/peer_wiregen.h index f112c1182080..f4b5b7722b43 100644 --- a/wire/peer_wiregen.h +++ b/wire/peer_wiregen.h @@ -859,4 +859,4 @@ bool fromwire_channel_update_option_channel_htlc_max(const void *p, secp256k1_ec #endif /* LIGHTNING_WIRE_PEER_WIREGEN_H */ -// SHA256STAMP:aecb66d3600732f50b4279272e4c057d1ea410bddf41cbb01b6326320f5b9de8 +// SHA256STAMP:3ecafff6be37e4049f121dcd6816aada2818fc7c02099372d1358d1b5b9da1ca