25 #include <unordered_map> 27 #include <unordered_set> 50 class TransactionQueue;
78 bool isSyncing()
const;
94 void foreachPeer(
std::function<
bool(std::shared_ptr<EthereumPeer>)>
const& _f)
const;
97 std::shared_ptr<p2p::Capability> newPeerCapability(std::shared_ptr<p2p::SessionFace>
const& _s,
unsigned _idOffset,
p2p::CapDesc const& _cap, uint16_t _capID)
override;
102 std::tuple<std::vector<std::shared_ptr<EthereumPeer>>, std::vector<std::shared_ptr<EthereumPeer>>, std::vector<std::shared_ptr<p2p::SessionFace>>>
randomSelection(
unsigned _percent = 25,
std::function<
bool(
EthereumPeer*)>
const& _allow = [](
EthereumPeer const*){
return true; });
105 virtual void doWork()
override;
107 void maintainTransactions();
108 void maintainBlocks(
h256 const& _currentBlock);
115 bool ensureInitialised();
132 bool m_newTransactions =
false;
133 bool m_newBlocks =
false;
138 std::atomic<time_t> m_lastTick = { 0 };
void noteNewTransactions()
Adapted from code found on http://stackoverflow.com/questions/180947/base64-decode-snippet-in-c Origi...
bool isInitialised() const
Check to see if the network peer-state initialisation has happened.
#define function(a, b, c, d, k, s)
const unsigned c_protocolVersion
Current protocol version.
A queue of Transactions, each stored as RLP.
Implements the blockchain database.
std::pair< std::string, u256 > CapDesc
BlockQueue const & bq() const
virtual void onStarting() override
static const char * name()
virtual void onStopping() override
unsigned protocolVersion() const
OverlayDB const & m_db
References to DB, needed for some of the Ethereum Protocol responses.
vector< T > randomSelection(vector< T > const &_t, unsigned _n)
bool isBanned(p2p::NodeID const &_id) const
h256Hash m_transactionsSent
std::unique_ptr< BlockChainSync > m_sync
std::recursive_mutex RecursiveMutex
void setNetworkId(u256 _n)
static unsigned const c_oldProtocolVersion
std::unordered_set< p2p::NodeID > m_banned
std::shared_ptr< EthereumHostDataFace > m_hostData
OverlayDB const & db() const
BlockChain const & m_chain
BlockChain const & chain() const
void onBlockImported(BlockHeader const &_info)
std::shared_ptr< EthereumPeerObserverFace > m_peerObserver
boost::multiprecision::number< boost::multiprecision::cpp_int_backend< 256, 256, boost::multiprecision::unsigned_magnitude, boost::multiprecision::unchecked, void >> u256
TransactionQueue & m_tq
Maintains a list of incoming transactions not yet in a block on the blockchain.
BlockQueue & m_bq
Maintains a list of incoming blocks not yet on the blockchain (to be imported).
The default logging channels.
std::unordered_set< h256 > h256Hash
static const int verbosity
static char const * stateName(SyncState _s)