HomePhabricator

net: simplify the call to vProcessMsg.splice()

Description

net: simplify the call to vProcessMsg.splice()

Summary:
At the time when

cpp
pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), it);

is called, it is certainly pnode->vRecvMsg.end() which makes the
call equivalent to:

cpp
pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg, pnode->vRecvMsg.begin(), pnode->vRecvMsg.end());

which is equivalent to:

cpp
pnode->vProcessMsg.splice(pnode->vProcessMsg.end(), pnode->vRecvMsg);

Thus, use the latter. Further, maybe irrelevant, but the latter has
constant complexity while the original code is O(length of vRecvMsg).

This is a backport of core#26888
Depends on D18243

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, Fabien

Reviewed By: #bitcoin_abc, Fabien

Subscribers: Fabien

Differential Revision: https://reviews.bitcoinabc.org/D18244

Details

Provenance
Vasil Dimov <vd@FreeBSD.org>Authored on Jan 13 2023, 13:44
PiRKCommitted on Jun 13 2025, 05:36
PiRKPushed on Jun 13 2025, 05:36
Reviewer
Restricted Project
Differential Revision
D18244: net: simplify the call to vProcessMsg.splice()
Parents
rABC5c6394a11a86: [chronik] Electrum: implement the mempool.get_fee_histogram() endpoint
Branches
Unknown
Tags
Unknown