mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2024-12-22 03:30:37 +00:00
df0699a12b
This adds a simulator object with implements the SentryServer api but takes objects from a pre-existing snapshot file. If the snapshot is not available locally it will download and index the .seg file for the header range being asked for. It is created as follows: ```go sim, err := simulator.NewSentry(ctx, "mumbai", dataDir, 1, logger) ``` Where the arguments are: * ctx - a callable context where cancel will close the simulator torrent and file connections (it also has a Close method) * chain - the name of the chain to take the snapshots from * datadir - a directory potentially containing snapshot .seg files. If not files exist in this directory they will be downloaded * num peers - the number of peers the simulator should create * logger - the loger to log actions to It can be attached to a client as follows: ```go simClient := direct.NewSentryClientDirect(66, sim) ``` At the moment only very basic functionality is implemented: * get headers will return headers by range or hash (hash assumes a pre-downloaded .seg as it needs an index * the header replay semantics need to be confirmed * eth 65 and 66(+) messaging is supported * For details see: `simulator_test.go More advanced peer behavior (e.g. header rewriting) can be added Bodies/Transactions handling can be added |
||
---|---|---|
.. | ||
discover | ||
dnsdisc | ||
enode | ||
enr | ||
nat | ||
netutil | ||
rlpx | ||
sentry | ||
simulations | ||
dial_integration_test.go | ||
dial_test.go | ||
dial.go | ||
message_test.go | ||
message.go | ||
metrics.go | ||
node_key_config.go | ||
peer_error.go | ||
peer_test.go | ||
peer.go | ||
protocol.go | ||
server_test.go | ||
server.go | ||
transport_test.go | ||
transport.go | ||
util_test.go | ||
util.go |