github.com/pokt-network/tendermint@v0.32.11-0.20230426215212-59310158d3e9/lite2/errors.go (about)

     1  package lite
     2  
     3  import (
     4  	"fmt"
     5  	"time"
     6  
     7  	"github.com/tendermint/tendermint/types"
     8  )
     9  
    10  // ErrOldHeaderExpired means the old (trusted) header has expired according to
    11  // the given trustingPeriod and current time. If so, the light client must be
    12  // reset subjectively.
    13  type ErrOldHeaderExpired struct {
    14  	At  time.Time
    15  	Now time.Time
    16  }
    17  
    18  func (e ErrOldHeaderExpired) Error() string {
    19  	return fmt.Sprintf("old header has expired at %v (now: %v)", e.At, e.Now)
    20  }
    21  
    22  // ErrNewValSetCantBeTrusted means the new validator set cannot be trusted
    23  // because < 1/3rd (+trustLevel+) of the old validator set has signed.
    24  type ErrNewValSetCantBeTrusted struct {
    25  	Reason types.ErrNotEnoughVotingPowerSigned
    26  }
    27  
    28  func (e ErrNewValSetCantBeTrusted) Error() string {
    29  	return fmt.Sprintf("cant trust new val set: %v", e.Reason)
    30  }
    31  
    32  // ErrInvalidHeader means the header either failed the basic validation or
    33  // commit is not signed by 2/3+.
    34  type ErrInvalidHeader struct {
    35  	Reason error
    36  }
    37  
    38  func (e ErrInvalidHeader) Error() string {
    39  	return fmt.Sprintf("invalid header: %v", e.Reason)
    40  }
    41  
    42  // errNoWitnesses means that there are not enough witnesses connected to
    43  // continue running the light client.
    44  type errNoWitnesses struct{}
    45  
    46  func (e errNoWitnesses) Error() string {
    47  	return fmt.Sprint("no witnesses connected. please reset light client")
    48  }