@@ -50,6 +50,7 @@ type Configuration struct {
50
50
ProcessInternalTransactions bool `json:"processInternalTransactions"`
51
51
ProcessZeroInternalTransactions bool `json:"processZeroInternalTransactions"`
52
52
ConsensusNodeVersionURL string `json:"consensusNodeVersion"`
53
+ DisableMempoolSync bool `json:"disableMempoolSync,omitempty"`
53
54
}
54
55
55
56
// EthereumRPC is an interface to JSON-RPC eth service.
@@ -174,7 +175,7 @@ func (b *EthereumRPC) Initialize() error {
174
175
func (b * EthereumRPC ) CreateMempool (chain bchain.BlockChain ) (bchain.Mempool , error ) {
175
176
if b .Mempool == nil {
176
177
b .Mempool = bchain .NewMempoolEthereumType (chain , b .ChainConfig .MempoolTxTimeoutHours , b .ChainConfig .QueryBackendOnMempoolResync )
177
- glog .Info ("mempool created, MempoolTxTimeoutHours=" , b .ChainConfig .MempoolTxTimeoutHours , ", QueryBackendOnMempoolResync=" , b .ChainConfig .QueryBackendOnMempoolResync )
178
+ glog .Info ("mempool created, MempoolTxTimeoutHours=" , b .ChainConfig .MempoolTxTimeoutHours , ", QueryBackendOnMempoolResync=" , b .ChainConfig .QueryBackendOnMempoolResync , ", DisableMempoolSync=" , b . ChainConfig . DisableMempoolSync )
178
179
}
179
180
return b .Mempool , nil
180
181
}
@@ -263,21 +264,23 @@ func (b *EthereumRPC) subscribeEvents() error {
263
264
}
264
265
}()
265
266
266
- // new mempool transaction subscription
267
- if err := b .subscribe (func () (bchain.EVMClientSubscription , error ) {
268
- // invalidate the previous subscription - it is either the first one or there was an error
269
- b .newTxSubscription = nil
270
- ctx , cancel := context .WithTimeout (context .Background (), b .Timeout )
271
- defer cancel ()
272
- sub , err := b .RPC .EthSubscribe (ctx , b .NewTx .Channel (), "newPendingTransactions" )
273
- if err != nil {
274
- return nil , errors .Annotatef (err , "EthSubscribe newPendingTransactions" )
267
+ if ! b .ChainConfig .DisableMempoolSync {
268
+ // new mempool transaction subscription
269
+ if err := b .subscribe (func () (bchain.EVMClientSubscription , error ) {
270
+ // invalidate the previous subscription - it is either the first one or there was an error
271
+ b .newTxSubscription = nil
272
+ ctx , cancel := context .WithTimeout (context .Background (), b .Timeout )
273
+ defer cancel ()
274
+ sub , err := b .RPC .EthSubscribe (ctx , b .NewTx .Channel (), "newPendingTransactions" )
275
+ if err != nil {
276
+ return nil , errors .Annotatef (err , "EthSubscribe newPendingTransactions" )
277
+ }
278
+ b .newTxSubscription = sub
279
+ glog .Info ("Subscribed to newPendingTransactions" )
280
+ return sub , nil
281
+ }); err != nil {
282
+ return err
275
283
}
276
- b .newTxSubscription = sub
277
- glog .Info ("Subscribed to newPendingTransactions" )
278
- return sub , nil
279
- }); err != nil {
280
- return err
281
284
}
282
285
283
286
return nil
0 commit comments