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

Function encrypt_append

connectd/multiplex.c:518–537  ·  view source on GitHub ↗

Close the connection if this fails */

Source from the content-addressed store, hash-verified

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

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