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

Function encrypt_append

connectd/multiplex.c:521–540  ·  view source on GitHub ↗

Close the connection if this fails */

Source from the content-addressed store, hash-verified

519
520/* Close the connection if this fails */
521static bool encrypt_append(struct peer *peer, const u8 *msg TAKES)
522{
523 int type = fromwire_peektype(msg);
524 const u8 *enc;
525 size_t enclen;
526
527 /* Special message type directing us to process batch items. */
528 if (type == WIRE_PROTOCOL_BATCH_ELEMENT) {
529 enc = process_batch_elements(tmpctx, peer, msg);
530 if (!enc)
531 return false;
532 } else {
533 enc = cryptomsg_encrypt_msg(tmpctx, &peer->cs, msg);
534 }
535 enclen = tal_bytelen(enc);
536 memcpy(membuf_add(&peer->encrypted_peer_out, enclen),
537 enc,
538 enclen);
539 return true;
540}
541
542static void pad_encrypted_queue(struct peer *peer)
543{

Callers 2

pad_encrypted_queueFunction · 0.85
write_to_peerFunction · 0.85

Calls 4

fromwire_peektypeFunction · 0.85
process_batch_elementsFunction · 0.85
cryptomsg_encrypt_msgFunction · 0.85
tal_bytelenFunction · 0.85

Tested by

no test coverage detected