streams: Remove confusing DataStream::in_avail()

The alias of the size() method is confusing, because:

* It claims to be part of the Bitcoin Core stream subset (streams
  interface), but this is not used by any other stream interface. Mostly
  the `write(std::span)` and `read(std::span)` define the stream
  interface.
* It casts the size_t to i32, but the only place that calls the function
  casts that back to size_t.
* Providing this alias for size() without a proper reason is confusing.

Fix all issues by removing it and using the size() method.
This commit is contained in:
MarcoFalke
2026-04-24 12:36:02 +02:00
parent fa5ab0220e
commit fa204100e1
2 changed files with 1 additions and 4 deletions

View File

@@ -5557,7 +5557,7 @@ bool PeerManagerImpl::RejectIncomingTxs(const CNode& peer) const
void PeerManagerImpl::ProcessPong(CNode& pfrom, Peer& peer, const NodeClock::time_point ping_end, DataStream& vRecv)
{
uint64_t nonce = 0;
size_t nAvail = vRecv.in_avail();
const size_t nAvail{vRecv.size()};
bool bPingFinished = false;
std::string sProblem;