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

Function tlv_n1_eq

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

Source from the content-addressed store, hash-verified

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

Callers 1

mainFunction · 0.85

Calls 2

short_channel_id_eqFunction · 0.85
amount_msat_eqFunction · 0.50

Tested by

no test coverage detected