Remove unnecessary SetSignature calls

This commit is contained in:
Jae Kwon 2016-04-19 17:21:02 -07:00
parent 7676e59944
commit fefcbbf3b0
2 changed files with 6 additions and 6 deletions

View File

@ -143,7 +143,7 @@ func testGov() {
EntityAddr: adminEntity.Addr, EntityAddr: adminEntity.Addr,
Proposal: proposal, Proposal: proposal,
} }
proposalTx.SetSignature(nil, adminPrivAcc.Sign(proposalTx.SignBytes())) proposalTx.Signature = adminPrivAcc.Sign(proposalTx.SignBytes())
tx := &types.AppTx{ tx := &types.AppTx{
Fee: 1, Fee: 1,
Gas: 1, Gas: 1,
@ -156,7 +156,7 @@ func testGov() {
}, },
Data: wire.BinaryBytes(struct{ govtypes.Tx }{proposalTx}), Data: wire.BinaryBytes(struct{ govtypes.Tx }{proposalTx}),
} }
tx.SetSignature(nil, adminPrivAcc.Sign(tx.SignBytes(chainID))) tx.SetSignature(adminPrivAcc.Sign(tx.SignBytes(chainID)))
res = bcApp.AppendTx(wire.BinaryBytes(struct{ types.Tx }{tx})) res = bcApp.AppendTx(wire.BinaryBytes(struct{ types.Tx }{tx}))
if res.IsErr() { if res.IsErr() {
Exit(Fmt("Failed to mutate validators: %v", res.Error())) Exit(Fmt("Failed to mutate validators: %v", res.Error()))

View File

@ -1,6 +1,7 @@
package types package types
import ( import (
"bytes"
"encoding/json" "encoding/json"
. "github.com/tendermint/go-common" . "github.com/tendermint/go-common"
@ -121,9 +122,9 @@ func (tx *SendTx) SignBytes(chainID string) []byte {
return signBytes return signBytes
} }
func (tx *SendTx) SetSignature(pubKey crypto.PubKey, sig crypto.Signature) bool { func (tx *SendTx) SetSignature(addr []byte, sig crypto.Signature) bool {
for i, input := range tx.Inputs { for i, input := range tx.Inputs {
if input.PubKey.Equals(pubKey) { if bytes.Equal(input.Address, addr) {
tx.Inputs[i].Signature = sig tx.Inputs[i].Signature = sig
return true return true
} }
@ -154,8 +155,7 @@ func (tx *AppTx) SignBytes(chainID string) []byte {
return signBytes return signBytes
} }
func (tx *AppTx) SetSignature(pubKey crypto.PubKey, sig crypto.Signature) bool { func (tx *AppTx) SetSignature(sig crypto.Signature) bool {
// TODO
tx.Input.Signature = sig tx.Input.Signature = sig
return true return true
} }