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

Function secret_from_hex

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

Source from the content-addressed store, hash-verified

58}
59
60static struct secret secret_from_hex(const char *hex)
61{
62 struct secret s;
63 size_t len;
64 if (strstarts(hex, "0x"))
65 hex += 2;
66 len = strlen(hex);
67 /* BOLT #3:
68 *
69 * - Private keys are displayed as 32 bytes plus a trailing 1
70 * (Bitcoin's convention for "compressed" private keys, i.e. keys
71 * for which the public key is compressed).
72 */
73 if (len == 66 && strends(hex, "01"))
74 len -= 2;
75 if (!hex_decode(hex, len, &s, sizeof(s)))
76 abort();
77 return s;
78}
79
80static void tx_must_be_eq(const struct bitcoin_tx *a,
81 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