mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-18 22:14:35 +00:00
types.SignBytes -> o.SignBytes
This commit is contained in:
@@ -25,11 +25,11 @@ func TestHeartbeatString(t *testing.T) {
|
||||
require.Contains(t, nilHb.String(), "nil", "expecting a string and no panic")
|
||||
|
||||
hb := &Heartbeat{ValidatorIndex: 1, Height: 11, Round: 2}
|
||||
require.Equal(t, hb.String(), "Heartbeat{1:000000000000 11/02 (0) <nil>}")
|
||||
require.Equal(t, hb.String(), "Heartbeat{1:000000000000 11/02 (0) {<nil>}}")
|
||||
|
||||
var key crypto.PrivKeyEd25519
|
||||
hb.Signature = key.Sign([]byte("Tendermint"))
|
||||
require.Equal(t, hb.String(), "Heartbeat{1:000000000000 11/02 (0) /FF41E371B9BF.../}")
|
||||
require.Equal(t, hb.String(), "Heartbeat{1:000000000000 11/02 (0) {/FF41E371B9BF.../}}")
|
||||
}
|
||||
|
||||
/* TODO WIRE make json work
|
||||
|
||||
@@ -211,7 +211,7 @@ func TestDifferByTimestamp(t *testing.T) {
|
||||
proposal := newProposal(height, round, block1)
|
||||
err := privVal.SignProposal(chainID, proposal)
|
||||
assert.NoError(t, err, "expected no error signing proposal")
|
||||
signBytes := types.SignBytes(chainID, proposal)
|
||||
signBytes := proposal.SignBytes(chainID)
|
||||
sig := proposal.Signature
|
||||
timeStamp := clipToMS(proposal.Timestamp)
|
||||
|
||||
@@ -222,7 +222,7 @@ func TestDifferByTimestamp(t *testing.T) {
|
||||
assert.NoError(t, err, "expected no error on signing same proposal")
|
||||
|
||||
assert.Equal(t, timeStamp, proposal.Timestamp)
|
||||
assert.Equal(t, signBytes, types.SignBytes(chainID, proposal))
|
||||
assert.Equal(t, signBytes, proposal.SignBytes(chainID))
|
||||
assert.Equal(t, sig, proposal.Signature)
|
||||
}
|
||||
|
||||
@@ -237,7 +237,7 @@ func TestDifferByTimestamp(t *testing.T) {
|
||||
err = privVal.SignVote("mychainid", vote)
|
||||
assert.NoError(t, err, "expected no error signing vote")
|
||||
|
||||
signBytes := types.SignBytes(chainID, vote)
|
||||
signBytes := vote.SignBytes(chainID)
|
||||
sig := vote.Signature
|
||||
timeStamp := clipToMS(vote.Timestamp)
|
||||
|
||||
@@ -248,7 +248,7 @@ func TestDifferByTimestamp(t *testing.T) {
|
||||
assert.NoError(t, err, "expected no error on signing same vote")
|
||||
|
||||
assert.Equal(t, timeStamp, vote.Timestamp)
|
||||
assert.Equal(t, signBytes, types.SignBytes(chainID, vote))
|
||||
assert.Equal(t, signBytes, vote.SignBytes(chainID))
|
||||
assert.Equal(t, sig, vote.Signature)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,7 +112,7 @@ func (info *LastSignedInfo) Reset() {
|
||||
// Else it returns an error.
|
||||
func (lsi *LastSignedInfo) SignVote(signer types.Signer, chainID string, vote *types.Vote) error {
|
||||
height, round, step := vote.Height, vote.Round, voteToStep(vote)
|
||||
signBytes := types.SignBytes(chainID, vote)
|
||||
signBytes := vote.SignBytes(chainID)
|
||||
|
||||
sameHRS, err := lsi.Verify(height, round, step)
|
||||
if err != nil {
|
||||
@@ -151,7 +151,7 @@ func (lsi *LastSignedInfo) SignVote(signer types.Signer, chainID string, vote *t
|
||||
// Else it returns an error.
|
||||
func (lsi *LastSignedInfo) SignProposal(signer types.Signer, chainID string, proposal *types.Proposal) error {
|
||||
height, round, step := proposal.Height, proposal.Round, stepPropose
|
||||
signBytes := types.SignBytes(chainID, proposal)
|
||||
signBytes := proposal.SignBytes(chainID)
|
||||
|
||||
sameHRS, err := lsi.Verify(height, round, step)
|
||||
if err != nil {
|
||||
|
||||
@@ -61,6 +61,6 @@ func (upv *PrivValidatorUnencrypted) SignProposal(chainID string, proposal *type
|
||||
|
||||
func (upv *PrivValidatorUnencrypted) SignHeartbeat(chainID string, heartbeat *types.Heartbeat) error {
|
||||
var err error
|
||||
heartbeat.Signature, err = upv.PrivKey.Sign(types.SignBytes(chainID, heartbeat))
|
||||
heartbeat.Signature, err = upv.PrivKey.Sign(heartbeat.SignBytes(chainID))
|
||||
return err
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user