You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
802 B

  1. package proxy
  2. import (
  3. "github.com/tendermint/tendermint/lite"
  4. certclient "github.com/tendermint/tendermint/lite/client"
  5. "github.com/tendermint/tendermint/lite/files"
  6. )
  7. func GetCertifier(chainID, rootDir, nodeAddr string) (*lite.Inquiring, error) {
  8. trust := lite.NewCacheProvider(
  9. lite.NewMemStoreProvider(),
  10. files.NewProvider(rootDir),
  11. )
  12. source := certclient.NewHTTPProvider(nodeAddr)
  13. // XXX: total insecure hack to avoid `init`
  14. fc, err := source.LatestCommit()
  15. /* XXX
  16. // this gets the most recent verified commit
  17. fc, err := trust.LatestCommit()
  18. if certerr.IsCommitNotFoundErr(err) {
  19. return nil, errors.New("Please run init first to establish a root of trust")
  20. }*/
  21. if err != nil {
  22. return nil, err
  23. }
  24. cert := lite.NewInquiring(chainID, fc, trust, source)
  25. return cert, nil
  26. }