MCPcopy Create free account
hub / github.com/ElementsProject/lightning / channelseq

Function channelseq

wallet/test/run-wallet.c:1254–1350  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1252}
1253
1254static bool channelseq(struct channel *c1, struct channel *c2)
1255{
1256 struct peer *p1 = c1->peer, *p2 = c2->peer;
1257 struct channel_info *ci1 = &c1->channel_info, *ci2 = &c2->channel_info;
1258 struct changed_htlc *lc1 = c1->last_sent_commit, *lc2 = c2->last_sent_commit;
1259 struct channel_inflight *i1, *i2;
1260 CHECK(c1->dbid == c2->dbid);
1261 CHECK(c1->first_blocknum == c2->first_blocknum);
1262 CHECK(c1->peer->dbid == c2->peer->dbid);
1263 CHECK(c1->peer == c2->peer);
1264 CHECK(c1->their_shachain.id == c2->their_shachain.id);
1265 CHECK_MSG(node_id_eq(&p1->id, &p2->id), "NodeIDs do not match");
1266 CHECK((c1->scid == NULL && c2->scid == NULL)
1267 || short_channel_id_eq(*c1->scid, *c2->scid));
1268 CHECK(amount_msat_eq(c1->our_msat, c2->our_msat));
1269 CHECK((c1->shutdown_scriptpubkey[REMOTE] == NULL && c2->shutdown_scriptpubkey[REMOTE] == NULL) || tal_arr_eq(
1270 c1->shutdown_scriptpubkey[REMOTE],
1271 c2->shutdown_scriptpubkey[REMOTE]));
1272 CHECK(bitcoin_outpoint_eq(&c1->funding, &c2->funding));
1273 CHECK(pubkey_eq(&ci1->remote_fundingkey, &ci2->remote_fundingkey));
1274 CHECK(pubkey_eq(&ci1->theirbase.revocation, &ci2->theirbase.revocation));
1275 CHECK(pubkey_eq(&ci1->theirbase.payment, &ci2->theirbase.payment));
1276 CHECK(pubkey_eq(&ci1->theirbase.delayed_payment, &ci2->theirbase.delayed_payment));
1277 CHECK(pubkey_eq(&ci1->remote_per_commit, &ci2->remote_per_commit));
1278 CHECK(pubkey_eq(&ci1->old_remote_per_commit, &ci2->old_remote_per_commit));
1279 CHECK(ci1->their_config.id != 0 && ci1->their_config.id == ci2->their_config.id);
1280 CHECK(fee_states_valid(c1->fee_states, c1->opener));
1281 CHECK(fee_states_valid(c2->fee_states, c2->opener));
1282 for (enum htlc_state i = 0; i < ARRAY_SIZE(c1->fee_states->feerate);
1283 i++) {
1284 if (c1->fee_states->feerate[i] == NULL) {
1285 CHECK(c2->fee_states->feerate[i] == NULL);
1286 } else {
1287 CHECK(*c1->fee_states->feerate[i]
1288 == *c2->fee_states->feerate[i]);
1289 }
1290 }
1291
1292 CHECK(c1->our_config.id != 0 && c1->our_config.id == c2->our_config.id);
1293 CHECK((lc1 != NULL) == (lc2 != NULL));
1294 CHECK(tal_count(lc1) == tal_count(lc2));
1295 for (size_t i = 0; i < tal_count(lc1); i++) {
1296 CHECK(lc1[i].newstate == lc2[i].newstate);
1297 CHECK(lc1[i].id == lc2[i].id);
1298 }
1299
1300 CHECK((c1->last_tx != NULL) == (c2->last_tx != NULL));
1301 if (c1->last_tx) {
1302 CHECK(bitcoin_tx_eq(c1->last_tx, c2->last_tx));
1303 }
1304 CHECK(memeq(&c1->last_sig, sizeof(c1->last_sig),
1305 &c2->last_sig, sizeof(c2->last_sig)));
1306
1307 CHECK(c1->final_key_idx == c2->final_key_idx);
1308 CHECK(tal_arr_eq(c1->shutdown_scriptpubkey[REMOTE],
1309 c2->shutdown_scriptpubkey[REMOTE]));
1310
1311 CHECK(c1->last_was_revoke == c2->last_was_revoke);

Callers 2

test_channel_crudFunction · 0.85

Calls 9

node_id_eqFunction · 0.85
short_channel_id_eqFunction · 0.85
fee_states_validFunction · 0.85
bitcoin_tx_eqFunction · 0.85
memeqFunction · 0.85
height_states_validFunction · 0.85
channel_inflightseqFunction · 0.85
channel_type_eqFunction · 0.85
amount_msat_eqFunction · 0.50

Tested by

no test coverage detected