HomePhabricator

log: Avoid treating remote misbehvior as local system error

Description

log: Avoid treating remote misbehvior as local system error

Summary:

When logging failures of CheckBlockHeader (high-hash), they are always logged as system error. This is problematic for several reasons:

  • Submitting a blockheader that fails CheckBlockHeader over RPC will result in a debug log line that starts with ERROR. Proper behaviour should be to log not anything and instead only return the failure reason to the RPC user. This pull does not fix this issue entirely, but is a good first step in the right direction.
  • A misbehaving peer that sends us an invalid block header that fails CheckBlockHeader will result in a debug log line that starts with ERROR. Proper behavior should be to log the remote peer misbehavior if logging for that category was enabled. This pull fixes this issue for CheckBlockHeader and other functions can be adjusted as well if needed in follow-ups. This should be a good first step in the right direction.

refactor: Switch ValidationState mode to C++11 enum class

log: Avoid treating remote misbehvior as local system error

This is a backport of core#19526

Test Plan: ninja all check-all

Reviewers: #bitcoin_abc, majcosta

Reviewed By: #bitcoin_abc, majcosta

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

Details

Provenance
MarcoFalke <falke.marco@gmail.com>Authored on Jul 15 2020, 08:26
PiRKCommitted on Sep 2 2021, 14:24
PiRKPushed on Sep 2 2021, 14:24
Reviewer
Restricted Project
Differential Revision
D10021: log: Avoid treating remote misbehvior as local system error
Parents
rABC45414ac4c1e2: replace MAX_BLOCKS_ONLY_CONNECTIONS with MAX_BLOCK_RELAY_ONLY_CONNECTIONS
Branches
Unknown
Tags
Unknown