rpc, node, mempool and start of ight client

This commit is contained in:
Marko Baricevic
2021-02-02 14:42:20 +01:00
parent b2f3e767a7
commit 7e7e962d93
26 changed files with 73 additions and 77 deletions
+1 -1
View File
@@ -68,7 +68,7 @@ func TestCacheAfterUpdate(t *testing.T) {
tx := types.Tx{byte(v)}
updateTxs = append(updateTxs, tx)
}
err := mempool.Update(int64(tcIndex), updateTxs, abciResponses(len(updateTxs), abci.CodeTypeOK), nil, nil)
err := mempool.Update(uint64(tcIndex), updateTxs, abciResponses(len(updateTxs), abci.CodeTypeOK), nil, nil)
require.NoError(t, err)
for _, v := range tc.reAddIndices {
+7 -7
View File
@@ -36,8 +36,8 @@ var newline = []byte("\n")
// be efficiently accessed by multiple concurrent readers.
type CListMempool struct {
// Atomic integers
height int64 // the last block Update()'d to
txsBytes int64 // total size of mempool, in bytes
height uint64 // the last block Update()'d to
txsBytes int64 // total size of mempool, in bytes
// notify listeners (ie. consensus) when txs are available
notifiedTxsAvailable bool
@@ -83,7 +83,7 @@ type CListMempoolOption func(*CListMempool)
func NewCListMempool(
config *cfg.MempoolConfig,
proxyAppConn proxy.AppConnMempool,
height int64,
height uint64,
options ...CListMempoolOption,
) *CListMempool {
mempool := &CListMempool{
@@ -577,7 +577,7 @@ func (mem *CListMempool) ReapMaxTxs(max int) types.Txs {
// Lock() must be help by the caller during execution.
func (mem *CListMempool) Update(
height int64,
height uint64,
txs types.Txs,
deliverTxResponses []*abci.ResponseDeliverTx,
preCheck PreCheckFunc,
@@ -672,7 +672,7 @@ func (mem *CListMempool) recheckTxs() {
// mempoolTx is a transaction that successfully ran
type mempoolTx struct {
height int64 // height that this tx had been validated in
height uint64 // height that this tx had been validated in
gasWanted int64 // amount of gas this tx states it will require
tx types.Tx //
@@ -682,8 +682,8 @@ type mempoolTx struct {
}
// Height returns the height for this transaction
func (memTx *mempoolTx) Height() int64 {
return atomic.LoadInt64(&memTx.height)
func (memTx *mempoolTx) Height() uint64 {
return atomic.LoadUint64(&memTx.height)
}
//--------------------------------------------------------------------------------
+1 -1
View File
@@ -40,7 +40,7 @@ type Mempool interface {
// NOTE: this should be called *after* block is committed by consensus.
// NOTE: Lock/Unlock must be managed by caller
Update(
blockHeight int64,
blockHeight uint64,
blockTxs types.Txs,
deliverTxResponses []*abci.ResponseDeliverTx,
newPreFn PreCheckFunc,
+1 -1
View File
@@ -21,7 +21,7 @@ func (Mempool) CheckTx(_ types.Tx, _ func(*abci.Response), _ mempl.TxInfo) error
func (Mempool) ReapMaxBytesMaxGas(_, _ int64) types.Txs { return types.Txs{} }
func (Mempool) ReapMaxTxs(n int) types.Txs { return types.Txs{} }
func (Mempool) Update(
_ int64,
_ uint64,
_ types.Txs,
_ []*abci.ResponseDeliverTx,
_ mempl.PreCheckFunc,
+1 -1
View File
@@ -39,7 +39,7 @@ const (
// peer information. This should eventually be replaced with a message-oriented
// approach utilizing the p2p stack.
type PeerManager interface {
GetHeight(p2p.NodeID) int64
GetHeight(p2p.NodeID) uint64
}
// Reactor implements a service that contains mempool of txs that are broadcasted