Skip to content

Conversation

@random-zebra
Copy link

  • change CValidationState::chRejectCode to int
  • add CValidationState::strDebugMessage for optional information
  • add FormatStateMessage function to convert CValidationState to a human-readable message
  • introduce REJECT_INTERNAL rejection codes for ATMP and make their logging optional
  • remove unnecessary direct logging in CheckTransaction, AcceptToMemoryPool, CheckTxInputs, CScriptCheck::operator()
  • add detailed state information to the errors in CheckBlock and ConnectBlock

Backported from:

furszy
furszy previously approved these changes Jun 11, 2020
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work!, liked it a lot. code review ACK 10cba02 . Can be merged at any time for me.

@random-zebra
Copy link
Author

Rebased on master due to conflicts after merging #1673

- backports bitcoin/bitcoin@fbf44e6

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.
- backports bitcoin/bitcoin@dc58258

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.
- backports bitcoin/bitcoin@9003c7c

It is necessary to be able to concisely log a validation state.
Convert CValidationState to a human-readable message for logging.
- backports bitcoin/bitcoin@6cab808

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.
- backports bitcoin/bitcoin@66daed5

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.
Move mempool rejections to debug category `mempoolrej`, to make it
possible to show them without enabling the entire category `mempool`
which is high volume.
@random-zebra random-zebra force-pushed the 202006_validation-error-spam branch from 8b375c7 to ca489c9 Compare June 19, 2020 12:37
@random-zebra
Copy link
Author

Rebased again due to conflicts with #1668 just merged.

Copy link
Collaborator

@Fuzzbawls Fuzzbawls left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK ca489c9

@random-zebra random-zebra requested a review from furszy June 20, 2020 10:14
Copy link

@furszy furszy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

re ACK ca489c9 and merging

@furszy furszy merged commit 8d7e780 into PIVX-Project:master Jun 20, 2020
random-zebra added a commit that referenced this pull request Jun 27, 2020
a0de4da [Wallet] Abandon tx in CommitTransaction if ATMP fails (random-zebra)
f3e07f7 Expose FormatStateMessage (Alex Morcos)

Pull request description:

  This is an alternative to #1664.
  It takes the opposite approach.
  When ATMP fails in `CommitTransaction`, instead of just returning the txid (hoping that the failure is not permanent) try to directly abandon the transaction.
  Save the result of these operations in a new struct `CWallet::CommitResult`, and use it to give a detailed feedback to the user (via log lines, JSON-RPC errors and GUI dialogs).

  Based on top of:
  - [x] #1670

  This PR also cherry-picks 5f12263 from bitcoin#6898, in order to use `FormatStateMessage` outside of main.

ACKs for top commit:
  furszy:
    ACK a0de4da
  Fuzzbawls:
    ACK a0de4da

Tree-SHA512: 5ae372f97eeed017002628646eee3f559af6dc488e1b24541b29f5ce763412fb569e057933468fc828a2aec3f2c17e2d818130b72d41c73524cfa90680877d23
@random-zebra random-zebra deleted the 202006_validation-error-spam branch September 24, 2020 00:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants