Documentation ¶
Index ¶
- Variables
- func BigHexToBigDecimal(num *hexutil.Big) *big.Int
- func BigHexToBigFloat(num *hexutil.Big) (*big.Float, error)
- func BigIntToBigFloat(num *big.Int) (*big.Float, error)
- func HexToDecimal(num hexutil.Uint64) string
- func HumanReadableGasPrice(num *hexutil.Big) string
- func IsPresentInCurrentPool(txs map[string]map[string]*MemPoolTx, txHash common.Hash) bool
- type MemPool
- func (m *MemPool) Exists(hash common.Hash) bool
- func (m *MemPool) Get(hash common.Hash) *MemPoolTx
- func (m *MemPool) PendingDuplicates(hash common.Hash) []*MemPoolTx
- func (m *MemPool) PendingForGTE(x time.Duration) []*MemPoolTx
- func (m *MemPool) PendingForLTE(x time.Duration) []*MemPoolTx
- func (m *MemPool) PendingFrom(address common.Address) []*MemPoolTx
- func (m *MemPool) PendingPoolLength() uint64
- func (m *MemPool) PendingTo(address common.Address) []*MemPoolTx
- func (m *MemPool) Process(ctx context.Context, rpc *rpc.Client, pubsub *redis.Client, ...)
- func (m *MemPool) QueuedDuplicates(hash common.Hash) []*MemPoolTx
- func (m *MemPool) QueuedForGTE(x time.Duration) []*MemPoolTx
- func (m *MemPool) QueuedForLTE(x time.Duration) []*MemPoolTx
- func (m *MemPool) QueuedFrom(address common.Address) []*MemPoolTx
- func (m *MemPool) QueuedPoolLength() uint64
- func (m *MemPool) QueuedTo(address common.Address) []*MemPoolTx
- func (m *MemPool) Stat(start time.Time)
- func (m *MemPool) TopXPendingWithHighGasPrice(x uint64) []*MemPoolTx
- func (m *MemPool) TopXPendingWithLowGasPrice(x uint64) []*MemPoolTx
- func (m *MemPool) TopXQueuedWithHighGasPrice(x uint64) []*MemPoolTx
- func (m *MemPool) TopXQueuedWithLowGasPrice(x uint64) []*MemPoolTx
- type MemPoolTx
- func (m *MemPoolTx) IsDropped(ctx context.Context, rpc *rpc.Client) (bool, error)
- func (m *MemPoolTx) IsDuplicateOf(tx *MemPoolTx) bool
- func (m *MemPoolTx) IsNonceExhausted(ctx context.Context, rpc *rpc.Client) (bool, error)
- func (m *MemPoolTx) IsPendingForGTE(x time.Duration) bool
- func (m *MemPoolTx) IsPendingForLTE(x time.Duration) bool
- func (m *MemPoolTx) IsQueuedForGTE(x time.Duration) bool
- func (m *MemPoolTx) IsQueuedForLTE(x time.Duration) bool
- func (m *MemPoolTx) IsSentFrom(address common.Address) bool
- func (m *MemPoolTx) IsSentTo(address common.Address) bool
- func (m *MemPoolTx) IsUnstuck(ctx context.Context, rpc *rpc.Client) (bool, error)
- func (m *MemPoolTx) ToGraphQL() *model.MemPoolTx
- func (m *MemPoolTx) ToMessagePack() ([]byte, error)
- type MemPoolTxsDesc
- type Msg
- type PendingPool
- func (p *PendingPool) Add(ctx context.Context, pubsub *redis.Client, tx *MemPoolTx) bool
- func (p *PendingPool) AddPendings(ctx context.Context, pubsub *redis.Client, ...) uint64
- func (p *PendingPool) Count() uint64
- func (p *PendingPool) DuplicateTxs(hash common.Hash) []*MemPoolTx
- func (p *PendingPool) Exists(hash common.Hash) bool
- func (p *PendingPool) FresherThanX(x time.Duration) []*MemPoolTx
- func (p *PendingPool) Get(hash common.Hash) *MemPoolTx
- func (p *PendingPool) ListTxs() []*MemPoolTx
- func (p *PendingPool) OlderThanX(x time.Duration) []*MemPoolTx
- func (p *PendingPool) PublishAdded(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
- func (p *PendingPool) PublishRemoved(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
- func (p *PendingPool) Remove(ctx context.Context, pubsub *redis.Client, txStat *TxStatus) bool
- func (p *PendingPool) RemoveConfirmedAndDropped(ctx context.Context, rpc *rpc.Client, pubsub *redis.Client, ...) uint64
- func (p *PendingPool) SentFrom(address common.Address) []*MemPoolTx
- func (p *PendingPool) SentTo(address common.Address) []*MemPoolTx
- func (p *PendingPool) SortTxs() bool
- func (p *PendingPool) TopXWithHighGasPrice(x uint64) []*MemPoolTx
- func (p *PendingPool) TopXWithLowGasPrice(x uint64) []*MemPoolTx
- type QueuedPool
- func (q *QueuedPool) Add(ctx context.Context, pubsub *redis.Client, tx *MemPoolTx) bool
- func (q *QueuedPool) AddQueued(ctx context.Context, pubsub *redis.Client, ...) uint64
- func (q *QueuedPool) Count() uint64
- func (q *QueuedPool) DuplicateTxs(hash common.Hash) []*MemPoolTx
- func (q *QueuedPool) Exists(hash common.Hash) bool
- func (q *QueuedPool) FresherThanX(x time.Duration) []*MemPoolTx
- func (q *QueuedPool) Get(hash common.Hash) *MemPoolTx
- func (q *QueuedPool) ListTxs() []*MemPoolTx
- func (q *QueuedPool) OlderThanX(x time.Duration) []*MemPoolTx
- func (q *QueuedPool) PublishAdded(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
- func (q *QueuedPool) PublishRemoved(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
- func (q *QueuedPool) Remove(ctx context.Context, pubsub *redis.Client, txHash common.Hash) *MemPoolTx
- func (q *QueuedPool) RemoveUnstuck(ctx context.Context, rpc *rpc.Client, pubsub *redis.Client, ...) uint64
- func (q *QueuedPool) SentFrom(address common.Address) []*MemPoolTx
- func (q *QueuedPool) SentTo(address common.Address) []*MemPoolTx
- func (q *QueuedPool) SortTxs() bool
- func (q *QueuedPool) TopXWithHighGasPrice(x uint64) []*MemPoolTx
- func (q *QueuedPool) TopXWithLowGasPrice(x uint64) []*MemPoolTx
- type Resource
- type Stat
- type TxStatus
Constants ¶
This section is empty.
Variables ¶
var ( STUCK = 1 UNSTUCK = 2 PENDING = 3 CONFIRMED = 4 DROPPED = 5 )
Functions ¶
func BigHexToBigDecimal ¶
BigHexToBigDecimal - Given a hex encoded big number, converts it to decimal big integer
func BigHexToBigFloat ¶
BigHexToBigFloat - Converts hex encoded big integer to big floating point number
@note To be used for better precision flaoting point arithmetic
func BigIntToBigFloat ¶
BigIntToBigFloat - Given big number, attempts to convert it to big floating point number
func HexToDecimal ¶
HexToDecimal - Converts hex encoded uint64 to decimal string
func HumanReadableGasPrice ¶
HumanReadableGasPrice - Returns gas price paid for tx in Gwei unit
func IsPresentInCurrentPool ¶
IsPresentInCurrentPool - Given tx hash, which was previously present in pending/ queued pool attempts to check whether it's present in current txpool content or not
@note `txs` is current pending/ queued pool state received over RPC interface
Types ¶
type MemPool ¶
type MemPool struct { Pending *PendingPool Queued *QueuedPool }
MemPool - Current state of mempool, where all pending/ queued tx(s) are present. Among these pending tx(s), any of them can be picked up during next block mining phase, but any tx(s) present in queued pool, can't be picked up until some problem with sender address is resolved.
Tx(s) ending up in queued pool, happens very commonly due to account nonce gaps
func (*MemPool) Exists ¶ added in v0.4.0
Exists - Given a txHash, attempts to check whether this tx is present in either of pending/ queued pool
func (*MemPool) Get ¶ added in v0.4.0
Get - Given a txhash, attempts to find out tx, if present in any of pending/ queued pool
func (*MemPool) PendingDuplicates ¶ added in v0.3.0
PendingDuplicates - Find duplicate tx(s), given txHash, present in pending mempool
func (*MemPool) PendingForGTE ¶
PendingForGTE - Returning list of tx(s), pending for more than x time unit
func (*MemPool) PendingForLTE ¶
PendingForLTE - Returning list of tx(s), pending for less than x time unit
func (*MemPool) PendingFrom ¶
PendingFrom - List of tx(s) pending from address
@note These are going to be same nonce tx(s), only one of them will make to next block, others to be dropped
func (*MemPool) PendingPoolLength ¶
PendingPoolLength - Returning current pending tx queue length
func (*MemPool) PendingTo ¶
PendingTo - List of tx(s) living in pending pool, sent to specified address
func (*MemPool) Process ¶
func (m *MemPool) Process(ctx context.Context, rpc *rpc.Client, pubsub *redis.Client, pending map[string]map[string]*MemPoolTx, queued map[string]map[string]*MemPoolTx)
Process - Process all current pending & queued tx pool content & populate our in-memory buffer
func (*MemPool) QueuedDuplicates ¶ added in v0.3.0
QueuedDuplicates - Find duplicate tx(s), given txHash, present in queued mempool
func (*MemPool) QueuedForGTE ¶
QueuedForGTE - Returning list of tx(s), queued for more than x time unit
func (*MemPool) QueuedForLTE ¶
QueuedForLTE - Returning list of tx(s), queued for less than x time unit
func (*MemPool) QueuedFrom ¶
QueuedFrom - List of stuck tx(s) from specified address, due to nonce gap
func (*MemPool) QueuedPoolLength ¶
QueuedPoolLength - Returning current queued tx queue length
func (*MemPool) QueuedTo ¶
QueuedTo - List of stuck tx(s) present in queued pool, sent to specified address
func (*MemPool) TopXPendingWithHighGasPrice ¶
TopXPendingWithHighGasPrice - Returns a list of top `X` pending tx(s) where high gas price tx(s) are prioritized
func (*MemPool) TopXPendingWithLowGasPrice ¶
TopXPendingWithLowGasPrice - Returns a list of top `X` pending tx(s) where low gas price tx(s) are prioritized
func (*MemPool) TopXQueuedWithHighGasPrice ¶
TopXQueuedWithHighGasPrice - Returns a list of top `X` queued tx(s) where high gas price tx(s) are prioritized
func (*MemPool) TopXQueuedWithLowGasPrice ¶
TopXQueuedWithLowGasPrice - Returns a list of top `X` queued tx(s) where low gas price tx(s) are prioritized
type MemPoolTx ¶
type MemPoolTx struct { BlockHash *common.Hash `json:"blockHash"` BlockNumber *hexutil.Big `json:"blockNumber"` From common.Address `json:"from"` Gas hexutil.Uint64 `json:"gas"` GasPrice *hexutil.Big `json:"gasPrice"` Hash common.Hash `json:"hash"` Input hexutil.Bytes `json:"input"` Nonce hexutil.Uint64 `json:"nonce"` To *common.Address `json:"to"` TransactionIndex *hexutil.Uint64 `json:"transactionIndex"` Value *hexutil.Big `json:"value"` Type hexutil.Uint64 `json:"type"` ChainID *hexutil.Big `json:"chainId,omitempty"` V *hexutil.Big `json:"v"` R *hexutil.Big `json:"r"` S *hexutil.Big `json:"s"` QueuedAt time.Time UnstuckAt time.Time PendingFrom time.Time ConfirmedAt time.Time DroppedAt time.Time Pool string }
MemPoolTx - This is how tx is placed in mempool, after performing RPC call for fetching currently pending/ queued tx(s) in mempool it'll be destructured into this format, for further computation
func FromMessagePack ¶
FromMessagePack - Given serialized byte array, attempts to deserialize into structured tx format
func (*MemPoolTx) IsDropped ¶ added in v0.4.0
IsDropped - Attempts to check whether this tx was dropped by node or not
Dropping can happen due to higher priority tx from same account with same nonce was encountered
func (*MemPoolTx) IsDuplicateOf ¶ added in v0.4.0
IsDuplicateOf - Checks whether one tx is duplicate of another one or not
@note Two tx(s) are considered to be duplicate of each other when both of them having same from address & nonce
func (*MemPoolTx) IsNonceExhausted ¶
IsNonceExhausted - Multiple tx(s) of same/ different value can be sent to network with same nonce, where one of them which seems most profitable to miner, will be picked up, while mining next block
This function will help us in checking whether nonce of this tx is exhausted or not i.e. whether some other tx is same nonce is mined or not
If mined, we can drop this tx from mempool
func (*MemPoolTx) IsPendingForGTE ¶
IsPendingForGTE - Test if this tx has been in pending pool for more than or equal to `X` time unit
func (*MemPoolTx) IsPendingForLTE ¶
IsPendingForLTE - Test if this tx has been in pending pool for less than or equal to `X` time unit
func (*MemPoolTx) IsQueuedForGTE ¶
IsQueuedForGTE - Test if this tx has been in queued pool for more than or equal to `X` time unit
func (*MemPoolTx) IsQueuedForLTE ¶
IsQueuedForLTE - Test if this tx has been in queued pool for less than or equal to `X` time unit
func (*MemPoolTx) IsSentFrom ¶
IsSentFrom - Checks whether this tx was sent from specified address or not
func (*MemPoolTx) IsSentTo ¶
IsSentTo - Checks if this was sent to certain address ( EOA/ Contract )
@note If it's a contract creation tx, it'll not have `to` address
func (*MemPoolTx) IsUnstuck ¶
IsUnstuck - Checking whether this tx is unstuck now
@note Tx(s) generally get stuck in queued pool due to nonce gaps
func (*MemPoolTx) ToMessagePack ¶
ToMessagePack - Serialize to message pack encoded byte array format
type MemPoolTxsDesc ¶
type MemPoolTxsDesc []*MemPoolTx
MemPoolTxsDesc - List of mempool tx(s)
@note This structure to be used for sorting tx(s) in descending way, using gas price they're paying
func (*MemPoolTxsDesc) Len ¶
func (m *MemPoolTxsDesc) Len() int
Len - Count of tx(s) present in mempool
func (*MemPoolTxsDesc) Less ¶
func (m *MemPoolTxsDesc) Less(i, j int) bool
Less - Actual sorting logic i.e. higher gas price tx gets prioritized
func (*MemPoolTxsDesc) Swap ¶
func (m *MemPoolTxsDesc) Swap(i, j int)
Swap - Swap two tx(s), given their index in slice
type PendingPool ¶
type PendingPool struct { Transactions map[common.Hash]*MemPoolTx SortedTxs MemPoolTxsDesc Lock *sync.RWMutex }
PendingPool - Currently present pending tx(s) i.e. which are ready to be mined in next block
func (*PendingPool) Add ¶
func (p *PendingPool) Add(ctx context.Context, pubsub *redis.Client, tx *MemPoolTx) bool
Add - Attempts to add new tx found in pending pool into harmony mempool, so that further manipulation can be performed on it
If it returns `true`, it denotes, it's success, otherwise it's failure because this tx is already present in pending pool
func (*PendingPool) AddPendings ¶
func (p *PendingPool) AddPendings(ctx context.Context, pubsub *redis.Client, txs map[string]map[string]*MemPoolTx) uint64
AddPendings - Update latest pending pool state
func (*PendingPool) Count ¶
func (p *PendingPool) Count() uint64
Count - How many tx(s) currently present in pending pool
func (*PendingPool) DuplicateTxs ¶ added in v0.3.0
func (p *PendingPool) DuplicateTxs(hash common.Hash) []*MemPoolTx
DuplicateTxs - Attempting to find duplicate tx(s) for given txHash.
@note In duplicate tx list, the tx which was provided as input will not be included
Considering one tx duplicate of given one, if this tx has same nonce & sender address, as of given ones
func (*PendingPool) Exists ¶ added in v0.4.0
func (p *PendingPool) Exists(hash common.Hash) bool
Exists - Checks whether tx of given hash exists on pending pool or not
func (*PendingPool) FresherThanX ¶
func (p *PendingPool) FresherThanX(x time.Duration) []*MemPoolTx
FresherThanX - Returns a list of all pending tx(s), which are living in mempool for less than or equals to `X` time unit
func (*PendingPool) Get ¶ added in v0.4.0
func (p *PendingPool) Get(hash common.Hash) *MemPoolTx
Get - Given tx hash, attempts to find out tx in pending pool, if any
Returns nil, if found nothing
func (*PendingPool) ListTxs ¶
func (p *PendingPool) ListTxs() []*MemPoolTx
ListTxs - Returns all tx(s) present in pending pool, as slice
func (*PendingPool) OlderThanX ¶
func (p *PendingPool) OlderThanX(x time.Duration) []*MemPoolTx
OlderThanX - Returns a list of all pending tx(s), which are living in mempool for more than or equals to `X` time unit
func (*PendingPool) PublishAdded ¶
func (p *PendingPool) PublishAdded(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
PublishAdded - Publish new pending tx pool content ( in messagepack serialized format ) to pubsub topic
func (*PendingPool) PublishRemoved ¶
func (p *PendingPool) PublishRemoved(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
PublishRemoved - Publish old pending tx pool content ( in messagepack serialized format ) to pubsub topic
These tx(s) are leaving pending pool i.e. they're confirmed now
func (*PendingPool) Remove ¶
func (p *PendingPool) Remove(ctx context.Context, pubsub *redis.Client, txStat *TxStatus) bool
Remove - Removes already existing tx from pending tx pool denoting it has been mined i.e. confirmed
func (*PendingPool) RemoveConfirmedAndDropped ¶ added in v0.4.0
func (p *PendingPool) RemoveConfirmedAndDropped(ctx context.Context, rpc *rpc.Client, pubsub *redis.Client, txs map[string]map[string]*MemPoolTx) uint64
RemoveConfirmed - Removes pending tx(s) from pool which have been confirmed & returns how many were removed. If 0 is returned, denotes all tx(s) pending last time are still in pending state
func (*PendingPool) SentFrom ¶
func (p *PendingPool) SentFrom(address common.Address) []*MemPoolTx
SentFrom - Returns a list of pending tx(s) sent from specified address
func (*PendingPool) SentTo ¶
func (p *PendingPool) SentTo(address common.Address) []*MemPoolTx
SentTo - Returns a list of pending tx(s) sent to specified address
func (*PendingPool) SortTxs ¶ added in v0.4.0
func (p *PendingPool) SortTxs() bool
SortTxs - Sorts current pending tx list ascendingly as per gas price paid by senders
@note This is supposed to be invoked after every time you add new tx(s) to pending pool
func (*PendingPool) TopXWithHighGasPrice ¶
func (p *PendingPool) TopXWithHighGasPrice(x uint64) []*MemPoolTx
TopXWithHighGasPrice - Returns only top `X` tx(s) present in pending mempool, where being top is determined by how much gas price paid by tx sender
func (*PendingPool) TopXWithLowGasPrice ¶
func (p *PendingPool) TopXWithLowGasPrice(x uint64) []*MemPoolTx
TopXWithLowGasPrice - Returns only top `X` tx(s) present in pending mempool, where being top is determined by how low gas price paid by tx sender
type QueuedPool ¶
type QueuedPool struct { Transactions map[common.Hash]*MemPoolTx SortedTxs MemPoolTxsDesc Lock *sync.RWMutex }
QueuedPool - Currently present queued tx(s) i.e. these tx(s) are stuck due to some reasons, one very common reason is nonce gap
What it essentially denotes is, these tx(s) are not ready to be picked up when next block is going to be picked, when these tx(s) are going to be moved to pending pool, only they can be considered before mining
func (*QueuedPool) Add ¶
func (q *QueuedPool) Add(ctx context.Context, pubsub *redis.Client, tx *MemPoolTx) bool
Add - Attempts to add new tx found in pending pool into harmony mempool, so that further manipulation can be performed on it
If it returns `true`, it denotes, it's success, otherwise it's failure because this tx is already present in pending pool
func (*QueuedPool) AddQueued ¶
func (q *QueuedPool) AddQueued(ctx context.Context, pubsub *redis.Client, txs map[string]map[string]*MemPoolTx) uint64
AddQueued - Update latest queued pool state
func (*QueuedPool) Count ¶
func (q *QueuedPool) Count() uint64
Count - How many tx(s) currently present in pending pool
func (*QueuedPool) DuplicateTxs ¶ added in v0.3.0
func (q *QueuedPool) DuplicateTxs(hash common.Hash) []*MemPoolTx
DuplicateTxs - Attempting to find duplicate tx(s) for given txHash.
@note In duplicate tx list, the tx which was provided as input will not be included
Considering one tx duplicate of given one, if this tx has same nonce & sender address, as of given ones
func (*QueuedPool) Exists ¶ added in v0.4.0
func (q *QueuedPool) Exists(hash common.Hash) bool
Exists - Checks whether tx of given hash exists on queued pool or not
func (*QueuedPool) FresherThanX ¶
func (q *QueuedPool) FresherThanX(x time.Duration) []*MemPoolTx
FresherThanX - Returns a list of all queued tx(s), which are living in mempool for less than or equals to `X` time unit
func (*QueuedPool) Get ¶ added in v0.4.0
func (q *QueuedPool) Get(hash common.Hash) *MemPoolTx
Get - Given tx hash, attempts to find out tx in queued pool, if any
Returns nil, if found nothing
func (*QueuedPool) ListTxs ¶
func (q *QueuedPool) ListTxs() []*MemPoolTx
ListTxs - Returns all tx(s) present in queued pool, as slice
func (*QueuedPool) OlderThanX ¶
func (q *QueuedPool) OlderThanX(x time.Duration) []*MemPoolTx
OlderThanX - Returns a list of all queued tx(s), which are living in mempool for more than or equals to `X` time unit
func (*QueuedPool) PublishAdded ¶
func (q *QueuedPool) PublishAdded(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
PublishAdded - Publish new tx, entered queued pool, ( in messagepack serialized format ) to pubsub topic
func (*QueuedPool) PublishRemoved ¶
func (q *QueuedPool) PublishRemoved(ctx context.Context, pubsub *redis.Client, msg *MemPoolTx)
PublishRemoved - Publish unstuck tx, leaving queued pool ( in messagepack serialized format ) to pubsub topic
These tx(s) are leaving queued pool i.e. they're ( probably ) going to sit in pending pool now, unless they're already mined & harmony failed to keep track of it
func (*QueuedPool) Remove ¶
func (q *QueuedPool) Remove(ctx context.Context, pubsub *redis.Client, txHash common.Hash) *MemPoolTx
Remove - Removes already existing tx from pending tx pool denoting it has been mined i.e. confirmed
func (*QueuedPool) RemoveUnstuck ¶
func (q *QueuedPool) RemoveUnstuck(ctx context.Context, rpc *rpc.Client, pubsub *redis.Client, pendingPool *PendingPool, pending map[string]map[string]*MemPoolTx, queued map[string]map[string]*MemPoolTx) uint64
RemoveUnstuck - Removes queued tx(s) from pool which have been unstuck & returns how many were removed. If 0 is returned, denotes all tx(s) queued last time are still in queued state
Only when their respective blocking factor will get unblocked, they'll be pushed into pending pool
func (*QueuedPool) SentFrom ¶
func (q *QueuedPool) SentFrom(address common.Address) []*MemPoolTx
SentFrom - Returns a list of queued tx(s) sent from specified address
func (*QueuedPool) SentTo ¶
func (q *QueuedPool) SentTo(address common.Address) []*MemPoolTx
SentTo - Returns a list of queued tx(s) sent to specified address
func (*QueuedPool) SortTxs ¶ added in v0.4.0
func (q *QueuedPool) SortTxs() bool
SortTxs - Keeping sort entries in tx list for tx(s) currently living in queued pool, where sorting is being done as per gas price paid by tx senders
@note This function is supposed to be invoked every time you add any new tx to queued pool
func (*QueuedPool) TopXWithHighGasPrice ¶
func (q *QueuedPool) TopXWithHighGasPrice(x uint64) []*MemPoolTx
TopXWithHighGasPrice - Returns only top `X` tx(s) present in queued mempool, where being top is determined by how much gas price paid by tx sender
func (*QueuedPool) TopXWithLowGasPrice ¶
func (q *QueuedPool) TopXWithLowGasPrice(x uint64) []*MemPoolTx
TopXWithLowGasPrice - Returns only top `X` tx(s) present in queued mempool, where being top is determined by how low gas price paid by tx sender
type Resource ¶
type Resource struct { RPCClient *rpc.Client Pool *MemPool Redis *redis.Client StartedAt time.Time NetworkID uint64 }
Resource - Shared resources among multiple go routines
Needs to be released carefully when shutting down
type Stat ¶
type Stat struct { PendingPoolSize uint64 `json:"pendingPoolSize"` QueuedPoolSize uint64 `json:"queuedPoolSize"` Uptime string `json:"uptime"` NetworkID uint64 `json:"networkID"` }
Stat - Response to client queries for current mempool state to be sent in this form
type TxStatus ¶
TxStatus - When ever multiple go routines need to concurrently fetch status of tx, given hash they will communicate back to caller using this data structure, where `status` denotes result of intended check, which was performed concurrently
@note Data to be sent in this form over communication channel