Expect garbage and garbage terminator to have been received, and process them (only after * ReceiveKey). */
| 1285 | /** Expect garbage and garbage terminator to have been received, and process them (only after |
| 1286 | * ReceiveKey). */ |
| 1287 | void ReceiveGarbage() |
| 1288 | { |
| 1289 | // Figure out the garbage length. |
| 1290 | size_t garblen; |
| 1291 | for (garblen = 0; garblen <= V2Transport::MAX_GARBAGE_LEN; ++garblen) { |
| 1292 | BOOST_REQUIRE(m_received.size() >= garblen + BIP324Cipher::GARBAGE_TERMINATOR_LEN); |
| 1293 | auto term_span = MakeByteSpan(std::span{m_received}.subspan(garblen, BIP324Cipher::GARBAGE_TERMINATOR_LEN)); |
| 1294 | if (std::ranges::equal(term_span, m_cipher.GetReceiveGarbageTerminator())) break; |
| 1295 | } |
| 1296 | // Copy the garbage to a buffer. |
| 1297 | m_recv_garbage.assign(m_received.begin(), m_received.begin() + garblen); |
| 1298 | // Strip garbage + garbage terminator off the front of the receive buffer. |
| 1299 | m_received.erase(m_received.begin(), m_received.begin() + garblen + BIP324Cipher::GARBAGE_TERMINATOR_LEN); |
| 1300 | } |
| 1301 | |
| 1302 | /** Expect version packet to have been received, and process it (only after ReceiveKey). */ |
| 1303 | void ReceiveVersion() |
no test coverage detected