mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-01 03:01:05 +00:00
p2p: add assertion for BlockTransactionsRequest indexes
Adds Assume() check in net_processing after deserialization and validate DifferenceFormatter Class invariant.
This commit is contained in:
parent
58be359f6b
commit
65a10fc3c5
@ -4135,6 +4135,11 @@ void PeerManagerImpl::ProcessMessage(CNode& pfrom, const std::string& msg_type,
|
||||
if (msg_type == NetMsgType::GETBLOCKTXN) {
|
||||
BlockTransactionsRequest req;
|
||||
vRecv >> req;
|
||||
// Verify differential encoding invariant: indexes must be strictly increasing
|
||||
// DifferenceFormatter should guarantee this property during deserialization
|
||||
for (size_t i = 1; i < req.indexes.size(); ++i) {
|
||||
Assume(req.indexes[i] > req.indexes[i-1]);
|
||||
}
|
||||
|
||||
std::shared_ptr<const CBlock> recent_block;
|
||||
{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user