Skip to content

Commit b169035

Browse files
Merge remote-tracking branch 'origin/2024-upstream-fixes'
2 parents bd7c9df + 32666d2 commit b169035

6 files changed

Lines changed: 270 additions & 79 deletions

File tree

src/blockencodings.cpp

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,8 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
5252
if (cmpctblock.shorttxids.size() + cmpctblock.prefilledtxn.size() > MAX_BLOCK_WEIGHT / MIN_SERIALIZABLE_TRANSACTION_WEIGHT)
5353
return READ_STATUS_INVALID;
5454

55-
assert(header.IsNull() && txn_available.empty());
55+
if (!header.IsNull() || !txn_available.empty()) return READ_STATUS_INVALID;
56+
5657
header = cmpctblock.header;
5758
txn_available.resize(cmpctblock.BlockTxCount());
5859

@@ -167,14 +168,18 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
167168
return READ_STATUS_OK;
168169
}
169170

170-
bool PartiallyDownloadedBlock::IsTxAvailable(size_t index) const {
171-
assert(!header.IsNull());
171+
bool PartiallyDownloadedBlock::IsTxAvailable(size_t index) const
172+
{
173+
if (header.IsNull()) return false;
174+
172175
assert(index < txn_available.size());
173176
return txn_available[index] != nullptr;
174177
}
175178

176-
ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<CTransactionRef>& vtx_missing) {
177-
assert(!header.IsNull());
179+
ReadStatus PartiallyDownloadedBlock::FillBlock(CBlock& block, const std::vector<CTransactionRef>& vtx_missing)
180+
{
181+
if (header.IsNull()) return READ_STATUS_INVALID;
182+
178183
uint256 hash = header.GetHash();
179184
block = header;
180185
block.vtx.resize(txn_available.size());

src/net.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,9 @@ class CNodeStats
252252
int nVersion;
253253
std::string cleanSubVer;
254254
bool fInbound;
255+
// We requested high bandwidth connection to peer
255256
bool m_bip152_highbandwidth_to;
257+
// Peer requested high bandwidth connection
256258
bool m_bip152_highbandwidth_from;
257259
int m_starting_height;
258260
uint64_t nSendBytes;

0 commit comments

Comments
 (0)