bsc/les
gary rong b63bffe820
les, p2p/simulations/adapters: fix issues found while simulating les (#21761)
This adds a few tiny fixes for les and the p2p simulation framework:

LES Parts

- Keep the LES-SERVER connection even it's non-synced

  We had this idea to reject the connections in LES protocol if the les-server itself is
  not synced. However, in LES protocol we will also receive the connection from another
  les-server. In this case even the local node is not synced yet, we should keep the tcp
  connection for other protocols(e.g. eth protocol).

- Don't count "invalid message" for non-existing GetBlockHeadersMsg request

  In the eth syncing mechanism (full sync, fast sync, light sync), it will try to fetch
  some non-existent blocks or headers(to ensure we indeed download all the missing chain).
  In this case, it's possible that the les-server will receive the request for
  non-existent headers. So don't count it as the "invalid message" for scheduling
  dropping.

- Copy the announce object in the closure

  Before the les-server pushes the latest headers to all connected clients, it will create
  a closure and queue it in the underlying request scheduler. In some scenarios it's
  problematic. E.g, in private networks, the block can be mined very fast. So before the
  first closure is executed, we may already update the latest_announce object. So actually
  the "announce" object we want to send is replaced.

  The downsize is the client will receive two announces with the same td and then drop the
  server.

P2P Simulation Framework

- Don't double register the protocol services in p2p-simulation "Start".

  The protocols upon the devp2p are registered in the "New node stage". So don't reigster
  them again when starting a node in the p2p simulation framework

- Add one more new config field "ExternalSigner", in order to use clef service in the
  framework.
2020-10-30 18:04:38 +01:00
..
checkpointoracle les: update checktime even if check fails 2020-08-07 10:57:02 +02:00
flowcontrol all: update author list and licenses 2019-07-22 12:17:27 +03:00
lespay les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
utils les, les/lespay/server: refactor client pool (#21236) 2020-09-14 22:44:20 +02:00
api_backend.go node: refactor package node (#21105) 2020-08-03 19:40:46 +02:00
api_test.go les, les/lespay/server: refactor client pool (#21236) 2020-09-14 22:44:20 +02:00
api.go les, les/lespay/server: refactor client pool (#21236) 2020-09-14 22:44:20 +02:00
benchmark.go les, les/lespay/client: add service value statistics and API (#20837) 2020-04-09 11:55:32 +02:00
bloombits.go les: handler separation (#19639) 2019-08-21 11:29:34 +02:00
client_handler.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
client.go node: refactor package node (#21105) 2020-08-03 19:40:46 +02:00
clientpool_test.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
clientpool.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
commons.go node: refactor package node (#21105) 2020-08-03 19:40:46 +02:00
costtracker.go les: add missing Ticker.Stop call (#20864) 2020-04-02 15:54:59 +02:00
distributor_test.go les: separate peer into clientPeer and serverPeer (#19991) 2020-02-26 11:41:24 +02:00
distributor.go les, les/lespay: implement new server pool (#20758) 2020-05-22 13:46:34 +02:00
enr_entry.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
fetcher_test.go les: fix unittest (#21382) 2020-07-29 13:44:14 +03:00
fetcher.go les: implement new les fetcher (#20692) 2020-07-28 18:02:35 +03:00
handler_test.go les: separate peer into clientPeer and serverPeer (#19991) 2020-02-26 11:41:24 +02:00
metrics.go les, les/lespay/server: refactor client pool (#21236) 2020-09-14 22:44:20 +02:00
odr_requests.go core, eth, les, trie: add a prefix to contract code (#21080) 2020-08-21 15:10:40 +03:00
odr_test.go les: implement new les fetcher (#20692) 2020-07-28 18:02:35 +03:00
odr.go les: separate peer into clientPeer and serverPeer (#19991) 2020-02-26 11:41:24 +02:00
peer_test.go les: remove invalid use of t.Fatal in TestHandshake (#21012) 2020-05-01 13:48:52 +02:00
peer.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
protocol.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
pruner_test.go les: historical data garbage collection (#19570) 2020-07-13 11:02:54 +02:00
pruner.go les: historical data garbage collection (#19570) 2020-07-13 11:02:54 +02:00
request_test.go les: historical data garbage collection (#19570) 2020-07-13 11:02:54 +02:00
retrieve.go les, les/lespay: implement new server pool (#20758) 2020-05-22 13:46:34 +02:00
server_handler.go les, p2p/simulations/adapters: fix issues found while simulating les (#21761) 2020-10-30 18:04:38 +01:00
server.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
serverpool_test.go les, les/lespay: implement new server pool (#20758) 2020-05-22 13:46:34 +02:00
serverpool.go p2p/nodestate: ensure correct callback order (#21436) 2020-09-14 14:01:18 +02:00
servingqueue.go les: separate peer into clientPeer and serverPeer (#19991) 2020-02-26 11:41:24 +02:00
sync_test.go les: historical data garbage collection (#19570) 2020-07-13 11:02:54 +02:00
sync.go les: separate peer into clientPeer and serverPeer (#19991) 2020-02-26 11:41:24 +02:00
test_helper.go les: remove clientPeerSet and serverSet (#21566) 2020-10-21 10:56:33 +02:00
txrelay.go all: replace RWMutex with Mutex in places where RLock is not used (#21622) 2020-10-13 10:58:41 +02:00
ulc_test.go les: historical data garbage collection (#19570) 2020-07-13 11:02:54 +02:00
ulc.go cmd, eth, les: fix up ultra light config integration 2019-07-09 20:34:42 +03:00