ibc-transfer: split params (#7068)
This commit is contained in:
parent
ce9c2b2a0b
commit
23cabc0786
|
@ -65,8 +65,12 @@ message DenomTrace {
|
|||
// NOTE: To prevent a single token from being transferred, set the TransfersEnabled parameter to
|
||||
// true and then set the bank module's SendEnabled parameter for the denomination to false.
|
||||
message Params {
|
||||
// transfers_enabled enables or disables all cross-chain token transfers from/to this chain.
|
||||
bool transfers_enabled = 1 [
|
||||
(gogoproto.moretags) = "yaml:\"transfers_enabled\""
|
||||
// send_enabled enables or disables all cross-chain token transfers from this chain.
|
||||
bool send_enabled = 1 [
|
||||
(gogoproto.moretags) = "yaml:\"send_enabled\""
|
||||
];
|
||||
// receive_enabled enables or disables all cross-chain token transfers to this chain.
|
||||
bool receive_enabled = 2 [
|
||||
(gogoproto.moretags) = "yaml:\"receive_enabled\""
|
||||
];
|
||||
}
|
||||
|
|
|
@ -5,16 +5,23 @@ import (
|
|||
"github.com/cosmos/cosmos-sdk/x/ibc-transfer/types"
|
||||
)
|
||||
|
||||
// GetTransfersEnabled retrieves the transfers enabled boolean from the paramstore
|
||||
func (k Keeper) GetTransfersEnabled(ctx sdk.Context) bool {
|
||||
// GetSendEnabled retrieves the send enabled boolean from the paramstore
|
||||
func (k Keeper) GetSendEnabled(ctx sdk.Context) bool {
|
||||
var res bool
|
||||
k.paramSpace.Get(ctx, types.KeyTransfersEnabled, &res)
|
||||
k.paramSpace.Get(ctx, types.KeySendEnabled, &res)
|
||||
return res
|
||||
}
|
||||
|
||||
// GetReceiveEnabled retrieves the receive enabled boolean from the paramstore
|
||||
func (k Keeper) GetReceiveEnabled(ctx sdk.Context) bool {
|
||||
var res bool
|
||||
k.paramSpace.Get(ctx, types.KeyReceiveEnabled, &res)
|
||||
return res
|
||||
}
|
||||
|
||||
// GetParams returns the total set of ibc-transfer parameters.
|
||||
func (k Keeper) GetParams(ctx sdk.Context) (params types.Params) {
|
||||
return types.NewParams(k.GetTransfersEnabled(ctx))
|
||||
func (k Keeper) GetParams(ctx sdk.Context) types.Params {
|
||||
return types.NewParams(k.GetSendEnabled(ctx), k.GetReceiveEnabled(ctx))
|
||||
}
|
||||
|
||||
// SetParams sets the total set of ibc-transfer parameters.
|
||||
|
|
|
@ -8,7 +8,7 @@ func (suite *KeeperTestSuite) TestParams() {
|
|||
params := suite.chainA.App.TransferKeeper.GetParams(suite.chainA.GetContext())
|
||||
suite.Require().Equal(expParams, params)
|
||||
|
||||
expParams.TransfersEnabled = false
|
||||
expParams.SendEnabled = false
|
||||
suite.chainA.App.TransferKeeper.SetParams(suite.chainA.GetContext(), expParams)
|
||||
params = suite.chainA.App.TransferKeeper.GetParams(suite.chainA.GetContext())
|
||||
suite.Require().Equal(expParams, params)
|
||||
|
|
|
@ -53,8 +53,8 @@ func (k Keeper) SendTransfer(
|
|||
timeoutTimestamp uint64,
|
||||
) error {
|
||||
|
||||
if !k.GetTransfersEnabled(ctx) {
|
||||
return types.ErrTransfersDisabled
|
||||
if !k.GetSendEnabled(ctx) {
|
||||
return types.ErrSendDisabled
|
||||
}
|
||||
|
||||
sourceChannelEnd, found := k.channelKeeper.GetChannel(ctx, sourcePort, sourceChannel)
|
||||
|
@ -157,8 +157,8 @@ func (k Keeper) OnRecvPacket(ctx sdk.Context, packet channeltypes.Packet, data t
|
|||
return err
|
||||
}
|
||||
|
||||
if !k.GetTransfersEnabled(ctx) {
|
||||
return types.ErrTransfersDisabled
|
||||
if !k.GetReceiveEnabled(ctx) {
|
||||
return types.ErrReceiveDisabled
|
||||
}
|
||||
|
||||
// decode the receiver address
|
||||
|
|
|
@ -6,15 +6,25 @@ order: 6
|
|||
|
||||
The ibc-transfer module contains the following parameters:
|
||||
|
||||
| Key | Type | Default Value |
|
||||
|--------------------|------|---------------|
|
||||
| `TransfersEnabled` | bool | `true` |
|
||||
| Key | Type | Default Value |
|
||||
|------------------|------|---------------|
|
||||
| `SendEnabled` | bool | `true` |
|
||||
| `ReceiveEnabled` | bool | `true` |
|
||||
|
||||
## TransfersEnabled
|
||||
## SendEnabled
|
||||
|
||||
The transfers enabled parameter controls send and receive cross-chain transfer capabilities for all
|
||||
fungible tokens.
|
||||
The transfers enabled parameter controls send cross-chain transfer capabilities for all fungible
|
||||
tokens.
|
||||
|
||||
To prevent a single token from being transferred, set the `TransfersEnabled` parameter to `true` and
|
||||
To prevent a single token from being transferred from the chain, set the `SendEnabled` parameter to `true` and
|
||||
then set the bank module's [`SendEnabled` parameter](./../../bank/spec/05_params.md#sendenabled) for
|
||||
the denomination to `false`.
|
||||
|
||||
## ReceiveEnabled
|
||||
|
||||
The transfers enabled parameter controls receive cross-chain transfer capabilities for all fungible
|
||||
tokens.
|
||||
|
||||
To prevent a single token from being transferred to the chain, set the `ReceiveEnabled` parameter to `true` and
|
||||
then set the bank module's [`SendEnabled` parameter](./../../bank/spec/05_params.md#sendenabled) for
|
||||
the denomination to `false`.
|
||||
|
|
|
@ -11,5 +11,6 @@ var (
|
|||
ErrInvalidVersion = sdkerrors.Register(ModuleName, 4, "invalid ICS20 version")
|
||||
ErrInvalidAmount = sdkerrors.Register(ModuleName, 5, "invalid token amount")
|
||||
ErrTraceNotFound = sdkerrors.Register(ModuleName, 6, "denomination trace not found")
|
||||
ErrTransfersDisabled = sdkerrors.Register(ModuleName, 7, "fungible token transfers to/from this chain are disabled")
|
||||
ErrSendDisabled = sdkerrors.Register(ModuleName, 7, "fungible token transfers from this chain are disabled")
|
||||
ErrReceiveDisabled = sdkerrors.Register(ModuleName, 8, "fungible token transfers to this chain are disabled")
|
||||
)
|
||||
|
|
|
@ -7,12 +7,18 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
// DefaultTransfersEnabled enabled
|
||||
DefaultTransfersEnabled = true
|
||||
// DefaultSendEnabled enabled
|
||||
DefaultSendEnabled = true
|
||||
// DefaultReceiveEnabled enabled
|
||||
DefaultReceiveEnabled = true
|
||||
)
|
||||
|
||||
// KeyTransfersEnabled is store's key for TransfersEnabled Params
|
||||
var KeyTransfersEnabled = []byte("TransfersEnabled")
|
||||
var (
|
||||
// KeySendEnabled is store's key for SendEnabled Params
|
||||
KeySendEnabled = []byte("SendEnabled")
|
||||
// KeyReceiveEnabled is store's key for ReceiveEnabled Params
|
||||
KeyReceiveEnabled = []byte("ReceiveEnabled")
|
||||
)
|
||||
|
||||
// ParamKeyTable type declaration for parameters
|
||||
func ParamKeyTable() paramtypes.KeyTable {
|
||||
|
@ -20,30 +26,36 @@ func ParamKeyTable() paramtypes.KeyTable {
|
|||
}
|
||||
|
||||
// NewParams creates a new parameter configuration for the ibc transfer module
|
||||
func NewParams(enableTransfers bool) Params {
|
||||
func NewParams(enableSend, enableReceive bool) Params {
|
||||
return Params{
|
||||
TransfersEnabled: enableTransfers,
|
||||
SendEnabled: enableSend,
|
||||
ReceiveEnabled: enableReceive,
|
||||
}
|
||||
}
|
||||
|
||||
// DefaultParams is the default parameter configuration for the ibc-transfer module
|
||||
func DefaultParams() Params {
|
||||
return NewParams(DefaultTransfersEnabled)
|
||||
return NewParams(DefaultSendEnabled, DefaultReceiveEnabled)
|
||||
}
|
||||
|
||||
// Validate all ibc-transfer module parameters
|
||||
func (p Params) Validate() error {
|
||||
return validateTransfersEnabled(p.TransfersEnabled)
|
||||
if err := validateEnabled(p.SendEnabled); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
return validateEnabled(p.ReceiveEnabled)
|
||||
}
|
||||
|
||||
// ParamSetPairs implements params.ParamSet
|
||||
func (p *Params) ParamSetPairs() paramtypes.ParamSetPairs {
|
||||
return paramtypes.ParamSetPairs{
|
||||
paramtypes.NewParamSetPair(KeyTransfersEnabled, p.TransfersEnabled, validateTransfersEnabled),
|
||||
paramtypes.NewParamSetPair(KeySendEnabled, p.SendEnabled, validateEnabled),
|
||||
paramtypes.NewParamSetPair(KeyReceiveEnabled, p.ReceiveEnabled, validateEnabled),
|
||||
}
|
||||
}
|
||||
|
||||
func validateTransfersEnabled(i interface{}) error {
|
||||
func validateEnabled(i interface{}) error {
|
||||
_, ok := i.(bool)
|
||||
if !ok {
|
||||
return fmt.Errorf("invalid parameter type: %T", i)
|
||||
|
|
|
@ -7,6 +7,6 @@ import (
|
|||
)
|
||||
|
||||
func TestValidateParams(t *testing.T) {
|
||||
params := DefaultParams()
|
||||
require.NoError(t, params.Validate())
|
||||
require.NoError(t, DefaultParams().Validate())
|
||||
require.NoError(t, NewParams(true, false).Validate())
|
||||
}
|
||||
|
|
|
@ -321,8 +321,10 @@ func (m *DenomTrace) GetBaseDenom() string {
|
|||
// NOTE: To prevent a single token from being transferred, set the TransfersEnabled parameter to
|
||||
// true and then set the bank module's SendEnabled parameter for the denomination to false.
|
||||
type Params struct {
|
||||
// transfers_enabled enables or disables all cross-chain token transfers from/to this chain.
|
||||
TransfersEnabled bool `protobuf:"varint,1,opt,name=transfers_enabled,json=transfersEnabled,proto3" json:"transfers_enabled,omitempty" yaml:"transfers_enabled"`
|
||||
// send_enabled enables or disables all cross-chain token transfers from this chain.
|
||||
SendEnabled bool `protobuf:"varint,1,opt,name=send_enabled,json=sendEnabled,proto3" json:"send_enabled,omitempty" yaml:"send_enabled"`
|
||||
// receive_enabled enables or disables all cross-chain token transfers to this chain.
|
||||
ReceiveEnabled bool `protobuf:"varint,2,opt,name=receive_enabled,json=receiveEnabled,proto3" json:"receive_enabled,omitempty" yaml:"receive_enabled"`
|
||||
}
|
||||
|
||||
func (m *Params) Reset() { *m = Params{} }
|
||||
|
@ -358,9 +360,16 @@ func (m *Params) XXX_DiscardUnknown() {
|
|||
|
||||
var xxx_messageInfo_Params proto.InternalMessageInfo
|
||||
|
||||
func (m *Params) GetTransfersEnabled() bool {
|
||||
func (m *Params) GetSendEnabled() bool {
|
||||
if m != nil {
|
||||
return m.TransfersEnabled
|
||||
return m.SendEnabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
func (m *Params) GetReceiveEnabled() bool {
|
||||
if m != nil {
|
||||
return m.ReceiveEnabled
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
@ -376,43 +385,45 @@ func init() {
|
|||
func init() { proto.RegisterFile("ibc/transfer/transfer.proto", fileDescriptor_08134a70fd29e656) }
|
||||
|
||||
var fileDescriptor_08134a70fd29e656 = []byte{
|
||||
// 569 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x4d, 0x6f, 0xd3, 0x30,
|
||||
0x18, 0x6e, 0x58, 0xd6, 0x6d, 0xde, 0x86, 0xc0, 0x1a, 0x23, 0x1b, 0x90, 0x56, 0x39, 0xf5, 0xb2,
|
||||
0x44, 0x05, 0x21, 0x24, 0x2e, 0xd0, 0x6e, 0x20, 0x26, 0x84, 0x54, 0x85, 0x9e, 0xb8, 0x54, 0x8e,
|
||||
0xf3, 0x92, 0x46, 0x6d, 0xec, 0xca, 0x76, 0x06, 0x13, 0x7f, 0x82, 0xff, 0xc2, 0x9f, 0xd8, 0x71,
|
||||
0x47, 0x4e, 0x15, 0x6a, 0xff, 0x41, 0x8f, 0x9c, 0x90, 0x63, 0xb7, 0xac, 0x68, 0xe2, 0x14, 0x3f,
|
||||
0xcf, 0xfb, 0x91, 0xe7, 0x7d, 0xfc, 0x1a, 0x3d, 0xca, 0x13, 0x1a, 0x29, 0x41, 0x98, 0xfc, 0x0c,
|
||||
0x62, 0x75, 0x08, 0x27, 0x82, 0x2b, 0x8e, 0xf7, 0xf2, 0x84, 0x86, 0x4b, 0xee, 0xf8, 0x20, 0xe3,
|
||||
0x19, 0xaf, 0x02, 0x91, 0x3e, 0x99, 0x9c, 0x63, 0x9f, 0x72, 0x59, 0x70, 0x19, 0x25, 0x44, 0x42,
|
||||
0x74, 0xd1, 0x4e, 0x40, 0x91, 0x76, 0x44, 0x79, 0xce, 0x4c, 0x3c, 0xf8, 0xb1, 0x81, 0x76, 0x3f,
|
||||
0xc8, 0xac, 0x6f, 0xbb, 0xe0, 0x17, 0x68, 0x57, 0xf2, 0x52, 0x50, 0x18, 0x4c, 0xb8, 0x50, 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0xee, 0x2f, 0x33,
|
||||
0xf4, 0x57, 0x2a, 0x52, 0x4c, 0xbc, 0xad, 0xaa, 0xc9, 0xe3, 0xc5, 0xb4, 0xe1, 0xad, 0x37, 0x59,
|
||||
0xa5, 0x04, 0xf1, 0x3d, 0xcb, 0xf5, 0x57, 0xd4, 0x37, 0xf4, 0xf0, 0x6d, 0xc9, 0xb2, 0x3c, 0x19,
|
||||
0x43, 0x5f, 0x9b, 0xd0, 0x23, 0x74, 0x04, 0xea, 0x8c, 0x28, 0x82, 0x0f, 0xd0, 0x66, 0x0a, 0x8c,
|
||||
0x17, 0xe6, 0xea, 0x62, 0x03, 0xf0, 0x21, 0xaa, 0x93, 0x82, 0x97, 0x4c, 0x55, 0xb7, 0xe2, 0xc6,
|
||||
0x16, 0x69, 0xde, 0x9a, 0xb7, 0x51, 0xa5, 0xdf, 0xe6, 0x84, 0xbb, 0xee, 0x44, 0xd0, 0x47, 0xc1,
|
||||
0x2d, 0x3f, 0xef, 0xd0, 0x11, 0xe3, 0x5f, 0xc6, 0x90, 0x66, 0x50, 0x00, 0x53, 0xd8, 0x43, 0x5b,
|
||||
0xb2, 0xa4, 0x14, 0xa4, 0xac, 0x94, 0x6c, 0xc7, 0x4b, 0xa8, 0x15, 0x82, 0x10, 0x5c, 0x98, 0x05,
|
||||
0x89, 0x0d, 0x08, 0x5e, 0x21, 0x74, 0xa6, 0xa5, 0xf6, 0x05, 0xa1, 0x80, 0x31, 0x72, 0x27, 0x44,
|
||||
0x0d, 0xed, 0x10, 0xd5, 0x19, 0x3f, 0x41, 0x48, 0xaf, 0xc2, 0xc0, 0x8c, 0x67, 0x8a, 0x77, 0x34,
|
||||
0x53, 0xd5, 0x05, 0x1f, 0x51, 0xbd, 0x47, 0x04, 0x29, 0x64, 0x65, 0xb4, 0xdd, 0x67, 0x39, 0x00,
|
||||
0x46, 0x92, 0x31, 0xa4, 0x46, 0xc4, 0x9a, 0xd1, 0xff, 0xa6, 0x68, 0xa3, 0x97, 0xdc, 0x1b, 0x43,
|
||||
0x75, 0xdf, 0x5f, 0xcd, 0x7c, 0xe7, 0x7a, 0xe6, 0x3b, 0xbf, 0x66, 0xbe, 0xf3, 0x7d, 0xee, 0xd7,
|
||||
0xae, 0xe7, 0x7e, 0xed, 0xe7, 0xdc, 0xaf, 0x7d, 0x6a, 0xff, 0x77, 0xc5, 0xbe, 0x46, 0x79, 0x42,
|
||||
0x4f, 0xfe, 0x3e, 0x5c, 0xbd, 0x71, 0x49, 0xbd, 0x7a, 0x72, 0xcf, 0xfe, 0x04, 0x00, 0x00, 0xff,
|
||||
0xff, 0x25, 0x11, 0xa0, 0x84, 0xd5, 0x03, 0x00, 0x00,
|
||||
// 601 bytes of a gzipped FileDescriptorProto
|
||||
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x53, 0x41, 0x6f, 0xd3, 0x30,
|
||||
0x14, 0x6e, 0xb6, 0xae, 0xdb, 0xdc, 0x6d, 0x80, 0x19, 0x5b, 0x56, 0x20, 0xa9, 0x72, 0xea, 0x65,
|
||||
0x89, 0x0a, 0x42, 0x48, 0xbb, 0xc0, 0xba, 0x81, 0x98, 0x10, 0xd2, 0x14, 0xf5, 0xc4, 0xa5, 0x72,
|
||||
0x9c, 0x47, 0x1a, 0xb5, 0xb1, 0x2b, 0xdb, 0x1d, 0x4c, 0xfc, 0x02, 0x6e, 0xfc, 0x17, 0xfe, 0xc4,
|
||||
0x8e, 0x3b, 0x72, 0x8a, 0xd0, 0xf6, 0x0f, 0x7a, 0xe4, 0x84, 0x1c, 0x7b, 0x65, 0x45, 0x13, 0xa7,
|
||||
0xf8, 0xfb, 0xde, 0xfb, 0x5e, 0xbe, 0xf7, 0xfc, 0x8c, 0x1e, 0xe7, 0x09, 0x8d, 0x94, 0x20, 0x4c,
|
||||
0x7e, 0x02, 0x31, 0x3f, 0x84, 0x13, 0xc1, 0x15, 0xc7, 0x1b, 0x79, 0x42, 0xc3, 0x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5b, 0xed, 0x0b, 0x42, 0x01, 0x63, 0x54,
|
||||
0x9f, 0x10, 0x35, 0xb4, 0x4d, 0x54, 0x67, 0xfc, 0x14, 0x21, 0xbd, 0x0a, 0x03, 0xd3, 0x9e, 0x11,
|
||||
0xaf, 0x6b, 0xa6, 0xd2, 0x05, 0xdf, 0x1c, 0xd4, 0x38, 0x25, 0x82, 0x14, 0x12, 0x1f, 0xa0, 0x0d,
|
||||
0xdd, 0xc7, 0x00, 0x18, 0x49, 0xc6, 0x90, 0x1a, 0x03, 0xbd, 0xdd, 0x59, 0xe9, 0x3f, 0xb4, 0x9b,
|
||||
0x78, 0x2b, 0x1a, 0xc4, 0x4d, 0x0d, 0xdf, 0x18, 0x84, 0x8f, 0xd0, 0x3d, 0xdb, 0xe9, 0x5c, 0xbe,
|
||||
0x54, 0xc9, 0x5b, 0xb3, 0xd2, 0xdf, 0x31, 0xf2, 0x7f, 0x12, 0x82, 0x78, 0xcb, 0x32, 0xb6, 0x48,
|
||||
0xef, 0xfd, 0xc5, 0x95, 0xe7, 0x5c, 0x5e, 0x79, 0xce, 0xaf, 0x2b, 0xcf, 0xf9, 0x7e, 0xed, 0xd5,
|
||||
0x2e, 0xaf, 0xbd, 0xda, 0xcf, 0x6b, 0xaf, 0xf6, 0xb1, 0xfb, 0xdf, 0xcd, 0xfc, 0x12, 0xe5, 0x09,
|
||||
0xdd, 0xff, 0xfb, 0xde, 0xf5, 0xa2, 0x26, 0x8d, 0xea, 0xa5, 0x3e, 0xff, 0x13, 0x00, 0x00, 0xff,
|
||||
0xff, 0x0a, 0x5a, 0x1c, 0xec, 0x0c, 0x04, 0x00, 0x00,
|
||||
}
|
||||
|
||||
func (m *MsgTransfer) Marshal() (dAtA []byte, err error) {
|
||||
|
@ -632,9 +643,19 @@ func (m *Params) MarshalToSizedBuffer(dAtA []byte) (int, error) {
|
|||
_ = i
|
||||
var l int
|
||||
_ = l
|
||||
if m.TransfersEnabled {
|
||||
if m.ReceiveEnabled {
|
||||
i--
|
||||
if m.TransfersEnabled {
|
||||
if m.ReceiveEnabled {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
}
|
||||
i--
|
||||
dAtA[i] = 0x10
|
||||
}
|
||||
if m.SendEnabled {
|
||||
i--
|
||||
if m.SendEnabled {
|
||||
dAtA[i] = 1
|
||||
} else {
|
||||
dAtA[i] = 0
|
||||
|
@ -752,7 +773,10 @@ func (m *Params) Size() (n int) {
|
|||
}
|
||||
var l int
|
||||
_ = l
|
||||
if m.TransfersEnabled {
|
||||
if m.SendEnabled {
|
||||
n += 2
|
||||
}
|
||||
if m.ReceiveEnabled {
|
||||
n += 2
|
||||
}
|
||||
return n
|
||||
|
@ -1439,7 +1463,7 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
|||
switch fieldNum {
|
||||
case 1:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field TransfersEnabled", wireType)
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field SendEnabled", wireType)
|
||||
}
|
||||
var v int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
|
@ -1456,7 +1480,27 @@ func (m *Params) Unmarshal(dAtA []byte) error {
|
|||
break
|
||||
}
|
||||
}
|
||||
m.TransfersEnabled = bool(v != 0)
|
||||
m.SendEnabled = bool(v != 0)
|
||||
case 2:
|
||||
if wireType != 0 {
|
||||
return fmt.Errorf("proto: wrong wireType = %d for field ReceiveEnabled", wireType)
|
||||
}
|
||||
var v int
|
||||
for shift := uint(0); ; shift += 7 {
|
||||
if shift >= 64 {
|
||||
return ErrIntOverflowTransfer
|
||||
}
|
||||
if iNdEx >= l {
|
||||
return io.ErrUnexpectedEOF
|
||||
}
|
||||
b := dAtA[iNdEx]
|
||||
iNdEx++
|
||||
v |= int(b&0x7F) << shift
|
||||
if b < 0x80 {
|
||||
break
|
||||
}
|
||||
}
|
||||
m.ReceiveEnabled = bool(v != 0)
|
||||
default:
|
||||
iNdEx = preIndex
|
||||
skippy, err := skipTransfer(dAtA[iNdEx:])
|
||||
|
|
Loading…
Reference in New Issue