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

Function tlv_n1_eq

wire/test/run-tlvstream.c:354–395  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

352};
353
354static bool tlv_n1_eq(const struct tlv_n1 *a, const struct tlv_n1 *b)
355{
356 if (a->tlv1) {
357 if (!b->tlv1)
358 return false;
359 if (*a->tlv1 != *b->tlv1)
360 return false;
361 } else if (b->tlv1)
362 return false;
363
364 if (a->tlv2) {
365 if (!b->tlv2)
366 return false;
367 if (!short_channel_id_eq(a->tlv2, b->tlv2))
368 return false;
369 } else if (b->tlv2)
370 return false;
371
372 if (a->tlv3) {
373 if (!b->tlv3)
374 return false;
375 if (!pubkey_eq(&a->tlv3->node_id, &b->tlv3->node_id))
376 return false;
377 if (!amount_msat_eq(a->tlv3->amount_msat_1,
378 b->tlv3->amount_msat_1))
379 return false;
380 if (!amount_msat_eq(a->tlv3->amount_msat_2,
381 b->tlv3->amount_msat_2))
382 return false;
383 } else if (b->tlv3)
384 return false;
385
386 if (a->tlv4) {
387 if (!b->tlv4)
388 return false;
389 if (*a->tlv4 != *b->tlv4)
390 return false;
391 } else if (b->tlv4)
392 return false;
393
394 return true;
395}
396
397/* hexstr is valid, so pull out first field */
398static u64 pull_type(const char *hexstr)

Callers 1

mainFunction · 0.85

Calls 1

amount_msat_eqFunction · 0.50

Tested by

no test coverage detected