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

Function output_better

common/permute_tx.c:37–62  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

find_best_outFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected