diff --git a/pkg/core/blockchainer/blockchainer.go b/pkg/core/blockchainer/blockchainer.go index 73a5d36d5..a0d5af6f4 100644 --- a/pkg/core/blockchainer/blockchainer.go +++ b/pkg/core/blockchainer/blockchainer.go @@ -22,7 +22,7 @@ type Blockchainer interface { ApplyPolicyToTxSet([]*transaction.Transaction) []*transaction.Transaction GetConfig() config.ProtocolConfiguration AddHeaders(...*block.Header) error - AddBlock(*block.Block) error + Blockqueuer // Blockqueuer interface CalculateClaimable(h util.Uint160, endHeight uint32) (*big.Int, error) Close() InitVerificationVM(v *vm.VM, getContract func(util.Uint160) (*state.Contract, error), hash util.Uint160, witness *transaction.Witness) error diff --git a/pkg/core/blockchainer/blockqueuer.go b/pkg/core/blockchainer/blockqueuer.go new file mode 100644 index 000000000..384ccd489 --- /dev/null +++ b/pkg/core/blockchainer/blockqueuer.go @@ -0,0 +1,9 @@ +package blockchainer + +import "github.com/nspcc-dev/neo-go/pkg/core/block" + +// Blockqueuer is an interface for blockqueue. +type Blockqueuer interface { + AddBlock(block *block.Block) error + BlockHeight() uint32 +} diff --git a/pkg/network/blockqueue.go b/pkg/network/blockqueue.go index a5bb92c42..8a21cab1b 100644 --- a/pkg/network/blockqueue.go +++ b/pkg/network/blockqueue.go @@ -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 }