MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / SendPacket

Method SendPacket

src/test/net_tests.cpp:1220–1232  ·  view source on GitHub ↗

Schedule an encrypted packet with specified content/aad/ignore to be sent to transport * (only after ReceiveKey). */

Source from the content-addressed store, hash-verified

1218 /** Schedule an encrypted packet with specified content/aad/ignore to be sent to transport
1219 * (only after ReceiveKey). */
1220 void SendPacket(std::span<const uint8_t> content, std::span<const uint8_t> aad = {}, bool ignore = false)
1221 {
1222 // Use cipher to construct ciphertext.
1223 std::vector<std::byte> ciphertext;
1224 ciphertext.resize(content.size() + BIP324Cipher::EXPANSION);
1225 m_cipher.Encrypt(
1226 /*contents=*/MakeByteSpan(content),
1227 /*aad=*/MakeByteSpan(aad),
1228 /*ignore=*/ignore,
1229 /*output=*/ciphertext);
1230 // Schedule it for sending.
1231 Send(ciphertext);
1232 }
1233
1234 /** Schedule garbage terminator to be sent to the transport (only after ReceiveKey). */
1235 void SendGarbageTerm()

Callers 1

BOOST_AUTO_TEST_CASEFunction · 0.80

Calls 4

MakeByteSpanFunction · 0.85
resizeMethod · 0.45
sizeMethod · 0.45
EncryptMethod · 0.45

Tested by

no test coverage detected