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

Function channelseq

wallet/test/run-wallet.c:1253–1353  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 2

test_channel_crudFunction · 0.85

Calls 8

node_id_eqFunction · 0.85
memeqFunction · 0.85
fee_states_validFunction · 0.85
bitcoin_tx_eqFunction · 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