tendermint/types/proposal_test.go

22 lines
622 B
Go
Raw Normal View History

package types
2015-04-27 20:55:28 -07:00
import (
"testing"
)
func TestProposalSignable(t *testing.T) {
proposal := &Proposal{
2015-06-24 14:04:40 -07:00
Height: 12345,
Round: 23456,
BlockPartsHeader: PartSetHeader{111, []byte("blockparts")},
2015-06-24 14:04:40 -07:00
POLRound: -1,
2015-04-27 20:55:28 -07:00
}
2016-05-08 15:00:58 -07:00
signBytes := SignBytes("test_chain_id", proposal)
2015-04-27 20:55:28 -07:00
signStr := string(signBytes)
2015-06-24 14:04:40 -07:00
2016-05-08 15:00:58 -07:00
expected := `{"chain_id":"test_chain_id","proposal":{"block_parts_header":{"hash":"626C6F636B7061727473","total":111},"height":12345,"pol_round":-1,"round":23456}}`
2015-04-27 20:55:28 -07:00
if signStr != expected {
t.Errorf("Got unexpected sign string for SendTx. Expected:\n%v\nGot:\n%v", expected, signStr)
}
}