Browse Source

types: SignatureEd25519 -> Signature

pull/336/head
Ethan Buchman 8 years ago
parent
commit
38783e7fa1
5 changed files with 13 additions and 14 deletions
  1. +2
    -3
      consensus/byzantine_test.go
  2. +1
    -1
      state/execution_test.go
  3. +2
    -2
      types/priv_validator.go
  4. +7
    -7
      types/vote.go
  5. +1
    -1
      types/vote_set_test.go

+ 2
- 3
consensus/byzantine_test.go View File

@ -9,7 +9,6 @@ import (
. "github.com/tendermint/go-common"
cfg "github.com/tendermint/go-config"
"github.com/tendermint/go-crypto"
"github.com/tendermint/go-events"
"github.com/tendermint/go-p2p"
"github.com/tendermint/tendermint/types"
@ -259,7 +258,7 @@ func (privVal *ByzantinePrivValidator) SignVote(chainID string, vote *types.Vote
defer privVal.mtx.Unlock()
// Sign
vote.Signature = privVal.Sign(types.SignBytes(chainID, vote)).(crypto.SignatureEd25519)
vote.Signature = privVal.Sign(types.SignBytes(chainID, vote))
return nil
}
@ -268,7 +267,7 @@ func (privVal *ByzantinePrivValidator) SignProposal(chainID string, proposal *ty
defer privVal.mtx.Unlock()
// Sign
proposal.Signature = privVal.Sign(types.SignBytes(chainID, proposal)).(crypto.SignatureEd25519)
proposal.Signature = privVal.Sign(types.SignBytes(chainID, proposal))
return nil
}


+ 1
- 1
state/execution_test.go View File

@ -134,7 +134,7 @@ func signCommit(height, round int, hash []byte, header types.PartSetHeader) *typ
}
sig := privKey.Sign(types.SignBytes(chainID, vote))
vote.Signature = sig.(crypto.SignatureEd25519)
vote.Signature = sig
return vote
}


+ 2
- 2
types/priv_validator.go View File

@ -174,7 +174,7 @@ func (privVal *PrivValidator) SignVote(chainID string, vote *Vote) error {
if err != nil {
return errors.New(Fmt("Error signing vote: %v", err))
}
vote.Signature = signature.(crypto.SignatureEd25519)
vote.Signature = signature
return nil
}
@ -185,7 +185,7 @@ func (privVal *PrivValidator) SignProposal(chainID string, proposal *Proposal) e
if err != nil {
return errors.New(Fmt("Error signing proposal: %v", err))
}
proposal.Signature = signature.(crypto.SignatureEd25519)
proposal.Signature = signature
return nil
}


+ 7
- 7
types/vote.go View File

@ -47,13 +47,13 @@ func IsVoteTypeValid(type_ byte) bool {
// Represents a prevote, precommit, or commit vote from validators for consensus.
type Vote struct {
ValidatorAddress []byte `json:"validator_address"`
ValidatorIndex int `json:"validator_index"`
Height int `json:"height"`
Round int `json:"round"`
Type byte `json:"type"`
BlockID BlockID `json:"block_id"` // zero if vote is nil.
Signature crypto.SignatureEd25519 `json:"signature"`
ValidatorAddress []byte `json:"validator_address"`
ValidatorIndex int `json:"validator_index"`
Height int `json:"height"`
Round int `json:"round"`
Type byte `json:"type"`
BlockID BlockID `json:"block_id"` // zero if vote is nil.
Signature crypto.Signature `json:"signature"`
}
func (vote *Vote) WriteSignBytes(chainID string, w io.Writer, n *int, err *error) {


+ 1
- 1
types/vote_set_test.go View File

@ -61,7 +61,7 @@ func withBlockPartsHeader(vote *Vote, blockPartsHeader PartSetHeader) *Vote {
}
func signAddVote(privVal *PrivValidator, vote *Vote, voteSet *VoteSet) (bool, error) {
vote.Signature = privVal.Sign(SignBytes(voteSet.ChainID(), vote)).(crypto.SignatureEd25519)
vote.Signature = privVal.Sign(SignBytes(voteSet.ChainID(), vote))
added, err := voteSet.AddVote(vote)
return added, err
}


Loading…
Cancel
Save