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

Function shachain_get_secret

common/derive_basepoints.c:269–283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

267}
268
269bool shachain_get_secret(const struct shachain *shachain,
270 u64 commit_num,
271 struct secret *preimage)
272{
273 struct sha256 sha;
274
275 if (commit_num >= (1ULL << SHACHAIN_BITS))
276 return false;
277
278 if (!shachain_get_hash(shachain, shachain_index(commit_num), &sha))
279 return false;
280 BUILD_ASSERT(sizeof(*preimage) == sizeof(sha));
281 memcpy(preimage, &sha, sizeof(*preimage));
282 return true;
283}

Callers 1

peer_start_channeldFunction · 0.50

Calls 2

shachain_get_hashFunction · 0.85
shachain_indexFunction · 0.85

Tested by

no test coverage detected