crypto: Remove interface from crypto.Signature

Signatures are now []byte, which saves on the number of bytes after
amino encoding

(squash this) address Ismail's comment
This commit is contained in:
ValarDragon
2018-08-01 17:02:05 -07:00
committed by Ethan Buchman
parent d6a666b445
commit f903947ff3
21 changed files with 69 additions and 182 deletions

View File

@ -38,14 +38,14 @@ func voteToStep(vote *types.Vote) int8 {
// to prevent double signing.
// NOTE: the directory containing the pv.filePath must already exist.
type FilePV struct {
Address types.Address `json:"address"`
PubKey crypto.PubKey `json:"pub_key"`
LastHeight int64 `json:"last_height"`
LastRound int `json:"last_round"`
LastStep int8 `json:"last_step"`
LastSignature crypto.Signature `json:"last_signature,omitempty"` // so we dont lose signatures XXX Why would we lose signatures?
LastSignBytes cmn.HexBytes `json:"last_signbytes,omitempty"` // so we dont lose signatures XXX Why would we lose signatures?
PrivKey crypto.PrivKey `json:"priv_key"`
Address types.Address `json:"address"`
PubKey crypto.PubKey `json:"pub_key"`
LastHeight int64 `json:"last_height"`
LastRound int `json:"last_round"`
LastStep int8 `json:"last_step"`
LastSignature []byte `json:"last_signature,omitempty"` // so we dont lose signatures XXX Why would we lose signatures?
LastSignBytes cmn.HexBytes `json:"last_signbytes,omitempty"` // so we dont lose signatures XXX Why would we lose signatures?
PrivKey crypto.PrivKey `json:"priv_key"`
// For persistence.
// Overloaded for testing.
@ -138,7 +138,7 @@ func (pv *FilePV) save() {
// Reset resets all fields in the FilePV.
// NOTE: Unsafe!
func (pv *FilePV) Reset() {
var sig crypto.Signature
var sig []byte
pv.LastHeight = 0
pv.LastRound = 0
pv.LastStep = 0
@ -277,7 +277,7 @@ func (pv *FilePV) signProposal(chainID string, proposal *types.Proposal) error {
// Persist height/round/step and signature
func (pv *FilePV) saveSigned(height int64, round int, step int8,
signBytes []byte, sig crypto.Signature) {
signBytes []byte, sig []byte) {
pv.LastHeight = height
pv.LastRound = round