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.

24 lines
584 B

  1. package types
  2. import (
  3. "bytes"
  4. "io"
  5. cmn "github.com/tendermint/tmlibs/common"
  6. )
  7. // Signable is an interface for all signable things.
  8. // It typically removes signatures before serializing.
  9. type Signable interface {
  10. WriteSignBytes(chainID string, w io.Writer, n *int, err *error)
  11. }
  12. // SignBytes is a convenience method for getting the bytes to sign of a Signable.
  13. func SignBytes(chainID string, o Signable) []byte {
  14. buf, n, err := new(bytes.Buffer), new(int), new(error)
  15. o.WriteSignBytes(chainID, buf, n, err)
  16. if *err != nil {
  17. cmn.PanicCrisis(err)
  18. }
  19. return buf.Bytes()
  20. }