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

TransactionsQueue implementation #559

Merged
merged 6 commits into from Mar 4, 2016
Merged

TransactionsQueue implementation #559

merged 6 commits into from Mar 4, 2016

Conversation

tomusdrw
Copy link
Collaborator

@tomusdrw tomusdrw commented Mar 1, 2016

TransactionQueue should allow to:

  • add a transaction (or list of transactions in batch)
  • remove a transaction (or list of transactions in batch)

If transaction's nonce matches last known nonce+1 it should be placed to current queue. (current will always contain contigous set of transactions from some sender e.g. (Sender(A), Nonce(1..3)))
If transaction's nonce is greater then expected+1 it will be put to future queue.

Whenever nonces gap is introduced transactions are moved to future accordingly. Whenever gap is filled transactions should be moved from future back to current

Both future and current are kept in PriorityQueue sorted by relative nonce height (distance between transaction's nonce and first nonce in current (in case of current) or last nonce in current (in case of future). If that height is equal transactions are sorted by gas price and later by nonce (low nonces have more priority) and sender)

@tomusdrw tomusdrw added the A0-pleasereview 🤓 Pull request needs code review. label Mar 1, 2016
@@ -70,6 +70,8 @@ use io::NetSyncIo;
mod chain;
mod io;
mod range_collection;
// TODO [todr] Made public to suppress dead code warnings
pub mod transaction_queue;
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Will become private when it's integrated with EthSync

@arkpar arkpar added A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 2, 2016

//! Transaction Queue

use std::vec::Vec;
Copy link
Collaborator

Choose a reason for hiding this comment

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

you don't need to import Vec, cause it's implicitly imported to every file.

@tomusdrw tomusdrw added A0-pleasereview 🤓 Pull request needs code review. and removed A4-gotissues 💥 Pull request is reviewed and has significant issues which must be addressed. labels Mar 4, 2016
@arkpar arkpar added A8-looksgood 🦄 Pull request is reviewed well. and removed A0-pleasereview 🤓 Pull request needs code review. labels Mar 4, 2016
NikVolf added a commit that referenced this pull request Mar 4, 2016
TransactionsQueue implementation
@NikVolf NikVolf merged commit a4f4764 into master Mar 4, 2016
@tomusdrw tomusdrw deleted the tx_queue branch March 4, 2016 23:52
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants