Pass correct blockchain object to mempool
This commit is contained in:
parent
4512a57134
commit
4435dbbfb4
@ -124,7 +124,7 @@ func NewBlockChain(coin string, configfile string, pushHandler func(bchain.Notif
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
mempool, err := bc.CreateMempool()
|
||||
mempool, err := bc.CreateMempool(bc)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
@ -148,8 +148,8 @@ func (c *blockChainWithMetrics) Initialize() error {
|
||||
return c.b.Initialize()
|
||||
}
|
||||
|
||||
func (c *blockChainWithMetrics) CreateMempool() (bchain.Mempool, error) {
|
||||
return c.b.CreateMempool()
|
||||
func (c *blockChainWithMetrics) CreateMempool(chain bchain.BlockChain) (bchain.Mempool, error) {
|
||||
return c.b.CreateMempool(chain)
|
||||
}
|
||||
|
||||
func (c *blockChainWithMetrics) InitializeMempool(addrDescForOutpoint bchain.AddrDescForOutpointFunc, onNewTxAddr bchain.OnNewTxAddrFunc) error {
|
||||
|
||||
@ -131,9 +131,9 @@ func (b *BitcoinRPC) Initialize() error {
|
||||
}
|
||||
|
||||
// CreateMempool creates mempool if not already created, however does not initialize it
|
||||
func (b *BitcoinRPC) CreateMempool() (bchain.Mempool, error) {
|
||||
func (b *BitcoinRPC) CreateMempool(chain bchain.BlockChain) (bchain.Mempool, error) {
|
||||
if b.Mempool == nil {
|
||||
b.Mempool = bchain.NewMempoolBitcoinType(b, b.ChainConfig.MempoolWorkers, b.ChainConfig.MempoolSubWorkers)
|
||||
b.Mempool = bchain.NewMempoolBitcoinType(chain, b.ChainConfig.MempoolWorkers, b.ChainConfig.MempoolSubWorkers)
|
||||
}
|
||||
return b.Mempool, nil
|
||||
}
|
||||
|
||||
@ -164,9 +164,9 @@ func (b *EthereumRPC) Initialize() error {
|
||||
}
|
||||
|
||||
// CreateMempool creates mempool if not already created, however does not initialize it
|
||||
func (b *EthereumRPC) CreateMempool() (bchain.Mempool, error) {
|
||||
func (b *EthereumRPC) CreateMempool(chain bchain.BlockChain) (bchain.Mempool, error) {
|
||||
if b.Mempool == nil {
|
||||
b.Mempool = bchain.NewMempoolEthereumType(b)
|
||||
b.Mempool = bchain.NewMempoolEthereumType(chain)
|
||||
}
|
||||
return b.Mempool, nil
|
||||
}
|
||||
|
||||
@ -209,7 +209,7 @@ type BlockChain interface {
|
||||
// initialize the block chain connector
|
||||
Initialize() error
|
||||
// create mempool but do not initialize it
|
||||
CreateMempool() (Mempool, error)
|
||||
CreateMempool(BlockChain) (Mempool, error)
|
||||
// initialize mempool, create ZeroMQ (or other) subscription
|
||||
InitializeMempool(AddrDescForOutpointFunc, OnNewTxAddrFunc) error
|
||||
// shutdown mempool, ZeroMQ and block chain connections
|
||||
|
||||
@ -85,7 +85,7 @@ func setupPublicHTTPServer(t *testing.T) (*PublicServer, string) {
|
||||
glog.Fatal("fakechain: ", err)
|
||||
}
|
||||
|
||||
mempool, err := chain.CreateMempool()
|
||||
mempool, err := chain.CreateMempool(chain)
|
||||
if err != nil {
|
||||
glog.Fatal("mempool: ", err)
|
||||
}
|
||||
|
||||
@ -17,8 +17,8 @@ func NewFakeBlockChain(parser bchain.BlockChainParser) (bchain.BlockChain, error
|
||||
return &fakeBlockChain{&bchain.BaseChain{Parser: parser}}, nil
|
||||
}
|
||||
|
||||
func (b *fakeBlockChain) CreateMempool() (bchain.Mempool, error) {
|
||||
return bchain.NewMempoolBitcoinType(b, 1, 1), nil
|
||||
func (b *fakeBlockChain) CreateMempool(chain bchain.BlockChain) (bchain.Mempool, error) {
|
||||
return bchain.NewMempoolBitcoinType(chain, 1, 1), nil
|
||||
}
|
||||
|
||||
func (c *fakeBlockChain) Initialize() error {
|
||||
|
||||
@ -169,7 +169,7 @@ func initBlockChain(coinName string, cfg json.RawMessage) (bchain.BlockChain, bc
|
||||
return nil, nil, fmt.Errorf("BlockChain initialization failed: %s", err)
|
||||
}
|
||||
|
||||
mempool, err := cli.CreateMempool()
|
||||
mempool, err := cli.CreateMempool(cli)
|
||||
if err != nil {
|
||||
return nil, nil, fmt.Errorf("Mempool creation failed: %s", err)
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user