File tree Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Expand file tree Collapse file tree 1 file changed +10
-5
lines changed Original file line number Diff line number Diff line change @@ -52,7 +52,8 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
52
52
if (cmpctblock.shorttxids .size () + cmpctblock.prefilledtxn .size () > MAX_BLOCK_WEIGHT / MIN_SERIALIZABLE_TRANSACTION_WEIGHT)
53
53
return READ_STATUS_INVALID;
54
54
55
- assert (header.IsNull () && txn_available.empty ());
55
+ if (!header.IsNull () || !txn_available.empty ()) return READ_STATUS_INVALID;
56
+
56
57
header = cmpctblock.header ;
57
58
txn_available.resize (cmpctblock.BlockTxCount ());
58
59
@@ -167,14 +168,18 @@ ReadStatus PartiallyDownloadedBlock::InitData(const CBlockHeaderAndShortTxIDs& c
167
168
return READ_STATUS_OK;
168
169
}
169
170
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
+
172
175
assert (index < txn_available.size ());
173
176
return txn_available[index] != nullptr ;
174
177
}
175
178
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
+
178
183
uint256 hash = header.GetHash ();
179
184
block = header;
180
185
block.vtx .resize (txn_available.size ());
You can’t perform that action at this time.
0 commit comments