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

Function channelseq

wallet/test/run-wallet.c:1251–1347  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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