I tested the NU5 components of this PR by locally setting the protocol
version to 170014. I forgot to check that without that override, the
test would skip the NU5 checks. The reason it defaulted to NU5 is that
the test was reading the client version 4040150, which is indeed not
less than the NU5 protocol version ^_^;;
This mitigates a potential race condition between mutation of
`mapWallet` and writes to the wallet database that can result
in the state of the databse becoming inconsistent with the in-memory
set of transactions.
filterInventoryKnown is only used when relaying transactions,
so stop adding block hashes to the filter.
(cherry picked from commit bitcoin/bitcoin@383fc10ebb)
Zcash: Excludes comment change, as bitcoin/bitcoin#7129 has not been
backported yet.
Extend P2P test framework to make it possible to expect reject
codes for transactions and blocks.
(cherry picked from commit bitcoin/bitcoin@20411903d7)
Move mempool rejections to debug category `mempoolrej`, to make it possible
to show them without enabling the entire category `mempool` which is
high volume.
(cherry picked from commit bitcoin/bitcoin@7f1f8f5edf)
Add detailed state information to the errors, as it is no longer being
logged downstream.
Also add the state information to mempool rejection debug message in
ProcessMessages.
(cherry picked from commit bitcoin/bitcoin@66daed5e1b)
Remove unnecessary direct logging in CheckTransaction,
AcceptToMemoryPool, CheckTxInputs, CScriptCheck::operator()
All status information should be returned in the CValidationState.
Relevant debug information is also added to the CValidationState using
the recently introduced debug message.
Do keep the "BUG! PLEASE REPORT THIS! ConnectInputs failed against MANDATORY but not STANDARD flags"
error as it is meant to appear as bug in the log.
(cherry picked from commit bitcoin/bitcoin@6cab808272)
It is necessary to be able to concisely log a validation state.
Convert CValidationState to a human-readable message for logging.
(cherry picked from commit 9003c7cdd88402986e48ec126258fc10d6742fc7)
Add status codes specific to AcceptToMempool procession of transactions.
These can never happen due to block validation, and must never be sent
over the P2P network. Add assertions where appropriate.
(cherry picked from commit bitcoin/bitcoin@dc58258adf)
Add a field `strDebugMessage` which can be passed to DoS or Invalid,
and queried using GetDebugMessage() to add extra troubleshooting
information to the validation state.
(cherry picked from commit bitcoin/bitcoin@fbf44e6f3e)
This gets rid of a warning. Add an assertion to make sure that the
reject code is in the correct range for the network protocol
(if it is outside the range it must be a bug)
(cherry picked from commit bitcoin/bitcoin@5922b6774e)
PushInventory() is currently called with a CInv object, which can be a
MSG_TX or MSG_BLOCK. PushInventory() only uses the type to determine
whether to add the hash to setInventoryTxToSend or
vInventoryBlockToSend.
Since the caller always knows what type of inventory they're pushing,
the CInv is wastefully constructed and thrown away, and tx/block relay
is being split out, we split the function into PushTxInventory() and
PushBlockInventory().
(cherry picked from commit bitcoin/bitcoin@f52d403b81)
Zcash: Adjusted to account for bitcoin/bitcoin#15759 not having been
backported.
This concretizes the numbers and adds a comment to make it clear that
these numbers are fixed by the protocol, and may avoid people forgetting
to claim numbers in the future (e.g. issue #8500).
Also gets rid of a weird unused `MSG_TYPE_MAX` in the middle of the
enumeration (thanks @paveljanik for noticing).
(cherry picked from commit bitcoin/bitcoin@1df311118d)
The P2P network uses a fixed protocol, these sizes shouldn't change
based on what happens to be the architecture.
(cherry picked from commit bitcoin/bitcoin@305087bdf6)
In principle, the checksums of P2P packets are simply 4-byte blobs which
are the first four bytes of SHA256(SHA256(payload)).
Currently they are handled as little-endian 32-bit integers half of the
time, as blobs the other half, sometimes copying the one to the other,
resulting in somewhat confused code.
This PR changes the handling to be consistent both at packet creation
and receiving, making it (I think) easier to understand.
(cherry picked from commit bitcoin/bitcoin@41e58faf04)