@ -108,7 +108,7 @@ struct WorkChannel: public LogChannel { static const char* name() { return "-W-"
# define cworkout dev::LogOutputStream<dev::eth::WorkOutChannel, true>()
template < class T > struct ABISerialiser { } ;
template < unsigned N > struct ABISerialiser < FixedHash < N > > { static bytes serialise ( FixedHash < N > const & _t ) { static_assert ( N < 32 , " Parameter sizes must be at most 32 bytes ." ) ; return bytes ( 32 - N , 0 ) + _t . asBytes ( ) ; } } ;
template < unsigned N > struct ABISerialiser < FixedHash < N > > { static bytes serialise ( FixedHash < N > const & _t ) { static_assert ( N < = 32 , " Cannot serialise hash > 32 bytes. " ) ; static_assert ( N > 0 , " Cannot serialise zero-length hash ." ) ; return bytes ( 32 - N , 0 ) + _t . asBytes ( ) ; } } ;
template < > struct ABISerialiser < u256 > { static bytes serialise ( u256 const & _t ) { return h256 ( _t ) . asBytes ( ) ; } } ;
template < > struct ABISerialiser < u160 > { static bytes serialise ( u160 const & _t ) { return bytes ( 12 , 0 ) + h160 ( _t ) . asBytes ( ) ; } } ;
template < > struct ABISerialiser < string32 > { static bytes serialise ( string32 const & _t ) { return bytesConstRef ( ( byte const * ) _t . data ( ) , 32 ) . toBytes ( ) ; } } ;
@ -125,9 +125,9 @@ template <class ... T> bytes abiIn(std::string _id, T const& ... _t)
}
template < class T > struct ABIDeserialiser { } ;
template < unsigned N > struct ABIDeserialiser < FixedHash < N > > { static FixedHash < N > deserialise ( bytesConstRef & io_t ) { static_assert ( N < 32 , " Parameter sizes must be at most 32 bytes. " ) ; FixedHash < N > ret ; io_t . cropped ( 32 - N , N ) . populate ( ret . ref ( ) ) ; io_t = io_t . cropped ( 32 ) ; return ret ; } } ;
template < unsigned N > struct ABIDeserialiser < FixedHash < N > > { static FixedHash < N > deserialise ( bytesConstRef & io_t ) { static_assert ( N < = 32 , " Parameter sizes must be at most 32 bytes. " ) ; FixedHash < N > ret ; io_t . cropped ( 32 - N , N ) . populate ( ret . ref ( ) ) ; io_t = io_t . cropped ( 32 ) ; return ret ; } } ;
template < > struct ABIDeserialiser < u256 > { static u256 deserialise ( bytesConstRef & io_t ) { u256 ret = fromBigEndian < u256 > ( io_t . cropped ( 0 , 32 ) ) ; io_t = io_t . cropped ( 32 ) ; return ret ; } } ;
template < > struct ABIDeserialiser < u160 > { static u256 deserialise ( bytesConstRef & io_t ) { u160 ret = fromBigEndian < u160 > ( io_t . cropped ( 12 , 20 ) ) ; io_t = io_t . cropped ( 32 ) ; return ret ; } } ;
template < > struct ABIDeserialiser < u160 > { static u160 deserialise ( bytesConstRef & io_t ) { u160 ret = fromBigEndian < u160 > ( io_t . cropped ( 12 , 20 ) ) ; io_t = io_t . cropped ( 32 ) ; return ret ; } } ;
template < > struct ABIDeserialiser < string32 > { static string32 deserialise ( bytesConstRef & io_t ) { string32 ret ; io_t . cropped ( 0 , 32 ) . populate ( vector_ref < char > ( ret . data ( ) , 32 ) ) ; io_t = io_t . cropped ( 32 ) ; return ret ; } } ;
template < class T > T abiOut ( bytes const & _data )
@ -188,11 +188,11 @@ public:
virtual unsigned installWatch ( LogFilter const & _filter ) ;
virtual unsigned installWatch ( h256 _filterId ) ;
virtual void uninstallWatch ( unsigned _watchId ) ;
virtual bool peekWatch ( unsigned _watchId ) const { std : : lock_guard < std : : mutex > l ( m_filterLock ) ; try { return m_watches . at ( _watchId ) . changes ! = 0 ; } catch ( . . . ) { return false ; } }
virtual bool checkWatch ( unsigned _watchId ) { std : : lock_guard < std : : mutex > l ( m_filterLock ) ; bool ret = false ; try { ret = m_watches . at ( _watchId ) . changes ! = 0 ; m_watches . at ( _watchId ) . changes = 0 ; } catch ( . . . ) { } return ret ; }
virtual bool peekWatch ( unsigned _watchId ) const { Guard l ( m_filterLock ) ; try { return m_watches . at ( _watchId ) . changes ! = 0 ; } catch ( . . . ) { return false ; } }
virtual bool checkWatch ( unsigned _watchId ) { Guard l ( m_filterLock ) ; bool ret = false ; try { ret = m_watches . at ( _watchId ) . changes ! = 0 ; m_watches . at ( _watchId ) . changes = 0 ; } catch ( . . . ) { } return ret ; }
virtual LogEntries logs ( unsigned _watchId ) const { try { std : : lock_guard < std : : mutex > l ( m_filterLock ) ; return logs ( m_filters . at ( m_watches . at ( _watchId ) . id ) . filter ) ; } catch ( . . . ) { return LogEntries ( ) ; } }
virtual LogEntries logs ( LogFilter const & _filter ) const ;
virtual LocalisedLo gEntries logs ( unsigned _watchId ) const { try { Guard l ( m_filterLock ) ; return logs ( m_filters . at ( m_watches . at ( _watchId ) . id ) . filter ) ; } catch ( . . . ) { return Localised LogEntries( ) ; } }
virtual LocalisedLo gEntries logs ( LogFilter const & _filter ) const ;
// [EXTRA API]:
@ -313,7 +313,7 @@ private:
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).
mutable boost : : shared_m utex x_stateDB ; ///< Lock on the state DB, effectively a lock on m_postMine.
mutable SharedM utex x_stateDB ; ///< Lock on the state DB, effectively a lock on m_postMine.
OverlayDB m_stateDB ; ///< Acts as the central point for the state database, so multiple States can share it.
State m_preMine ; ///< The present state of the client.
State m_postMine ; ///< The state of the client which we're mining (i.e. it'll have all the rewards added).
@ -321,7 +321,7 @@ private:
std : : weak_ptr < EthereumHost > m_host ; ///< Our Ethereum Host. Don't do anything if we can't lock.
std : : vector < Miner > m_miners ;
mutable boost : : shared_m utex x_miners ;
mutable SharedM utex x_miners ;
bool m_paranoia = false ; ///< Should we be paranoid about our state?
bool m_turboMining = false ; ///< Don't squander all of our time mining actually just sleeping.
bool m_forceMining = false ; ///< Mine even when there are no transactions pending?