Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add check for duplicate transactional inputs and outputs in validators #1861

Merged
merged 1 commit into from
May 18, 2020

Conversation

SWvheerden
Copy link
Collaborator

Description

Adds a check for duplicate inputs and outputs in blocks for the validators

Motivation and Context

There is not check other than the database settings to ensure that inputs and outputs are not duplicate. This means a block can pass validation although its not valid.

How Has This Been Tested?

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Feature refactor (No new feature or functional changes, but performance or technical debt improvements)
  • New Tests
  • Documentation

Checklist:

  • I'm merging against the development branch.
  • I ran cargo-fmt --all before pushing.
  • I have squashed my commits into a single commit.
  • My change requires a change to the documentation.
  • I have updated the documentation accordingly.
  • I have added tests to cover my changes.

@@ -108,12 +114,18 @@ impl<B: BlockchainBackend> Validation<Block, B> for FullConsensusValidator {
trace!(target: LOG_TARGET, "FCV - Coinbase output ok for {}", &block_id);
check_block_weight(block, &self.rules.consensus_constants())?;
trace!(target: LOG_TARGET, "FCV - Block weight ok for {}", &block_id);
check_duplicate_transactions_inputs(block)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you add the description of the check to the validate function doc string list.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Done

@SWvheerden SWvheerden force-pushed the sw_addduplicate_validation_check branch from b951f43 to 261070d Compare May 14, 2020 14:45
Copy link
Contributor

@neonknight64 neonknight64 left a comment

Choose a reason for hiding this comment

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

LGTM

@SWvheerden SWvheerden mentioned this pull request May 15, 2020
12 tasks
@sdbondi sdbondi merged commit d7758bf into development May 18, 2020
@SWvheerden SWvheerden deleted the sw_addduplicate_validation_check branch May 18, 2020 08:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants