lite: Add synchronization in lite verify (#2396)

* Implement issues 2386: add synchronization in lite verify and change all Certify to Verify

* Replace make(chan struct{}, 0) with make(chan struct{})

* Parameterize memroy cache size and add concurrent test

* Refactor import order
This commit is contained in:
HaoyangLiu
2018-09-29 07:23:21 +08:00
committed by Ethan Buchman
parent 5173fe9414
commit 8dda3c3b28
10 changed files with 135 additions and 34 deletions

View File

@@ -30,6 +30,7 @@ var (
nodeAddr string
chainID string
home string
cacheSize int
)
func init() {
@@ -37,6 +38,7 @@ func init() {
LiteCmd.Flags().StringVar(&nodeAddr, "node", "tcp://localhost:26657", "Connect to a Tendermint node at this address")
LiteCmd.Flags().StringVar(&chainID, "chain-id", "tendermint", "Specify the Tendermint chain ID")
LiteCmd.Flags().StringVar(&home, "home-dir", ".tendermint-lite", "Specify the home directory")
LiteCmd.Flags().IntVar(&cacheSize, "cache-size", 10, "Specify the memory trust store cache size")
}
func ensureAddrHasSchemeOrDefaultToTCP(addr string) (string, error) {
@@ -69,7 +71,7 @@ func runProxy(cmd *cobra.Command, args []string) error {
node := rpcclient.NewHTTP(nodeAddr, "/websocket")
logger.Info("Constructing Verifier...")
cert, err := proxy.NewVerifier(chainID, home, node, logger)
cert, err := proxy.NewVerifier(chainID, home, node, logger, cacheSize)
if err != nil {
return cmn.ErrorWrap(err, "constructing Verifier")
}