HomePhabricator

p2p: ensure inv is GenMsgTx before ToGenTxid in inv processing

Description

p2p: ensure inv is GenMsgTx before ToGenTxid in inv processing

Summary:

and otherwise log that an unknown INV type was received.

In INV processing, when handling transaction type inv messages,
ToGenTxid() expects that we constructed the CInv ourselves or
that we verified that it is for a transaction type CInv.

Therefore, change this `else` branch into an `else if (inv.GenMsgTx())`
to make this safer and log any INVs that fall through.

Completes backport of core#19610:
https://github.com/bitcoin/bitcoin/pull/19610/commits/fb56d37612dea6666e7da73d671311a697570dae

Depends on D9507.

Test Plan:

ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

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

Details

Provenance
John Newbery <john@johnnewbery.com>Authored on Aug 21 2020, 14:10
FabienCommitted on May 12 2021, 19:12
FabienPushed on May 12 2021, 19:12
Reviewer
Restricted Project
Differential Revision
D9508: p2p: ensure inv is GenMsgTx before ToGenTxid in inv processing
Parents
rABC0f0d105ce2bf: p2p: make gtxid(.hash) and fAlreadyHave localvars const
Branches
Unknown
Tags
Unknown