When memory backend selected, no snap sync (#1738)

This commit is contained in:
andri lim 2023-09-08 15:21:59 +07:00 committed by GitHub
parent b0442dc41a
commit cf9553196e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 27 additions and 16 deletions

View File

@ -9,12 +9,19 @@
# except according to those terms.
import
../db/select_backend,
./handlers/eth as handlers_eth,
./handlers/setup as handlers_setup,
./handlers/snap as handlers_snap
./handlers/setup as handlers_setup
export
handlers_eth, handlers_setup, handlers_snap
handlers_eth, handlers_setup
when dbBackend != select_backend.none:
import
./handlers/snap as handlers_snap
export
handlers_snap
static:
type

View File

@ -12,10 +12,10 @@
import
eth/p2p,
../../db/select_backend,
../../core/[chain, tx_pool],
../protocol,
./eth as handlers_eth,
./snap as handlers_snap
./eth as handlers_eth
# ------------------------------------------------------------------------------
# Public functions: convenience mappings for `eth`
@ -47,17 +47,21 @@ proc addEthHandlerCapability*(
# Public functions: convenience mappings for `snap`
# ------------------------------------------------------------------------------
proc addSnapHandlerCapability*(
node: var EthereumNode;
peerPool: PeerPool;
chain = ChainRef(nil);
) =
## Install `snap` handlers,Passing `chein` as `nil` installs the handler
## in minimal/outbound mode.
if chain.isNil:
node.addCapability protocol.snap
else:
node.addCapability(protocol.snap, SnapWireRef.init(chain, peerPool))
when dbBackend != select_backend.none:
import
./snap as handlers_snap
proc addSnapHandlerCapability*(
node: var EthereumNode;
peerPool: PeerPool;
chain = ChainRef(nil);
) =
## Install `snap` handlers,Passing `chein` as `nil` installs the handler
## in minimal/outbound mode.
if chain.isNil:
node.addCapability protocol.snap
else:
node.addCapability(protocol.snap, SnapWireRef.init(chain, peerPool))
# ------------------------------------------------------------------------------
# End