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

Function test_final_decrypt

common/test/run-blindedpath_enctlv.c:125–148  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

123}
124
125static void test_final_decrypt(const struct pubkey *path_key,
126 const u8 *enctlv,
127 const struct privkey *me,
128 const struct pubkey *expected_alias,
129 const struct secret *expected_self_id)
130{
131 struct pubkey my_pubkey, dummy, alias;
132 struct secret ss;
133 struct tlv_encrypted_data_tlv *enc;
134
135 /* We don't actually have an onion, so we put some dummy */
136 pubkey_from_privkey(me, &dummy);
137
138 mykey = me;
139 pubkey_from_privkey(me, &my_pubkey);
140 assert(unblind_onion(path_key, test_ecdh, &dummy, &ss));
141 enc = decrypt_encrypted_data(tmpctx, &ss, enctlv);
142 assert(enc);
143 assert(blindedpath_get_alias(&ss, &my_pubkey, &alias));
144
145 assert(pubkey_eq(&alias, expected_alias));
146 assert(memeq(enc->path_id, tal_bytelen(enc->path_id), expected_self_id,
147 sizeof(*expected_self_id)));
148}
149
150int main(int argc, char *argv[])
151{

Callers 1

mainFunction · 0.85

Calls 6

pubkey_from_privkeyFunction · 0.85
unblind_onionFunction · 0.85
blindedpath_get_aliasFunction · 0.85
memeqFunction · 0.85
tal_bytelenFunction · 0.85
decrypt_encrypted_dataFunction · 0.70

Tested by

no test coverage detected