cwgoes comments
This commit is contained in:
parent
8dd3052017
commit
677559bf6c
|
@ -47,7 +47,7 @@ func (ctx CoreContext) Query(key cmn.HexBytes, storeName string) (res []byte, er
|
|||
}
|
||||
|
||||
// Query from Tendermint with the provided storename and subspace
|
||||
func (ctx CoreContext) QuerySubspace(cdc *wire.Codec, subspace []byte, storeName string) (res []sdk.KV, err error) {
|
||||
func (ctx CoreContext) QuerySubspace(cdc *wire.Codec, subspace []byte, storeName string) (res []sdk.KVPair, err error) {
|
||||
resRaw, err := ctx.query(subspace, storeName, "subspace")
|
||||
if err != nil {
|
||||
return res, err
|
||||
|
|
|
@ -179,10 +179,10 @@ func (st *iavlStore) Query(req abci.RequestQuery) (res abci.ResponseQuery) {
|
|||
case "/subspace":
|
||||
subspace := req.Data
|
||||
res.Key = subspace
|
||||
var KVs []KV
|
||||
var KVs []KVPair
|
||||
iterator := st.SubspaceIterator(subspace)
|
||||
for ; iterator.Valid(); iterator.Next() {
|
||||
KVs = append(KVs, KV{iterator.Key(), iterator.Value()})
|
||||
KVs = append(KVs, KVPair{iterator.Key(), iterator.Value()})
|
||||
}
|
||||
iterator.Close()
|
||||
res.Value = cdc.MustMarshalBinary(KVs)
|
||||
|
|
|
@ -268,12 +268,12 @@ func TestIAVLStoreQuery(t *testing.T) {
|
|||
v3 := []byte("val3")
|
||||
|
||||
ksub := []byte("key")
|
||||
KVs0 := []KV{}
|
||||
KVs1 := []KV{
|
||||
KVs0 := []KVPair{}
|
||||
KVs1 := []KVPair{
|
||||
{k1, v1},
|
||||
{k2, v2},
|
||||
}
|
||||
KVs2 := []KV{
|
||||
KVs2 := []KVPair{
|
||||
{k1, v3},
|
||||
{k2, v2},
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ type MultiStore = types.MultiStore
|
|||
type CacheMultiStore = types.CacheMultiStore
|
||||
type CommitMultiStore = types.CommitMultiStore
|
||||
type KVStore = types.KVStore
|
||||
type KV = types.KV
|
||||
type KVPair = types.KVPair
|
||||
type Iterator = types.Iterator
|
||||
type CacheKVStore = types.CacheKVStore
|
||||
type CommitKVStore = types.CommitKVStore
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
|
||||
abci "github.com/tendermint/abci/types"
|
||||
cmn "github.com/tendermint/tmlibs/common"
|
||||
dbm "github.com/tendermint/tmlibs/db"
|
||||
)
|
||||
|
||||
|
@ -260,6 +261,4 @@ func PrefixEndBytes(prefix []byte) []byte {
|
|||
//----------------------------------------
|
||||
|
||||
// key-value result for iterator queries
|
||||
type KV struct {
|
||||
Key, Value []byte
|
||||
}
|
||||
type KVPair cmn.KVPair
|
||||
|
|
|
@ -20,6 +20,12 @@ const StakingToken = "steak"
|
|||
//Verify interface at compile time
|
||||
var _, _, _, _ sdk.Msg = &MsgDeclareCandidacy{}, &MsgEditCandidacy{}, &MsgDelegate{}, &MsgUnbond{}
|
||||
|
||||
var msgCdc = wire.NewCodec()
|
||||
|
||||
func init() {
|
||||
wire.RegisterCrypto(msgCdc)
|
||||
}
|
||||
|
||||
//______________________________________________________________________
|
||||
|
||||
// MsgDeclareCandidacy - struct for unbonding transactions
|
||||
|
@ -46,9 +52,7 @@ func (msg MsgDeclareCandidacy) GetSigners() []sdk.Address { return []sdk.Address
|
|||
|
||||
// get the bytes for the message signer to sign on
|
||||
func (msg MsgDeclareCandidacy) GetSignBytes() []byte {
|
||||
cdc := wire.NewCodec()
|
||||
wire.RegisterCrypto(cdc)
|
||||
return cdc.MustMarshalBinary(msg)
|
||||
return msgCdc.MustMarshalBinary(msg)
|
||||
}
|
||||
|
||||
// quick validity check
|
||||
|
|
Loading…
Reference in New Issue