forked from cosmos/cosmos-sdk
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmempool.go
31 lines (25 loc) · 1.13 KB
/
mempool.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package types
// MempoolTx we define an app-side mempool transaction interface that is as
// minimal as possible, only requiring applications to define the size of the
// transaction to be used when reaping and getting the transaction itself.
// Interface type casting can be used in the actual app-side mempool implementation.
type MempoolTx interface {
Tx
// Size returns the size of the transaction in bytes.
Size() int
}
type Mempool interface {
// Insert attempts to insert a MempoolTx into the app-side mempool returning
// an error upon failure.
Insert(Context, MempoolTx) error
// Select returns the next set of available transactions from the app-side
// mempool, up to maxBytes or until the mempool is empty. The application can
// decide to return transactions from its own mempool, from the incoming
// txs, or some combination of both.
Select(ctx Context, txs [][]byte, maxBytes int) ([]MempoolTx, error)
// CountTx returns the number of transactions currently in the mempool.
CountTx() int
// Remove attempts to remove a transaction from the mempool, returning an error
// upon failure.
Remove(Context, MempoolTx) error
}