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

Function sign_b11

devtools/bolt11-cli.c:79–103  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

77}
78
79static bool sign_b11(const u5 *u5bytes,
80 const u8 *hrpu8,
81 secp256k1_ecdsa_recoverable_signature *rsig,
82 struct privkey *privkey)
83{
84 struct hash_u5 hu5;
85 char *hrp;
86 struct sha256 sha;
87
88 hrp = tal_dup_arr(NULL, char, (char *)hrpu8, tal_count(hrpu8), 1);
89 hrp[tal_count(hrpu8)] = '\0';
90
91 hash_u5_init(&hu5, hrp);
92 hash_u5(&hu5, u5bytes, tal_count(u5bytes));
93 hash_u5_done(&hu5, &sha);
94 tal_free(hrp);
95
96 if (!secp256k1_ecdsa_sign_recoverable(secp256k1_ctx, rsig,
97 (const u8 *)&sha,
98 privkey->secret.data,
99 NULL, NULL))
100 abort();
101
102 return true;
103}
104
105static void encode(const tal_t *ctx,
106 struct privkey *privkey,

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