Zebra/zebra-network/src/peer
Janito Vaqueiro Ferreira Filho ec207cfa95
Ignore unexpected block responses to fix error cascade when synchronizing blocks (#3374)
* Refactor setup of `Connection` test vectors

Add a `new_test_connection` helper function to create a `Connection`
instance that's ready for testing.

* Check that no inbound requests are sent

Return the mock inbound service from `new_test_connection` and assert
that no requests were sent to it in any test.

* Replace `&mut Vec<u8>` with an `mpsc` channel

Make it easier to run the connection task in the background, i.e.,
remove any lifetime constraints from the borrowed buffer so that
`Connection` is `'static`.

It's now also easier to assert on individual messages sent from the
`Connection` instance.

* Make `MockServiceBuilder::finish` public

Allow test functions to be generic when creating a `MockService`, so
that caller functions actually determine if the type of `MockService`
assertions.

* Move `new_test_connection` to parent module

Make it more generic so that it can be used later in property tests as
well.

* Derive `Eq` and `PartialEq` for network `Response`

Allow intercepted `Response` instances to be easily compared in tests.

* Test block request cancel causes an error cascade

This is the scenario that caused the block synchronizer to reset every
few minutes, which made it considerably slower.

* Ignore unexpected block responses

It's likely that it's just a response for a previously cancelled block
request.
2022-01-20 08:14:16 +00:00
..
client Keep track of background peer tasks (#3253) 2021-12-22 01:35:38 +00:00
connection Ignore unexpected block responses to fix error cascade when synchronizing blocks (#3374) 2022-01-20 08:14:16 +00:00
minimum_peer_version Fix syncer download order and add sync tests (#3168) 2022-01-11 14:11:35 -03:00
client.rs Keep track of background peer tasks (#3253) 2021-12-22 01:35:38 +00:00
connection.rs Ignore unexpected block responses to fix error cascade when synchronizing blocks (#3374) 2022-01-20 08:14:16 +00:00
connector.rs T1. Fix isolated connection bugs, improve tests, upgrade dependencies (#3302) 2022-01-14 19:34:59 +00:00
error.rs Cancel heartbeats that are waiting for a peer, rather than hanging Zebra (#3325) 2022-01-12 19:15:07 +00:00
handshake.rs T1. Fix isolated connection bugs, improve tests, upgrade dependencies (#3302) 2022-01-14 19:34:59 +00:00
load_tracked_client.rs Disconnect from outdated peers on network upgrade (#3108) 2021-12-09 02:54:29 +00:00
minimum_peer_version.rs Disconnect from outdated peers on network upgrade (#3108) 2021-12-09 02:54:29 +00:00