Skip to content
This repository has been archived by the owner on Nov 6, 2020. It is now read-only.

Reject existing transactions #3762

Merged
merged 1 commit into from
Dec 9, 2016
Merged

Reject existing transactions #3762

merged 1 commit into from
Dec 9, 2016

Conversation

arkpar
Copy link
Collaborator

@arkpar arkpar commented Dec 9, 2016

Balance and nonce checks are expensive. It makes sense to check if transactions exists in the blockchain first.

@arkpar arkpar added A0-pleasereview 🤓 Pull request needs code review. B0-patch M4-core ⛓ Core client code / Rust. labels Dec 9, 2016
@@ -600,6 +605,10 @@ impl Miner {
TransactionOrigin::Local | TransactionOrigin::RetractedBlock => {
transaction_queue.add(tx, origin, &fetch_account, &gas_required)
},
TransactionOrigin::External if chain.transaction_block(TransactionID::Hash(tx.hash())).is_some() => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would make sense to move the check even higher, before let origin to skip ec recovery too.
Also the error should probably be returned for local transactions as well.

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

@tomusdrw tomusdrw added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Dec 9, 2016
@gavofyork gavofyork merged commit 0a4e63b into master Dec 9, 2016
@gavofyork gavofyork deleted the tx-check branch December 9, 2016 19:17
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A8-looksgood 🦄 Pull request is reviewed well. M4-core ⛓ Core client code / Rust.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants