core: refactor block queue

It requires only two methods from Blockchainer: AddBlock and
BlockHeight. New interface will allow to easily reuse the block queue
for state exchange purposes.
This commit is contained in:
Anna Shaleva 2021-07-30 17:29:49 +03:00
parent 35501a281a
commit 72e654332e
3 changed files with 12 additions and 3 deletions

View file

@ -11,7 +11,7 @@ type blockQueue struct {
log *zap.Logger
queue *queue.PriorityQueue
checkBlocks chan struct{}
chain blockchainer.Blockchainer
chain blockchainer.Blockqueuer
relayF func(*block.Block)
}
@ -21,7 +21,7 @@ const (
blockCacheSize = 2000
)
func newBlockQueue(capacity int, bc blockchainer.Blockchainer, log *zap.Logger, relayer func(*block.Block)) *blockQueue {
func newBlockQueue(capacity int, bc blockchainer.Blockqueuer, log *zap.Logger, relayer func(*block.Block)) *blockQueue {
if log == nil {
return nil
}