Separation of Tx from Msg; CodeType
This commit is contained in:
@@ -30,7 +30,11 @@ func TestSendMsg(t *testing.T) {
|
||||
},
|
||||
}
|
||||
|
||||
// Run a SendMsg.
|
||||
// Run a Check on SendMsg.
|
||||
res := tba.RunCheckMsg(msg)
|
||||
assert.Equal(t, sdk.CodeOK, res.Code, res.Log)
|
||||
|
||||
// Run a Deliver on SendMsg.
|
||||
res = tba.RunDeliverMsg(msg)
|
||||
assert.Equal(t, sdk.CodeUnrecognizedAddress, res.Code, res.Log)
|
||||
}
|
||||
|
||||
@@ -51,10 +51,10 @@ func main() {
|
||||
}
|
||||
|
||||
func DummyHandler(storeKey sdk.StoreKey) sdk.Handler {
|
||||
return func(ctx sdk.Context, tx sdk.Tx) sdk.Result {
|
||||
return func(ctx sdk.Context, msg sdk.Msg) sdk.Result {
|
||||
// tx is already unmarshalled
|
||||
key := tx.Get("key").([]byte)
|
||||
value := tx.Get("value").([]byte)
|
||||
key := msg.Get("key").([]byte)
|
||||
value := msg.Get("value").([]byte)
|
||||
|
||||
store := ctx.KVStore(storeKey)
|
||||
store.Set(key, value)
|
||||
|
||||
@@ -7,6 +7,7 @@ import (
|
||||
crypto "github.com/tendermint/go-crypto"
|
||||
)
|
||||
|
||||
// An sdk.Tx which is its own sdk.Msg.
|
||||
type dummyTx struct {
|
||||
key []byte
|
||||
value []byte
|
||||
@@ -30,6 +31,10 @@ func (tx dummyTx) Type() string {
|
||||
return "dummy"
|
||||
}
|
||||
|
||||
func (tx dummyTx) GetMsg() sdk.Msg {
|
||||
return tx
|
||||
}
|
||||
|
||||
func (tx dummyTx) GetSignBytes() []byte {
|
||||
return tx.bytes
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user