diff --git a/lite/commit.go b/lite/commit.go index 814341a0..92253261 100644 --- a/lite/commit.go +++ b/lite/commit.go @@ -52,7 +52,7 @@ func (fc FullCommit) ValidateFull(chainID string) error { return errors.New("need FullCommit.NextValidators") } - // If the commit ValidatorHash doesn't match the block ValidatorHash return an error + // If the commit NextValidatorHash doesn't match the block Next ValidatorHash return an error if !bytes.Equal(fc.SignedHeader.NextValidatorsHash, fc.NextValidators.Hash()) { return fmt.Errorf("header has next vhash %X but next valset hash is %X", fc.SignedHeader.NextValidatorsHash, diff --git a/lite/provider.go b/lite/provider.go index ab94cdc7..52c35107 100644 --- a/lite/provider.go +++ b/lite/provider.go @@ -51,7 +51,7 @@ type UpdatingProvider interface { //---------------------------------------- -type concurrentProvider struct { +type ConcurrentProvider struct { UpdatingProvider // pending map to synchronize concurrent verification requests @@ -71,8 +71,8 @@ type pendingResult struct { err error // cached result. } -func NewConcurrentUpdatingProvider(up UpdatingProvider) concurrentProvider { - return concurrentProvider{ +func NewConcurrentUpdatingProvider(up UpdatingProvider) ConcurrentProvider { + return ConcurrentProvider{ UpdatingProvider: up, pendingVerifications: make(map[pendingKey]*pendingResult), } @@ -84,7 +84,7 @@ func NewConcurrentUpdatingProvider(up UpdatingProvider) concurrentProvider { // The callback must be called, otherwise there will be memory leaks. // Other subsequent calls should just return uniq.err. // NOTE: This is a separate function, primarily to make mtx unlocking more obviously safe via defer. -func (cp concurrentProvider) joinConcurrency(chainID string, height int64) (uniq *pendingResult, isFirstCall bool, callback func(error)) { +func (cp ConcurrentProvider) joinConcurrency(chainID string, height int64) (uniq *pendingResult, isFirstCall bool, callback func(error)) { cp.mtx.Lock() defer cp.mtx.Unlock() @@ -111,7 +111,7 @@ func (cp concurrentProvider) joinConcurrency(chainID string, height int64) (uniq } } -func (cp *concurrentProvider) UpdateToHeight(chainID string, height int64) error { +func (cp *ConcurrentProvider) UpdateToHeight(chainID string, height int64) error { // Performs synchronization for multi-threads verification at the same height. var presult *pendingResult diff --git a/lite/verifying/provider.go b/lite/verifying/provider.go index 48f5e59f..21924692 100644 --- a/lite/verifying/provider.go +++ b/lite/verifying/provider.go @@ -249,7 +249,7 @@ func (vp *Provider) ChainID() string { // Implements UpdatingProvider // // On success, it will store the full commit (SignedHeader + Validators) in vp.trusted -// NOTE: For concurrent usage, use concurrentProvider +// NOTE: For concurrent usage, use ConcurrentProvider func (vp *Provider) UpdateToHeight(chainID string, height int64) error { // If we alreedy have the commit, just return nil