![]() |
Ethereum
PoC-8
The C++ Implementation of Ethereum
|
A queue of Transactions, each stored as RLP. Maintains a transaction queue sorted by nonce diff and gas price. @threadsafe. More...
#include <TransactionQueue.h>
Classes | |
| struct | Limits |
| struct | Status |
Public Member Functions | |
| TransactionQueue (unsigned _limit=1024, unsigned _futureLimit=1024) | |
| TransactionQueue. More... | |
| TransactionQueue (Limits const &_l) | |
| ~TransactionQueue () | |
| void | enqueue (RLP const &_data, h512 const &_nodeId) |
| ImportResult | import (bytes const &_tx, IfDropped _ik=IfDropped::Ignore) |
| ImportResult | import (Transaction const &_tx, IfDropped _ik=IfDropped::Ignore) |
| void | drop (h256 const &_txHash) |
| unsigned | waiting (Address const &_a) const |
| Transactions | topTransactions (unsigned _limit, h256Hash const &_avoid=h256Hash()) const |
| h256Hash | knownTransactions () const |
| u256 | maxNonce (Address const &_a) const |
| void | setFuture (h256 const &_t) |
| void | dropGood (Transaction const &_t) |
| Status | status () const |
| Limits | limits () const |
| void | clear () |
| Clear the queue. More... | |
| template<class T > | |
| Handler | onReady (T const &_t) |
| Register a handler that will be called once there is a new transaction imported. More... | |
| template<class T > | |
| Handler< ImportResult, h256 const &, h512 const & > | onImport (T const &_t) |
| Register a handler that will be called once asynchronous verification is comeplte an transaction has been imported. More... | |
| template<class T > | |
| Handler< h256 const & > | onReplaced (T const &_t) |
| Register a handler that will be called once asynchronous verification is comeplte an transaction has been imported. More... | |
A queue of Transactions, each stored as RLP. Maintains a transaction queue sorted by nonce diff and gas price. @threadsafe.
Definition at line 44 of file TransactionQueue.h.
| TransactionQueue::TransactionQueue | ( | unsigned | _limit = 1024, |
| unsigned | _futureLimit = 1024 |
||
| ) |
| _limit | Maximum number of pending transactions in the queue. |
| _futureLimit | Maximum number of future nonce transactions. |
Definition at line 33 of file TransactionQueue.cpp.
|
inline |
Definition at line 53 of file TransactionQueue.h.
| TransactionQueue::~TransactionQueue | ( | ) |
Definition at line 46 of file TransactionQueue.cpp.
| void TransactionQueue::clear | ( | ) |
Clear the queue.
Definition at line 344 of file TransactionQueue.cpp.
| void TransactionQueue::drop | ( | h256 const & | _txHash | ) |
Remove transaction from the queue
| _txHash | Trasnaction hash |
Definition at line 323 of file TransactionQueue.cpp.
| void TransactionQueue::dropGood | ( | Transaction const & | _t | ) |
Drop a trasnaction from the list if exists and move following future trasnactions to current (if any)
| _t | Transaction hash |
Definition at line 335 of file TransactionQueue.cpp.
Add transaction to the queue to be verified and imported.
| _data | RLP encoded transaction data. |
| _nodeId | Optional network identified of a node transaction comes from. |
Definition at line 356 of file TransactionQueue.cpp.
|
inline |
Verify and add transaction to the queue synchronously.
| _tx | RLP encoded transaction data. |
| _ik | Set to Retry to force re-addinga transaction that was previously dropped. |
Definition at line 64 of file TransactionQueue.h.
| ImportResult TransactionQueue::import | ( | Transaction const & | _tx, |
| IfDropped | _ik = IfDropped::Ignore |
||
| ) |
Verify and add transaction to the queue synchronously.
| _tx | Trasnaction data. |
| _ik | Set to Retry to force re-addinga transaction that was previously dropped. |
Definition at line 79 of file TransactionQueue.cpp.
| h256Hash TransactionQueue::knownTransactions | ( | ) | const |
Get a hash set of transactions in the queue
Definition at line 112 of file TransactionQueue.cpp.
|
inline |
Definition at line 113 of file TransactionQueue.h.
Get max nonce for an account
Definition at line 184 of file TransactionQueue.cpp.
|
inline |
Register a handler that will be called once asynchronous verification is comeplte an transaction has been imported.
Definition at line 122 of file TransactionQueue.h.
|
inline |
Register a handler that will be called once there is a new transaction imported.
Definition at line 119 of file TransactionQueue.h.
|
inline |
Register a handler that will be called once asynchronous verification is comeplte an transaction has been imported.
Definition at line 125 of file TransactionQueue.h.
| void TransactionQueue::setFuture | ( | h256 const & | _t | ) |
Mark transaction as future. It wont be retured in topTransactions list until a transaction with a preceeding nonce is imported or marked with dropGood
| _t | Transaction hash |
Definition at line 253 of file TransactionQueue.cpp.
|
inline |
Definition at line 110 of file TransactionQueue.h.
| Transactions TransactionQueue::topTransactions | ( | unsigned | _limit, |
| h256Hash const & | _avoid = h256Hash() |
||
| ) | const |
Get top transactions from the queue. Returned transactions are not removed from the queue automatically.
| _limit | Max number of transactions to return. |
| _avoid | Transactions to avoid returning. |
Definition at line 102 of file TransactionQueue.cpp.
| unsigned TransactionQueue::waiting | ( | Address const & | _a | ) | const |
Get number of pending transactions for account.
Definition at line 240 of file TransactionQueue.cpp.