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

Function secret_from_hex

channeld/test/run-commit_tx.c:39–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39static struct secret secret_from_hex(const char *hex)
40{
41 struct secret s;
42 size_t len;
43 if (strstarts(hex, "0x"))
44 hex += 2;
45 len = strlen(hex);
46 /* BOLT #3:
47 *
48 * - Private keys are displayed as 32 bytes plus a trailing 1
49 * (Bitcoin's convention for "compressed" private keys, i.e. keys
50 * for which the public key is compressed).
51 */
52 if (len == 66 && strends(hex, "01"))
53 len -= 2;
54 if (!hex_decode(hex, len, &s, sizeof(s)))
55 abort();
56 return s;
57}
58
59static void tx_must_be_eq(const struct bitcoin_tx *a,
60 const struct bitcoin_tx *b)

Callers 1

mainFunction · 0.70

Calls 3

strendsFunction · 0.85
hex_decodeFunction · 0.85
abortFunction · 0.85

Tested by

no test coverage detected