mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-06 18:53:21 +01:00
Merge bitcoin/bitcoin#29071: refactor: Remove Span operator==, Use std::ranges::equal
fad0cf6f26refactor: Use std::ranges::equal in GetNetworkForMagic (MarcoFalke)fadf0a7e15refactor: Remove Span operator==, Use std::ranges::equal (MarcoFalke) Pull request description: `std::span` removed the comparison operators, so it makes sense to remove them for the `Span` "backport" as well. Using `std::ranges::equal` also has the benefit that some `Span` temporary constructions can now be dropped. This is required to move from `Span` toward `std::span`. ACKs for top commit: hodlinator: Untested Code Review re-ACKfad0cf6stickies-v: ACKfad0cf6f26TheCharlatan: ACKfad0cf6f26Tree-SHA512: 5b9d1826ceac2aabae2295bc89893dd23ac3a1cc0d41988331cdbdc21be531aa91795d5273819f349f79648c6c4f30ed31af6e7a3816153e92080061b92ffe00
This commit is contained in:
@@ -46,13 +46,12 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <cmath>
|
||||
#include <cstdint>
|
||||
#include <functional>
|
||||
#include <optional>
|
||||
#include <unordered_map>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
/** Maximum number of block-relay-only anchor connections */
|
||||
static constexpr size_t MAX_BLOCK_RELAY_ONLY_ANCHORS = 2;
|
||||
static_assert (MAX_BLOCK_RELAY_ONLY_ANCHORS <= static_cast<size_t>(MAX_BLOCK_RELAY_ONLY_CONNECTIONS), "MAX_BLOCK_RELAY_ONLY_ANCHORS must not exceed MAX_BLOCK_RELAY_ONLY_CONNECTIONS.");
|
||||
@@ -1150,7 +1149,7 @@ bool V2Transport::ProcessReceivedGarbageBytes() noexcept
|
||||
Assume(m_recv_state == RecvState::GARB_GARBTERM);
|
||||
Assume(m_recv_buffer.size() <= MAX_GARBAGE_LEN + BIP324Cipher::GARBAGE_TERMINATOR_LEN);
|
||||
if (m_recv_buffer.size() >= BIP324Cipher::GARBAGE_TERMINATOR_LEN) {
|
||||
if (MakeByteSpan(m_recv_buffer).last(BIP324Cipher::GARBAGE_TERMINATOR_LEN) == m_cipher.GetReceiveGarbageTerminator()) {
|
||||
if (std::ranges::equal(MakeByteSpan(m_recv_buffer).last(BIP324Cipher::GARBAGE_TERMINATOR_LEN), m_cipher.GetReceiveGarbageTerminator())) {
|
||||
// Garbage terminator received. Store garbage to authenticate it as AAD later.
|
||||
m_recv_aad = std::move(m_recv_buffer);
|
||||
m_recv_aad.resize(m_recv_aad.size() - BIP324Cipher::GARBAGE_TERMINATOR_LEN);
|
||||
|
||||
Reference in New Issue
Block a user