mirror of
https://github.com/aljazceru/lightning.git
synced 2025-12-20 07:34:24 +01:00
dualfund: add feature flag for dual-funding
turn off until we're ready to test both sides
This commit is contained in:
@@ -78,6 +78,12 @@ static const struct feature_style feature_styles[] = {
|
|||||||
[NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT,
|
[NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT,
|
||||||
[BOLT11_FEATURE] = FEATURE_REPRESENT,
|
[BOLT11_FEATURE] = FEATURE_REPRESENT,
|
||||||
[CHANNEL_FEATURE] = FEATURE_REPRESENT_AS_OPTIONAL} },
|
[CHANNEL_FEATURE] = FEATURE_REPRESENT_AS_OPTIONAL} },
|
||||||
|
|
||||||
|
{ OPT_DUAL_FUND,
|
||||||
|
.copy_style = { [INIT_FEATURE] = FEATURE_REPRESENT,
|
||||||
|
[NODE_ANNOUNCE_FEATURE] = FEATURE_REPRESENT,
|
||||||
|
[BOLT11_FEATURE] = FEATURE_REPRESENT,
|
||||||
|
[CHANNEL_FEATURE] = FEATURE_DONT_REPRESENT} },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -106,6 +112,12 @@ static const struct dependency feature_deps[] = {
|
|||||||
*/
|
*/
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
{ OPT_ANCHOR_OUTPUTS, OPT_STATIC_REMOTEKEY },
|
{ OPT_ANCHOR_OUTPUTS, OPT_STATIC_REMOTEKEY },
|
||||||
|
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9:
|
||||||
|
* Name | Description | Context | Dependencies |
|
||||||
|
* ...
|
||||||
|
* `option_dual_fund` | ... | ... | `option_anchor_outputs`
|
||||||
|
*/
|
||||||
|
{ OPT_DUAL_FUND, OPT_ANCHOR_OUTPUTS },
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -115,5 +115,10 @@ u8 *featurebits_or(const tal_t *ctx, const u8 *f1 TAKES, const u8 *f2 TAKES);
|
|||||||
*/
|
*/
|
||||||
#if EXPERIMENTAL_FEATURES
|
#if EXPERIMENTAL_FEATURES
|
||||||
#define OPT_ONION_MESSAGES 102
|
#define OPT_ONION_MESSAGES 102
|
||||||
|
|
||||||
|
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9:
|
||||||
|
* | 222/223 | `option_dual_fund` | ... IN9 ...
|
||||||
|
*/
|
||||||
|
#define OPT_DUAL_FUND 222
|
||||||
#endif
|
#endif
|
||||||
#endif /* LIGHTNING_COMMON_FEATURES_H */
|
#endif /* LIGHTNING_COMMON_FEATURES_H */
|
||||||
|
|||||||
@@ -658,32 +658,13 @@ wallet_commit_channel(struct lightningd *ld,
|
|||||||
/* old_remote_per_commit not valid yet, copy valid one. */
|
/* old_remote_per_commit not valid yet, copy valid one. */
|
||||||
channel_info->old_remote_per_commit = channel_info->remote_per_commit;
|
channel_info->old_remote_per_commit = channel_info->remote_per_commit;
|
||||||
|
|
||||||
/* BOLT-a12da24dd0102c170365124782b46d9710950ac1 #2:
|
/* BOLT-7b04b1461739c5036add61782d58ac490842d98b #9
|
||||||
* 1. type: 35 (`funding_signed`)
|
* | 222/223 | `option_dual_fund`
|
||||||
* 2. data:
|
* | Use v2 of channel open, enables dual funding
|
||||||
* * [`channel_id`:`channel_id`]
|
* | IN9
|
||||||
* * [`signature`:`signature`]
|
* | `option_anchor_outputs` */
|
||||||
*
|
option_static_remotekey = true;
|
||||||
* #### Requirements
|
option_anchor_outputs = true;
|
||||||
*
|
|
||||||
* Both peers:
|
|
||||||
* - if `option_static_remotekey` or `option_anchor_outputs` was negotiated:
|
|
||||||
* - `option_static_remotekey` or `option_anchor_outputs` applies to all commitment
|
|
||||||
* transactions
|
|
||||||
* - otherwise:
|
|
||||||
* - `option_static_remotekey` or `option_anchor_outputs` does not apply to any commitment
|
|
||||||
* 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);
|
|
||||||
|
|
||||||
option_anchor_outputs
|
|
||||||
= feature_negotiated(ld->our_features,
|
|
||||||
uc->peer->their_features,
|
|
||||||
OPT_ANCHOR_OUTPUTS);
|
|
||||||
|
|
||||||
channel = new_channel(uc->peer, uc->dbid,
|
channel = new_channel(uc->peer, uc->dbid,
|
||||||
NULL, /* No shachain yet */
|
NULL, /* No shachain yet */
|
||||||
|
|||||||
@@ -42,6 +42,7 @@
|
|||||||
#include <lightningd/channel_control.h>
|
#include <lightningd/channel_control.h>
|
||||||
#include <lightningd/closing_control.h>
|
#include <lightningd/closing_control.h>
|
||||||
#include <lightningd/connect_control.h>
|
#include <lightningd/connect_control.h>
|
||||||
|
#include <lightningd/dual_open_control.h>
|
||||||
#include <lightningd/hsm_control.h>
|
#include <lightningd/hsm_control.h>
|
||||||
#include <lightningd/json.h>
|
#include <lightningd/json.h>
|
||||||
#include <lightningd/jsonrpc.h>
|
#include <lightningd/jsonrpc.h>
|
||||||
@@ -1004,6 +1005,13 @@ peer_connected_hook_cb(struct peer_connected_hook_payload *payload STEALS,
|
|||||||
error = NULL;
|
error = NULL;
|
||||||
|
|
||||||
send_error:
|
send_error:
|
||||||
|
#if EXPERIMENTAL_FEATURES
|
||||||
|
if (feature_negotiated(ld->our_features,
|
||||||
|
peer->their_features,
|
||||||
|
OPT_DUAL_FUND)) {
|
||||||
|
peer_start_dualopend(peer, payload->pps, error);
|
||||||
|
} else
|
||||||
|
#endif /* EXPERIMENTAL_FEATURES */
|
||||||
peer_start_openingd(peer, payload->pps, error);
|
peer_start_openingd(peer, payload->pps, error);
|
||||||
tal_free(payload);
|
tal_free(payload);
|
||||||
}
|
}
|
||||||
@@ -1258,6 +1266,7 @@ static struct command_result *json_listpeers(struct command *cmd,
|
|||||||
return command_success(cmd, response);
|
return command_success(cmd, response);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Magic marker: remove at your own peril! */
|
||||||
static const struct json_command listpeers_command = {
|
static const struct json_command listpeers_command = {
|
||||||
"listpeers",
|
"listpeers",
|
||||||
"network",
|
"network",
|
||||||
@@ -1468,7 +1477,6 @@ static struct command_result *json_close(struct command *cmd,
|
|||||||
return command_still_pending(cmd);
|
return command_still_pending(cmd);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Magic marker: remove at your own peril! */
|
|
||||||
static const struct json_command close_command = {
|
static const struct json_command close_command = {
|
||||||
"close",
|
"close",
|
||||||
"channels",
|
"channels",
|
||||||
|
|||||||
@@ -138,6 +138,10 @@ void fatal(const char *fmt UNNEEDED, ...)
|
|||||||
/* Generated stub for feature_is_set */
|
/* Generated stub for feature_is_set */
|
||||||
bool feature_is_set(const u8 *features UNNEEDED, size_t bit UNNEEDED)
|
bool feature_is_set(const u8 *features UNNEEDED, size_t bit UNNEEDED)
|
||||||
{ fprintf(stderr, "feature_is_set called!\n"); abort(); }
|
{ fprintf(stderr, "feature_is_set called!\n"); abort(); }
|
||||||
|
/* Generated stub for feature_negotiated */
|
||||||
|
bool feature_negotiated(const struct feature_set *our_features UNNEEDED,
|
||||||
|
const u8 *their_features UNNEEDED, size_t f UNNEEDED)
|
||||||
|
{ fprintf(stderr, "feature_negotiated called!\n"); abort(); }
|
||||||
/* Generated stub for fixup_htlcs_out */
|
/* Generated stub for fixup_htlcs_out */
|
||||||
void fixup_htlcs_out(struct lightningd *ld UNNEEDED)
|
void fixup_htlcs_out(struct lightningd *ld UNNEEDED)
|
||||||
{ fprintf(stderr, "fixup_htlcs_out called!\n"); abort(); }
|
{ fprintf(stderr, "fixup_htlcs_out called!\n"); abort(); }
|
||||||
@@ -471,6 +475,11 @@ void peer_start_closingd(struct channel *channel UNNEEDED,
|
|||||||
bool reconnected UNNEEDED,
|
bool reconnected UNNEEDED,
|
||||||
const u8 *channel_reestablish UNNEEDED)
|
const u8 *channel_reestablish UNNEEDED)
|
||||||
{ fprintf(stderr, "peer_start_closingd called!\n"); abort(); }
|
{ fprintf(stderr, "peer_start_closingd called!\n"); abort(); }
|
||||||
|
/* Generated stub for peer_start_dualopend */
|
||||||
|
void peer_start_dualopend(struct peer *peer UNNEEDED,
|
||||||
|
struct per_peer_state *pps UNNEEDED,
|
||||||
|
const u8 *send_msg UNNEEDED)
|
||||||
|
{ fprintf(stderr, "peer_start_dualopend called!\n"); abort(); }
|
||||||
/* Generated stub for peer_start_openingd */
|
/* Generated stub for peer_start_openingd */
|
||||||
void peer_start_openingd(struct peer *peer UNNEEDED,
|
void peer_start_openingd(struct peer *peer UNNEEDED,
|
||||||
struct per_peer_state *pps UNNEEDED,
|
struct per_peer_state *pps UNNEEDED,
|
||||||
|
|||||||
2
wallet/db_postgres_sqlgen.c
generated
2
wallet/db_postgres_sqlgen.c
generated
@@ -1648,4 +1648,4 @@ struct db_query db_postgres_queries[] = {
|
|||||||
|
|
||||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
#endif /* LIGHTNINGD_WALLET_GEN_DB_POSTGRES */
|
||||||
|
|
||||||
// SHA256STAMP:0838dffa4a6f4f42152ad48122d435039c2cff5fa8c067e2bd2b54ef8cb92ee9
|
// SHA256STAMP:750952e0c2a627617fea597d3faa6b41b736c6a67101343b37ec86c47da7bad7
|
||||||
|
|||||||
2
wallet/db_sqlite3_sqlgen.c
generated
2
wallet/db_sqlite3_sqlgen.c
generated
@@ -1648,4 +1648,4 @@ struct db_query db_sqlite3_queries[] = {
|
|||||||
|
|
||||||
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
#endif /* LIGHTNINGD_WALLET_GEN_DB_SQLITE3 */
|
||||||
|
|
||||||
// SHA256STAMP:0838dffa4a6f4f42152ad48122d435039c2cff5fa8c067e2bd2b54ef8cb92ee9
|
// SHA256STAMP:750952e0c2a627617fea597d3faa6b41b736c6a67101343b37ec86c47da7bad7
|
||||||
|
|||||||
4
wallet/statements_gettextgen.po
generated
4
wallet/statements_gettextgen.po
generated
@@ -1082,7 +1082,7 @@ msgstr ""
|
|||||||
msgid "not a valid SQL statement"
|
msgid "not a valid SQL statement"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
#: wallet/test/run-wallet.c:1346
|
#: wallet/test/run-wallet.c:1355
|
||||||
msgid "INSERT INTO channels (id) VALUES (1);"
|
msgid "INSERT INTO channels (id) VALUES (1);"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
# SHA256STAMP:b38439695ca8ff636fbd7b7b17d156d5d5d5408b8d5dd228d20744b7e25da2be
|
# SHA256STAMP:a2c4fd6e26d81d871d9ee5201a844e09d94b4ea50c3690060dea4dd640ef007b
|
||||||
|
|||||||
@@ -111,6 +111,10 @@ char *encode_scriptpubkey_to_addr(const tal_t *ctx UNNEEDED,
|
|||||||
/* Generated stub for fatal */
|
/* Generated stub for fatal */
|
||||||
void fatal(const char *fmt UNNEEDED, ...)
|
void fatal(const char *fmt UNNEEDED, ...)
|
||||||
{ fprintf(stderr, "fatal called!\n"); abort(); }
|
{ fprintf(stderr, "fatal called!\n"); abort(); }
|
||||||
|
/* Generated stub for feature_negotiated */
|
||||||
|
bool feature_negotiated(const struct feature_set *our_features UNNEEDED,
|
||||||
|
const u8 *their_features UNNEEDED, size_t f UNNEEDED)
|
||||||
|
{ fprintf(stderr, "feature_negotiated called!\n"); abort(); }
|
||||||
/* Generated stub for fromwire_channeld_dev_memleak_reply */
|
/* Generated stub for fromwire_channeld_dev_memleak_reply */
|
||||||
bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED)
|
bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED)
|
||||||
{ fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); }
|
{ fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); }
|
||||||
@@ -578,6 +582,11 @@ void peer_start_closingd(struct channel *channel UNNEEDED,
|
|||||||
bool reconnected UNNEEDED,
|
bool reconnected UNNEEDED,
|
||||||
const u8 *channel_reestablish UNNEEDED)
|
const u8 *channel_reestablish UNNEEDED)
|
||||||
{ fprintf(stderr, "peer_start_closingd called!\n"); abort(); }
|
{ fprintf(stderr, "peer_start_closingd called!\n"); abort(); }
|
||||||
|
/* Generated stub for peer_start_dualopend */
|
||||||
|
void peer_start_dualopend(struct peer *peer UNNEEDED,
|
||||||
|
struct per_peer_state *pps UNNEEDED,
|
||||||
|
const u8 *send_msg UNNEEDED)
|
||||||
|
{ fprintf(stderr, "peer_start_dualopend called!\n"); abort(); }
|
||||||
/* Generated stub for peer_start_openingd */
|
/* Generated stub for peer_start_openingd */
|
||||||
void peer_start_openingd(struct peer *peer UNNEEDED,
|
void peer_start_openingd(struct peer *peer UNNEEDED,
|
||||||
struct per_peer_state *pps UNNEEDED,
|
struct per_peer_state *pps UNNEEDED,
|
||||||
|
|||||||
Reference in New Issue
Block a user