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

Function test_sign

common/test/run-bolt11.c:20–44  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18static struct privkey privkey;
19
20static bool test_sign(const u5 *u5bytes,
21 const u8 *hrpu8,
22 secp256k1_ecdsa_recoverable_signature *rsig,
23 void *unused UNUSED)
24{
25 struct hash_u5 hu5;
26 char *hrp;
27 struct sha256 sha;
28
29 hrp = tal_dup_arr(NULL, char, (char *)hrpu8, tal_count(hrpu8), 1);
30 hrp[tal_count(hrpu8)] = '\0';
31
32 hash_u5_init(&hu5, hrp);
33 hash_u5(&hu5, u5bytes, tal_count(u5bytes));
34 hash_u5_done(&hu5, &sha);
35 tal_free(hrp);
36
37 if (!secp256k1_ecdsa_sign_recoverable(secp256k1_ctx, rsig,
38 (const u8 *)&sha,
39 privkey.secret.data,
40 NULL, NULL))
41 abort();
42
43 return true;
44}
45
46static void test_b11(const char *b11str,
47 const struct bolt11 *expect_b11,

Callers

nothing calls this directly

Calls 5

hash_u5_initFunction · 0.85
hash_u5_doneFunction · 0.85
tal_freeFunction · 0.85
abortFunction · 0.85
hash_u5Class · 0.70

Tested by

no test coverage detected