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

Function output_better

common/permute_tx.c:44–69  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44static bool output_better(const struct wally_tx_output *a, u32 cltv_a,
45 const struct wally_tx_output *b, u32 cltv_b)
46{
47 size_t len, lena, lenb;
48 int ret;
49
50 if (a->satoshi != b->satoshi)
51 return a->satoshi < b->satoshi;
52
53 /* Lexicographical sort. */
54 lena = a->script_len;
55 lenb = b->script_len;
56 if (lena < lenb)
57 len = lena;
58 else
59 len = lenb;
60
61 ret = memcmp(a->script, b->script, len);
62 if (ret != 0)
63 return ret < 0;
64
65 if (lena != lenb)
66 return lena < lenb;
67
68 return cltv_a < cltv_b;
69}
70
71static u32 cltv_of(const u32 *cltvs, size_t idx)
72{

Callers 1

find_best_outFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected