Elichai Turkel 87ad9dfc59
[NOD-1423] Refactor the miner and mempool (#981)
* Make TransactionOutputEstimatedSerializedSize public

* Update the mempool interface

* Refactor the mempool to the new design

* refactor txselection and blocktemplatebuilder to the new design

* Update the mining manager

* Update the MiningManager factory

* mempool fix requested changed
2020-11-01 18:27:49 +02:00

31 lines
891 B
Go

package miningmanager
import (
"github.com/kaspanet/kaspad/domain/consensus"
"github.com/kaspanet/kaspad/domain/miningmanager/blocktemplatebuilder"
mempoolpkg "github.com/kaspanet/kaspad/domain/miningmanager/mempool"
)
// Factory instantiates new mining managers
type Factory interface {
NewMiningManager(consensus consensus.Consensus, blockMaxMass uint64) MiningManager
}
type factory struct{}
// NewMiningManager instantiate a new mining manager
func (f *factory) NewMiningManager(consensus consensus.Consensus, blockMaxMass uint64) MiningManager {
mempool := mempoolpkg.New(consensus)
blockTemplateBuilder := blocktemplatebuilder.New(consensus, mempool, blockMaxMass)
return &miningManager{
mempool: mempool,
blockTemplateBuilder: blockTemplateBuilder,
}
}
// NewFactory creates a new mining manager factory
func NewFactory() Factory {
return &factory{}
}