Generalize auth/types.StdSignature (#4507)
New Signature interface available in the top level types package. auth.StdSignature implements such interface. User defined auth module can now define their own custom signature types. Work carried out in the context of the following issues: - #4488 - #4487
This commit is contained in:
@@ -6,4 +6,5 @@ import "github.com/cosmos/cosmos-sdk/codec"
|
||||
func RegisterCodec(cdc *codec.Codec) {
|
||||
cdc.RegisterInterface((*Msg)(nil), nil)
|
||||
cdc.RegisterInterface((*Tx)(nil), nil)
|
||||
cdc.RegisterInterface((*Signature)(nil), nil)
|
||||
}
|
||||
|
||||
+2
-1
@@ -4,9 +4,10 @@ import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
"github.com/stretchr/testify/assert"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/cosmos/cosmos-sdk/codec"
|
||||
)
|
||||
|
||||
var (
|
||||
|
||||
@@ -2,6 +2,8 @@ package types
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
|
||||
"github.com/tendermint/tendermint/crypto"
|
||||
)
|
||||
|
||||
// Transactions messages must fulfill the Msg
|
||||
@@ -42,6 +44,12 @@ type Tx interface {
|
||||
|
||||
//__________________________________________________________
|
||||
|
||||
// Signature defines the properties of the signature payload.
|
||||
type Signature interface {
|
||||
GetPubKey() crypto.PubKey
|
||||
GetSignature() []byte
|
||||
}
|
||||
|
||||
// TxDecoder unmarshals transaction bytes
|
||||
type TxDecoder func(txBytes []byte) (Tx, Error)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user