diff --git a/codec/std/tx.go b/codec/std/tx.go index eca3553f30..8305c75177 100644 --- a/codec/std/tx.go +++ b/codec/std/tx.go @@ -122,9 +122,11 @@ func (tx Transaction) GetSignatures() []sdk.Signature { // SetSignatures sets the transaction's signatures. It will overwrite any // existing signatures set. func (tx *Transaction) SetSignatures(sdkSigs ...sdk.Signature) { - sigs := make([]auth.StdSignature, len(tx.Signatures)) + sigs := make([]auth.StdSignature, len(sdkSigs)) for i, sig := range sdkSigs { - sigs[i] = auth.NewStdSignature(sig.GetPubKey(), sig.GetSignature()) + if sig != nil { + sigs[i] = auth.NewStdSignature(sig.GetPubKey(), sig.GetSignature()) + } } tx.Signatures = sigs diff --git a/x/auth/types/stdtx.go b/x/auth/types/stdtx.go index 12e4aecd0b..04e9ec1fdd 100644 --- a/x/auth/types/stdtx.go +++ b/x/auth/types/stdtx.go @@ -59,7 +59,12 @@ func (fee StdFee) GasPrices() sdk.DecCoins { } func NewStdSignature(pk crypto.PubKey, sig []byte) StdSignature { - return StdSignature{PubKey: pk.Bytes(), Signature: sig} + var pkBz []byte + if pk != nil { + pkBz = pk.Bytes() + } + + return StdSignature{PubKey: pkBz, Signature: sig} } // GetSignature returns the raw signature bytes.