From fefcbbf3b02537c4881ea1ad6736e62d6865e9cf Mon Sep 17 00:00:00 2001 From: Jae Kwon Date: Tue, 19 Apr 2016 17:21:02 -0700 Subject: [PATCH] Remove unnecessary SetSignature calls --- tests/tmsp/main.go | 4 ++-- types/tx.go | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests/tmsp/main.go b/tests/tmsp/main.go index eee955f77..c857f63c2 100644 --- a/tests/tmsp/main.go +++ b/tests/tmsp/main.go @@ -143,7 +143,7 @@ func testGov() { EntityAddr: adminEntity.Addr, Proposal: proposal, } - proposalTx.SetSignature(nil, adminPrivAcc.Sign(proposalTx.SignBytes())) + proposalTx.Signature = adminPrivAcc.Sign(proposalTx.SignBytes()) tx := &types.AppTx{ Fee: 1, Gas: 1, @@ -156,7 +156,7 @@ func testGov() { }, 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})) if res.IsErr() { Exit(Fmt("Failed to mutate validators: %v", res.Error())) diff --git a/types/tx.go b/types/tx.go index 0e9521a12..e94271b08 100644 --- a/types/tx.go +++ b/types/tx.go @@ -1,6 +1,7 @@ package types import ( + "bytes" "encoding/json" . "github.com/tendermint/go-common" @@ -121,9 +122,9 @@ func (tx *SendTx) SignBytes(chainID string) []byte { 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 { - if input.PubKey.Equals(pubKey) { + if bytes.Equal(input.Address, addr) { tx.Inputs[i].Signature = sig return true } @@ -154,8 +155,7 @@ func (tx *AppTx) SignBytes(chainID string) []byte { return signBytes } -func (tx *AppTx) SetSignature(pubKey crypto.PubKey, sig crypto.Signature) bool { - // TODO +func (tx *AppTx) SetSignature(sig crypto.Signature) bool { tx.Input.Signature = sig return true }