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.

26 lines
820 B

9 years ago
9 years ago
9 years ago
  1. package types
  2. import (
  3. "testing"
  4. acm "github.com/tendermint/tendermint/account"
  5. . "github.com/tendermint/tendermint/common"
  6. _ "github.com/tendermint/tendermint/config/tendermint_test"
  7. )
  8. func TestProposalSignable(t *testing.T) {
  9. proposal := &Proposal{
  10. Height: 12345,
  11. Round: 23456,
  12. BlockPartsHeader: PartSetHeader{111, []byte("blockparts")},
  13. POLRound: -1,
  14. }
  15. signBytes := acm.SignBytes(config.GetString("chain_id"), proposal)
  16. signStr := string(signBytes)
  17. expected := Fmt(`{"chain_id":"%s","proposal":{"block_parts_header":{"hash":"626C6F636B7061727473","total":111},"height":12345,"pol_round":-1,"round":23456}}`,
  18. config.GetString("chain_id"))
  19. if signStr != expected {
  20. t.Errorf("Got unexpected sign string for SendTx. Expected:\n%v\nGot:\n%v", expected, signStr)
  21. }
  22. }