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
+6 -6
View File
@@ -23,10 +23,10 @@ const (
)
type blockStore interface {
LoadBlock(height int64) *types.Block
LoadBlock(height uint64) *types.Block
SaveBlock(*types.Block, *types.PartSet, *types.Commit)
Base() int64
Height() int64
Base() uint64
Height() uint64
}
// BlockchainReactor handles fast sync protocol.
@@ -40,8 +40,8 @@ type BlockchainReactor struct {
logger log.Logger
mtx tmsync.RWMutex
maxPeerHeight int64
syncHeight int64
maxPeerHeight uint64
syncHeight uint64
events chan Event // non-nil during a fast sync
reporter behaviour.Reporter
@@ -50,7 +50,7 @@ type BlockchainReactor struct {
}
type blockApplier interface {
ApplyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, int64, error)
ApplyBlock(state state.State, blockID types.BlockID, block *types.Block) (state.State, uint64, error)
}
// XXX: unify naming in this package around tmState
+3 -3
View File
@@ -157,11 +157,11 @@ func newScPeer(peerID p2p.NodeID) *scPeer {
// scheduler will attempt to schedule new block requests with `trySchedule`
// events and remove slow peers with `tryPrune` events.
type scheduler struct {
initHeight int64
initHeight uint64
// next block that needs to be processed. All blocks with smaller height are
// in Processed state.
height int64
height uint64
// lastAdvance tracks the last time a block execution happened.
// syncTimeout is the maximum time the scheduler waits to advance in the fast sync process before finishing.
@@ -197,7 +197,7 @@ func (sc scheduler) String() string {
sc.initHeight, sc.blockStates, sc.peers, sc.pendingBlocks, sc.pendingTime, sc.receivedBlocks)
}
func newScheduler(initHeight int64, startTime time.Time) *scheduler {
func newScheduler(initHeight uint64, startTime time.Time) *scheduler {
sc := scheduler{
initHeight: initHeight,
lastAdvance: startTime,