Remove unnecessary SetSignature calls
This commit is contained in:
parent
7676e59944
commit
fefcbbf3b0
|
@ -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()))
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue