25 #include <condition_variable> 41 #define ctxq dev::LogOutputStream<dev::eth::TransactionQueueTraceChannel, true>() 62 void enqueue(
RLP const& _data,
h512 const& _nodeId);
78 void drop(
h256 const& _txHash);
82 unsigned waiting(
Address const& _a)
const;
100 void setFuture(
h256 const& _t);
155 transaction = std::move(_other.transaction);
156 nodeId = std::move(_other.nodeId);
186 void insertCurrent_WITH_LOCK(std::pair<h256, Transaction>
const& _p);
188 bool remove_WITH_LOCK(
h256 const& _txHash);
195 std::unordered_map<h256, std::function<void(ImportResult)>>
m_callbacks;
201 std::unordered_map<Address, std::map<u256, VerifiedTransaction>>
m_future;
208 unsigned m_futureSize = 0;
214 std::atomic<bool> m_aborting = {
false};
SharedMutex m_lock
General lock.
unsigned m_limit
Max number of pending transactions.
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
h256Hash m_dropped
Transactions that have previously been dropped.
Super-duper signal mechanism. TODO: replace with somthing a bit heavier weight.
A queue of Transactions, each stored as RLP.
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 ...
std::unordered_map< Address, std::map< u256, VerifiedTransaction > > m_future
std::unordered_map< h256, PriorityQueue::iterator > m_currentByHash
Transaction hash to set ref.
VerifiedTransaction(VerifiedTransaction &&_t)
TransactionQueue(Limits const &_l)
unsigned m_futureLimit
Max number of future transactions.
Handler onReady(T const &_t)
Register a handler that will be called once there is a new transaction imported.
UnverifiedTransaction & operator=(UnverifiedTransaction &&_other)
std::vector< Transaction > Transactions
Nice name for vector of Transaction.
std::vector< std::thread > m_verifiers
Address const & sender() const
std::hash for asio::adress
assert(len-trim+(2 *lenIndices)<=WIDTH)
Signal< ImportResult, h256 const &, h512 const & > m_onImport
Called for each import attempt. Arguments are result, transaction id an node id. Be nice and exit fas...
Mutex x_queue
Verification queue mutex.
Signal< h256 const & > m_onReplaced
Called whan transction is dropped during a call to import() to make room for another transaction...
bytes transaction
RLP encoded transaction data.
VerifiedTransaction(Transaction const &_t)
#define DEV_GUARDED(MUTEX)
Simple block guard.
Verified and imported transaction.
std::deque< UnverifiedTransaction > m_unverified
Pending verification queue.
h256Hash m_known
Headers of transactions in both sets.
IfDropped
Import transaction policy.
std::unordered_map< h256, std::function< void(ImportResult)> > m_callbacks
Called once.
std::multiset< VerifiedTransaction, PriorityCompare > PriorityQueue
std::shared_ptr< typename Signal< Args... >::HandlerAux > Handler
std::vector< byte > bytes
Don't import transaction that was previously dropped.
bool operator()(VerifiedTransaction const &_first, VerifiedTransaction const &_second) const
Compare transaction by nonce height and gas price.
std::unordered_map< Address, std::map< u256, PriorityQueue::iterator > > m_currentByAddressAndNonce
Transactions grouped by account and nonce.
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
boost::shared_lock< boost::shared_mutex > ReadGuard
Encodes a transaction, ready to be exported to or freshly imported from RLP.
static const int verbosity
boost::shared_mutex SharedMutex
UnverifiedTransaction(bytesConstRef const &_t, h512 const &_nodeId)
UnverifiedTransaction(UnverifiedTransaction &&_t)
Transaction transaction
Transaction data.
The default logging channels.
h512 nodeId
Network Id of the peer transaction comes from.
std::unordered_set< h256 > h256Hash
Transaction pending verification.
Signal m_onReady
Future transactions.
std::condition_variable m_queueReady
Signaled when m_unverified has a new entry.
Handler< h256 const & > onReplaced(T const &_t)
Register a handler that will be called once asynchronous verification is comeplte an transaction has ...
Class for interpreting Recursive Linear-Prefix Data.
static const char * name()