https://github.com/tendermint/tendermint
Revision df3eee455c9d2a4a9698a35aa0dfe6d5d2efd53d authored by Callum Waters on 04 February 2020, 12:02:20 UTC, committed by GitHub on 04 February 2020, 12:02:20 UTC
Closes issue #4338

Uses a wrapper function around both the signedHeader and validatorSet calls to the primary provider which attempts to retrieve the information 5 times before deeming the provider unavailable and replacing the primary provider with the first alternative before trying recursively again (until all alternatives are depleted)

Employs a mutex lock for any operations involving the providers of the light client to ensure no operations occurs whilst the new primary is chosen.

Commits:

* created swapProvider function

* eliminates old primary provider after replacement. Uses a mutex when changing providers

* renamed to replaceProvider

* created wrapped functions for signed header and val set

* created test for primary provider replacement

* implemented suggested revisions

* created Witnesses() and Primary()

* modified backoffAndJitterTime

* modified backoffAndJitterTime

* changed backoff base and jitter to functional arguments

* implemented suggested changes

* removed backoff function

* changed exp function to match go version

* halved the backoff time

* removed seeding and added comments

* fixed incorrect test

* extract backoff timeout calc into a function

Co-authored-by: Anton Kaliaev <anton.kalyaev@gmail.com>
1 parent 9b9f1be
History
Tip revision: df3eee455c9d2a4a9698a35aa0dfe6d5d2efd53d authored by Callum Waters on 04 February 2020, 12:02:20 UTC
lite2: replace primary provider with alternative when unavailable (#4354)
Tip revision: df3eee4
File Mode Size
proto3
time
block.go -rw-r--r-- 26.8 KB
block_meta.go -rw-r--r-- 1.6 KB
block_meta_test.go -rw-r--r-- 92 bytes
block_test.go -rw-r--r-- 17.7 KB
canonical.go -rw-r--r-- 2.4 KB
codec.go -rw-r--r-- 528 bytes
encoding_helper.go -rw-r--r-- 271 bytes
errors.go -rw-r--r-- 1.0 KB
event_bus.go -rw-r--r-- 8.7 KB
event_bus_test.go -rw-r--r-- 10.8 KB
events.go -rw-r--r-- 5.9 KB
events_test.go -rw-r--r-- 379 bytes
evidence.go -rw-r--r-- 10.4 KB
evidence_test.go -rw-r--r-- 5.9 KB
genesis.go -rw-r--r-- 3.9 KB
genesis_test.go -rw-r--r-- 4.8 KB
keys.go -rw-r--r-- 80 bytes
params.go -rw-r--r-- 6.0 KB
params_test.go -rw-r--r-- 3.5 KB
part_set.go -rw-r--r-- 6.3 KB
part_set_test.go -rw-r--r-- 3.9 KB
priv_validator.go -rw-r--r-- 3.3 KB
proposal.go -rw-r--r-- 2.7 KB
proposal_test.go -rw-r--r-- 3.9 KB
proto3_test.go -rw-r--r-- 2.8 KB
protobuf.go -rw-r--r-- 6.4 KB
protobuf_test.go -rw-r--r-- 5.2 KB
results.go -rw-r--r-- 2.0 KB
results_test.go -rw-r--r-- 1.5 KB
signable.go -rw-r--r-- 713 bytes
signed_msg_type.go -rw-r--r-- 440 bytes
test_util.go -rw-r--r-- 1.8 KB
tx.go -rw-r--r-- 4.2 KB
tx_test.go -rw-r--r-- 4.9 KB
utils.go -rw-r--r-- 762 bytes
validation.go -rw-r--r-- 1.2 KB
validator.go -rw-r--r-- 2.7 KB
validator_set.go -rw-r--r-- 30.0 KB
validator_set_test.go -rw-r--r-- 42.3 KB
vote.go -rw-r--r-- 4.6 KB
vote_set.go -rw-r--r-- 18.0 KB
vote_set_test.go -rw-r--r-- 15.4 KB
vote_test.go -rw-r--r-- 9.0 KB

back to top