lightningd: use channel_type, pass to-and-from channeld.

Instead of explicit option_static_remotekey and option_anchor_outputs flags.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2021-09-09 14:59:35 +09:30
committed by Christian Decker
parent 740afb822c
commit 183fe107e8
57 changed files with 245 additions and 230 deletions

View File

@@ -9,7 +9,9 @@ WALLET_TEST_COMMON_OBJS := \
common/amount.o \
common/base32.o \
common/blockheight_states.o \
common/channel_type.o \
common/derive_basepoints.o \
common/features.o \
common/htlc_state.o \
common/htlc_wire.o \
common/fee_states.o \

View File

@@ -121,13 +121,6 @@ char *encode_scriptpubkey_to_addr(const tal_t *ctx UNNEEDED,
/* Generated stub for fatal */
void fatal(const char *fmt UNNEEDED, ...)
{ 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 feature_offered */
bool feature_offered(const u8 *features UNNEEDED, size_t f UNNEEDED)
{ fprintf(stderr, "feature_offered called!\n"); abort(); }
/* Generated stub for fromwire_channeld_dev_memleak_reply */
bool fromwire_channeld_dev_memleak_reply(const void *p UNNEEDED, bool *leak UNNEEDED)
{ fprintf(stderr, "fromwire_channeld_dev_memleak_reply called!\n"); abort(); }
@@ -1122,7 +1115,7 @@ static bool test_wallet_outputs(struct lightningd *ld, const tal_t *ctx)
true, NULL);
channel.peer = new_peer(ld, 0, &id, &addr, false);
channel.dbid = 1;
channel.option_anchor_outputs = true;
channel.type = channel_type_anchor_outputs(tmpctx);
memset(&u.txid, 3, sizeof(u.txid));
CHECK_MSG(wallet_add_onchaind_utxo(w, &u.txid,
u.outnum,
@@ -1359,6 +1352,7 @@ static bool channelseq(struct channel *c1, struct channel *c2)
}
/* c2 should also be out of inflights */
CHECK(list_next(&c2->inflights, i2, list) == NULL);
CHECK(channel_type_eq(c1->type, c2->type));
return true;
}
@@ -1398,6 +1392,7 @@ static bool test_channel_crud(struct lightningd *ld, const tal_t *ctx)
secp256k1_ecdsa_signature *node_sig2, *bitcoin_sig2;
u32 feerate, blockheight;
bool load;
const struct channel_type *type = channel_type_static_remotekey(w);
memset(&c1, 0, sizeof(c1));
memset(c2, 0, sizeof(*c2));
@@ -1446,6 +1441,7 @@ static bool test_channel_crud(struct lightningd *ld, const tal_t *ctx)
c1.unsaved_dbid = 0;
/* Init channel inflights */
list_head_init(&c1.inflights);
c1.type = type;
db_begin_transaction(w->db);
CHECK(!wallet_err);
@@ -1640,7 +1636,7 @@ static bool test_channel_inflight_crud(struct lightningd *ld, const tal_t *ctx)
&basepoints,
&pk, NULL,
1000, 100,
NULL, 0, 0, true,
NULL, 0, 0, channel_type_static_remotekey(NULL),
LOCAL, REASON_UNKNOWN,
NULL,
new_height_states(w, LOCAL,