package paychan

import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import coin "github.com/iov-one/weave/coin"
import crypto "github.com/iov-one/weave/crypto"

import io "io"

var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

const _ = proto.GoGoProtoPackageIsVersion2 

type PaymentChannel struct {

	Src []byte `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"`

	SenderPubkey *crypto.PublicKey `protobuf:"bytes,2,opt,name=sender_pubkey,json=senderPubkey" json:"sender_pubkey,omitempty"`

	Recipient []byte `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"`

	Total *coin.Coin `protobuf:"bytes,4,opt,name=total" json:"total,omitempty"`

	Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`

	Memo string `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"`

	Transferred          *coin.Coin `protobuf:"bytes,7,opt,name=transferred" json:"transferred,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (m *PaymentChannel) Reset()         { *m = PaymentChannel{} }
func (m *PaymentChannel) String() string { return proto.CompactTextString(m) }
func (*PaymentChannel) ProtoMessage()    {}
func (*PaymentChannel) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{0}
}
func (m *PaymentChannel) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *PaymentChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_PaymentChannel.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *PaymentChannel) XXX_Merge(src proto.Message) {
	xxx_messageInfo_PaymentChannel.Merge(dst, src)
}
func (m *PaymentChannel) XXX_Size() int {
	return m.Size()
}
func (m *PaymentChannel) XXX_DiscardUnknown() {
	xxx_messageInfo_PaymentChannel.DiscardUnknown(m)
}

var xxx_messageInfo_PaymentChannel proto.InternalMessageInfo

func (m *PaymentChannel) GetSrc() []byte {
	if m != nil {
		return m.Src
	}
	return nil
}

func (m *PaymentChannel) GetSenderPubkey() *crypto.PublicKey {
	if m != nil {
		return m.SenderPubkey
	}
	return nil
}

func (m *PaymentChannel) GetRecipient() []byte {
	if m != nil {
		return m.Recipient
	}
	return nil
}

func (m *PaymentChannel) GetTotal() *coin.Coin {
	if m != nil {
		return m.Total
	}
	return nil
}

func (m *PaymentChannel) GetTimeout() int64 {
	if m != nil {
		return m.Timeout
	}
	return 0
}

func (m *PaymentChannel) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

func (m *PaymentChannel) GetTransferred() *coin.Coin {
	if m != nil {
		return m.Transferred
	}
	return nil
}

type CreatePaymentChannelMsg struct {

	Src []byte `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"`

	SenderPubkey *crypto.PublicKey `protobuf:"bytes,2,opt,name=sender_pubkey,json=senderPubkey" json:"sender_pubkey,omitempty"`

	Recipient []byte `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"`

	Total *coin.Coin `protobuf:"bytes,4,opt,name=total" json:"total,omitempty"`

	Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`

	Memo                 string   `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *CreatePaymentChannelMsg) Reset()         { *m = CreatePaymentChannelMsg{} }
func (m *CreatePaymentChannelMsg) String() string { return proto.CompactTextString(m) }
func (*CreatePaymentChannelMsg) ProtoMessage()    {}
func (*CreatePaymentChannelMsg) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{1}
}
func (m *CreatePaymentChannelMsg) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *CreatePaymentChannelMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_CreatePaymentChannelMsg.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *CreatePaymentChannelMsg) XXX_Merge(src proto.Message) {
	xxx_messageInfo_CreatePaymentChannelMsg.Merge(dst, src)
}
func (m *CreatePaymentChannelMsg) XXX_Size() int {
	return m.Size()
}
func (m *CreatePaymentChannelMsg) XXX_DiscardUnknown() {
	xxx_messageInfo_CreatePaymentChannelMsg.DiscardUnknown(m)
}

var xxx_messageInfo_CreatePaymentChannelMsg proto.InternalMessageInfo

func (m *CreatePaymentChannelMsg) GetSrc() []byte {
	if m != nil {
		return m.Src
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetSenderPubkey() *crypto.PublicKey {
	if m != nil {
		return m.SenderPubkey
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetRecipient() []byte {
	if m != nil {
		return m.Recipient
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetTotal() *coin.Coin {
	if m != nil {
		return m.Total
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetTimeout() int64 {
	if m != nil {
		return m.Timeout
	}
	return 0
}

func (m *CreatePaymentChannelMsg) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

type Payment struct {
	ChainID   string     `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	ChannelID []byte     `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	Amount    *coin.Coin `protobuf:"bytes,3,opt,name=amount" json:"amount,omitempty"`

	Memo                 string   `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Payment) Reset()         { *m = Payment{} }
func (m *Payment) String() string { return proto.CompactTextString(m) }
func (*Payment) ProtoMessage()    {}
func (*Payment) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{2}
}
func (m *Payment) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *Payment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_Payment.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *Payment) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Payment.Merge(dst, src)
}
func (m *Payment) XXX_Size() int {
	return m.Size()
}
func (m *Payment) XXX_DiscardUnknown() {
	xxx_messageInfo_Payment.DiscardUnknown(m)
}

var xxx_messageInfo_Payment proto.InternalMessageInfo

func (m *Payment) GetChainID() string {
	if m != nil {
		return m.ChainID
	}
	return ""
}

func (m *Payment) GetChannelID() []byte {
	if m != nil {
		return m.ChannelID
	}
	return nil
}

func (m *Payment) GetAmount() *coin.Coin {
	if m != nil {
		return m.Amount
	}
	return nil
}

func (m *Payment) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

type TransferPaymentChannelMsg struct {
	Payment              *Payment          `protobuf:"bytes,1,opt,name=payment" json:"payment,omitempty"`
	Signature            *crypto.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (m *TransferPaymentChannelMsg) Reset()         { *m = TransferPaymentChannelMsg{} }
func (m *TransferPaymentChannelMsg) String() string { return proto.CompactTextString(m) }
func (*TransferPaymentChannelMsg) ProtoMessage()    {}
func (*TransferPaymentChannelMsg) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{3}
}
func (m *TransferPaymentChannelMsg) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *TransferPaymentChannelMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_TransferPaymentChannelMsg.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *TransferPaymentChannelMsg) XXX_Merge(src proto.Message) {
	xxx_messageInfo_TransferPaymentChannelMsg.Merge(dst, src)
}
func (m *TransferPaymentChannelMsg) XXX_Size() int {
	return m.Size()
}
func (m *TransferPaymentChannelMsg) XXX_DiscardUnknown() {
	xxx_messageInfo_TransferPaymentChannelMsg.DiscardUnknown(m)
}

var xxx_messageInfo_TransferPaymentChannelMsg proto.InternalMessageInfo

func (m *TransferPaymentChannelMsg) GetPayment() *Payment {
	if m != nil {
		return m.Payment
	}
	return nil
}

func (m *TransferPaymentChannelMsg) GetSignature() *crypto.Signature {
	if m != nil {
		return m.Signature
	}
	return nil
}

type ClosePaymentChannelMsg struct {
	ChannelID []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`

	Memo                 string   `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *ClosePaymentChannelMsg) Reset()         { *m = ClosePaymentChannelMsg{} }
func (m *ClosePaymentChannelMsg) String() string { return proto.CompactTextString(m) }
func (*ClosePaymentChannelMsg) ProtoMessage()    {}
func (*ClosePaymentChannelMsg) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{4}
}
func (m *ClosePaymentChannelMsg) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *ClosePaymentChannelMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_ClosePaymentChannelMsg.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *ClosePaymentChannelMsg) XXX_Merge(src proto.Message) {
	xxx_messageInfo_ClosePaymentChannelMsg.Merge(dst, src)
}
func (m *ClosePaymentChannelMsg) XXX_Size() int {
	return m.Size()
}
func (m *ClosePaymentChannelMsg) XXX_DiscardUnknown() {
	xxx_messageInfo_ClosePaymentChannelMsg.DiscardUnknown(m)
}

var xxx_messageInfo_ClosePaymentChannelMsg proto.InternalMessageInfo

func (m *ClosePaymentChannelMsg) GetChannelID() []byte {
	if m != nil {
		return m.ChannelID
	}
	return nil
}

func (m *ClosePaymentChannelMsg) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

func init() {
	proto.RegisterType((*PaymentChannel)(nil), "paychan.PaymentChannel")
	proto.RegisterType((*CreatePaymentChannelMsg)(nil), "paychan.CreatePaymentChannelMsg")
	proto.RegisterType((*Payment)(nil), "paychan.Payment")
	proto.RegisterType((*TransferPaymentChannelMsg)(nil), "paychan.TransferPaymentChannelMsg")
	proto.RegisterType((*ClosePaymentChannelMsg)(nil), "paychan.ClosePaymentChannelMsg")
}
func (m *PaymentChannel) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *PaymentChannel) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Src) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Src)))
		i += copy(dAtA[i:], m.Src)
	}
	if m.SenderPubkey != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.SenderPubkey.Size()))
		n1, err := m.SenderPubkey.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n1
	}
	if len(m.Recipient) > 0 {
		dAtA[i] = 0x1a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Recipient)))
		i += copy(dAtA[i:], m.Recipient)
	}
	if m.Total != nil {
		dAtA[i] = 0x22
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Total.Size()))
		n2, err := m.Total.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n2
	}
	if m.Timeout != 0 {
		dAtA[i] = 0x28
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Timeout))
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x32
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	if m.Transferred != nil {
		dAtA[i] = 0x3a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Transferred.Size()))
		n3, err := m.Transferred.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n3
	}
	return i, nil
}

func (m *CreatePaymentChannelMsg) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *CreatePaymentChannelMsg) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Src) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Src)))
		i += copy(dAtA[i:], m.Src)
	}
	if m.SenderPubkey != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.SenderPubkey.Size()))
		n4, err := m.SenderPubkey.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n4
	}
	if len(m.Recipient) > 0 {
		dAtA[i] = 0x1a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Recipient)))
		i += copy(dAtA[i:], m.Recipient)
	}
	if m.Total != nil {
		dAtA[i] = 0x22
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Total.Size()))
		n5, err := m.Total.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n5
	}
	if m.Timeout != 0 {
		dAtA[i] = 0x28
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Timeout))
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x32
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	return i, nil
}

func (m *Payment) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *Payment) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.ChainID) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.ChainID)))
		i += copy(dAtA[i:], m.ChainID)
	}
	if len(m.ChannelID) > 0 {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.ChannelID)))
		i += copy(dAtA[i:], m.ChannelID)
	}
	if m.Amount != nil {
		dAtA[i] = 0x1a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Amount.Size()))
		n6, err := m.Amount.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n6
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x22
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	return i, nil
}

func (m *TransferPaymentChannelMsg) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *TransferPaymentChannelMsg) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Payment != nil {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Payment.Size()))
		n7, err := m.Payment.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n7
	}
	if m.Signature != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Signature.Size()))
		n8, err := m.Signature.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n8
	}
	return i, nil
}

func (m *ClosePaymentChannelMsg) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *ClosePaymentChannelMsg) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.ChannelID) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.ChannelID)))
		i += copy(dAtA[i:], m.ChannelID)
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	return i, nil
}

func encodeVarintCodec(dAtA []byte, offset int, v uint64) int {
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return offset + 1
}
func (m *PaymentChannel) Size() (n int) {
	var l int
	_ = l
	l = len(m.Src)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.SenderPubkey != nil {
		l = m.SenderPubkey.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Recipient)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Total != nil {
		l = m.Total.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Timeout != 0 {
		n += 1 + sovCodec(uint64(m.Timeout))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Transferred != nil {
		l = m.Transferred.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *CreatePaymentChannelMsg) Size() (n int) {
	var l int
	_ = l
	l = len(m.Src)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.SenderPubkey != nil {
		l = m.SenderPubkey.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Recipient)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Total != nil {
		l = m.Total.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Timeout != 0 {
		n += 1 + sovCodec(uint64(m.Timeout))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *Payment) Size() (n int) {
	var l int
	_ = l
	l = len(m.ChainID)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.ChannelID)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Amount != nil {
		l = m.Amount.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *TransferPaymentChannelMsg) Size() (n int) {
	var l int
	_ = l
	if m.Payment != nil {
		l = m.Payment.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Signature != nil {
		l = m.Signature.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *ClosePaymentChannelMsg) Size() (n int) {
	var l int
	_ = l
	l = len(m.ChannelID)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func sovCodec(x uint64) (n int) {
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}
func sozCodec(x uint64) (n int) {
	return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *PaymentChannel) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: PaymentChannel: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: PaymentChannel: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Src", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Src = append(m.Src[:0], dAtA[iNdEx:postIndex]...)
			if m.Src == nil {
				m.Src = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SenderPubkey", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.SenderPubkey == nil {
				m.SenderPubkey = &crypto.PublicKey{}
			}
			if err := m.SenderPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Recipient = append(m.Recipient[:0], dAtA[iNdEx:postIndex]...)
			if m.Recipient == nil {
				m.Recipient = []byte{}
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Total == nil {
				m.Total = &coin.Coin{}
			}
			if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 5:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
			}
			m.Timeout = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Timeout |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 6:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 7:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Transferred", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Transferred == nil {
				m.Transferred = &coin.Coin{}
			}
			if err := m.Transferred.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *CreatePaymentChannelMsg) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: CreatePaymentChannelMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: CreatePaymentChannelMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Src", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Src = append(m.Src[:0], dAtA[iNdEx:postIndex]...)
			if m.Src == nil {
				m.Src = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SenderPubkey", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.SenderPubkey == nil {
				m.SenderPubkey = &crypto.PublicKey{}
			}
			if err := m.SenderPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Recipient = append(m.Recipient[:0], dAtA[iNdEx:postIndex]...)
			if m.Recipient == nil {
				m.Recipient = []byte{}
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Total == nil {
				m.Total = &coin.Coin{}
			}
			if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 5:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
			}
			m.Timeout = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Timeout |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 6:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *Payment) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: Payment: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Payment: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ChainID = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ChannelID = append(m.ChannelID[:0], dAtA[iNdEx:postIndex]...)
			if m.ChannelID == nil {
				m.ChannelID = []byte{}
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Amount == nil {
				m.Amount = &coin.Coin{}
			}
			if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *TransferPaymentChannelMsg) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: TransferPaymentChannelMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: TransferPaymentChannelMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Payment", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Payment == nil {
				m.Payment = &Payment{}
			}
			if err := m.Payment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Signature == nil {
				m.Signature = &crypto.Signature{}
			}
			if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *ClosePaymentChannelMsg) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: ClosePaymentChannelMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ClosePaymentChannelMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ChannelID = append(m.ChannelID[:0], dAtA[iNdEx:postIndex]...)
			if m.ChannelID == nil {
				m.ChannelID = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipCodec(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
			return iNdEx, nil
		case 1:
			iNdEx += 8
			return iNdEx, nil
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			iNdEx += length
			if length < 0 {
				return 0, ErrInvalidLengthCodec
			}
			return iNdEx, nil
		case 3:
			for {
				var innerWire uint64
				var start int = iNdEx
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return 0, ErrIntOverflowCodec
					}
					if iNdEx >= l {
						return 0, io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					innerWire |= (uint64(b) & 0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				innerWireType := int(innerWire & 0x7)
				if innerWireType == 4 {
					break
				}
				next, err := skipCodec(dAtA[start:])
				if err != nil {
					return 0, err
				}
				iNdEx = start + next
			}
			return iNdEx, nil
		case 4:
			return iNdEx, nil
		case 5:
			iNdEx += 4
			return iNdEx, nil
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
	}
	panic("unreachable")
}

var (
	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
)

func init() { proto.RegisterFile("x/paychan/codec.proto", fileDescriptor_codec_b27b7a38866d8a21) }

var fileDescriptor_codec_b27b7a38866d8a21 = []byte{

	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 0xc1, 0x6e, 0xd3, 0x40,
	0x10, 0x86, 0xd9, 0x36, 0x8d, 0xf1, 0x24, 0x45, 0x61, 0x25, 0xc0, 0x44, 0x28, 0x8d, 0x72, 0x40,
	0x01, 0xa5, 0xb6, 0x54, 0x24, 0x1e, 0x20, 0xe9, 0x25, 0x42, 0x48, 0x91, 0xe1, 0xc4, 0xa5, 0xda,
	0xac, 0xa7, 0xc9, 0x0a, 0x7b, 0xd7, 0x5a, 0xaf, 0x4b, 0xfd, 0x16, 0xdc, 0x78, 0x25, 0x8e, 0xf0,
	0x02, 0x15, 0x32, 0xef, 0xc0, 0x19, 0x79, 0xed, 0x90, 0x84, 0x82, 0x38, 0x73, 0x9b, 0x99, 0xff,
	0xf7, 0x78, 0xbe, 0x59, 0x0d, 0x3c, 0xb8, 0x0e, 0x52, 0x56, 0xf0, 0x35, 0x93, 0x01, 0x57, 0x11,
	0x72, 0x3f, 0xd5, 0xca, 0x28, 0xea, 0x34, 0xc5, 0xfe, 0xe9, 0x4a, 0x98, 0x75, 0xbe, 0xf4, 0xb9,
	0x4a, 0x82, 0x95, 0x5a, 0xa9, 0xc0, 0xea, 0xcb, 0xfc, 0xd2, 0x66, 0x36, 0xb1, 0x51, 0xfd, 0x5d,
	0xff, 0xd9, 0x8e, 0x5d, 0xa8, 0xab, 0x53, 0x25, 0x31, 0xf8, 0x80, 0xec, 0x0a, 0x03, 0xae, 0xc4,
	0xde, 0x2f, 0xfa, 0x93, 0xbf, 0x5b, 0x75, 0x91, 0x1a, 0x15, 0x24, 0x2a, 0xc2, 0x38, 0xab, 0xdd,
	0xa3, 0x1f, 0x04, 0xee, 0x2d, 0x58, 0x91, 0xa0, 0x34, 0xb3, 0x35, 0x93, 0x12, 0x63, 0xda, 0x83,
	0xc3, 0x4c, 0x73, 0x8f, 0x0c, 0xc9, 0xb8, 0x1b, 0x56, 0x21, 0x7d, 0x09, 0xc7, 0x19, 0xca, 0x08,
	0xf5, 0x45, 0x9a, 0x2f, 0xdf, 0x63, 0xe1, 0x1d, 0x0c, 0xc9, 0xb8, 0x73, 0x76, 0xdf, 0xaf, 0x3b,
	0xfa, 0x8b, 0x7c, 0x19, 0x0b, 0xfe, 0x0a, 0x8b, 0xb0, 0x5b, 0xfb, 0x16, 0xd6, 0x46, 0x9f, 0x80,
	0xab, 0x91, 0x8b, 0x54, 0xa0, 0x34, 0xde, 0xa1, 0xed, 0xb7, 0x2d, 0xd0, 0x21, 0x1c, 0x19, 0x65,
	0x58, 0xec, 0xb5, 0x6c, 0x37, 0xf0, 0x2b, 0x14, 0x7f, 0xa6, 0x84, 0x0c, 0x6b, 0x81, 0x7a, 0xe0,
	0x18, 0x91, 0xa0, 0xca, 0x8d, 0x77, 0x34, 0x24, 0xe3, 0xc3, 0x70, 0x93, 0x52, 0x0a, 0xad, 0x04,
	0x13, 0xe5, 0xb5, 0x87, 0x64, 0xec, 0x86, 0x36, 0xa6, 0x13, 0xe8, 0x18, 0xcd, 0x64, 0x76, 0x89,
	0x5a, 0x63, 0xe4, 0x39, 0xb7, 0xba, 0xee, 0xca, 0xa3, 0xaf, 0x04, 0x1e, 0xcd, 0x34, 0x32, 0x83,
	0xfb, 0xf8, 0xaf, 0xb3, 0xd5, 0xff, 0xba, 0x81, 0xd1, 0x27, 0x02, 0x4e, 0x43, 0x43, 0x9f, 0xc2,
	0x5d, 0xbe, 0x66, 0x42, 0x5e, 0x88, 0xc8, 0x82, 0xb8, 0xd3, 0x4e, 0x79, 0x73, 0xe2, 0xcc, 0xaa,
	0xda, 0xfc, 0x3c, 0x74, 0xac, 0x38, 0x8f, 0xe8, 0x04, 0x80, 0xd7, 0xe4, 0x95, 0xb3, 0xc2, 0xea,
	0x4e, 0x8f, 0xcb, 0x9b, 0x13, 0xb7, 0xd9, 0xc7, 0xfc, 0x3c, 0x74, 0x1b, 0xc3, 0x3c, 0xa2, 0x23,
	0x68, 0xb3, 0x44, 0xe5, 0x0d, 0xcc, 0xfe, 0xc8, 0x8d, 0xf2, 0x6b, 0xb2, 0xd6, 0xce, 0x64, 0xd7,
	0xf0, 0xf8, 0x6d, 0xb3, 0xfc, 0xdb, 0xeb, 0x7e, 0x0e, 0xd5, 0x59, 0x54, 0x45, 0x3b, 0x69, 0xe7,
	0xac, 0xe7, 0x37, 0x67, 0xe2, 0x37, 0xe6, 0x70, 0x63, 0xa0, 0x01, 0xb8, 0x99, 0x58, 0x49, 0x66,
	0x72, 0x8d, 0xbf, 0x3f, 0xc2, 0x9b, 0x8d, 0x10, 0x6e, 0x3d, 0xa3, 0x77, 0xf0, 0x70, 0x16, 0xab,
	0xec, 0x0f, 0xaf, 0xbc, 0x4f, 0x4e, 0xfe, 0x41, 0xbe, 0xa1, 0x3a, 0xd8, 0x52, 0x4d, 0x7b, 0x9f,
	0xcb, 0x01, 0xf9, 0x52, 0x0e, 0xc8, 0xb7, 0x72, 0x40, 0x3e, 0x7e, 0x1f, 0xdc, 0x59, 0xb6, 0xed,
	0x55, 0xbd, 0xf8, 0x19, 0x00, 0x00, 0xff, 0xff, 0x03, 0x7e, 0x70, 0xda, 0xff, 0x03, 0x00, 0x00,
}
// Code generated by protoc-gen-gogo. DO NOT EDIT.
// source: x/paychan/codec.proto

package paychan

import proto "github.com/gogo/protobuf/proto"
import fmt "fmt"
import math "math"
import _ "github.com/gogo/protobuf/gogoproto"
import coin "github.com/iov-one/weave/coin"
import crypto "github.com/iov-one/weave/crypto"

import io "io"

// Reference imports to suppress errors if they are not otherwise used.
var _ = proto.Marshal
var _ = fmt.Errorf
var _ = math.Inf

// This is a compile-time assertion to ensure that this generated file
// is compatible with the proto package it is being compiled against.
// A compilation error at this line likely means your copy of the
// proto package needs to be updated.
const _ = proto.GoGoProtoPackageIsVersion2 // please upgrade the proto package

// PaymentChannel holds the state of a payment channel during its lifetime.
type PaymentChannel struct {
	// Sender is the source that the founds are allocated from (weave.Address).
	Src []byte `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"`
	// Sender public key is a key that must be used to verify signature of
	// transfer message. Sender creates signed transfer messages and gives them
	// to the recipient. Signature prevents from altering transfer message.
	SenderPubkey *crypto.PublicKey `protobuf:"bytes,2,opt,name=sender_pubkey,json=senderPubkey" json:"sender_pubkey,omitempty"`
	// Recipient is the party that receives payments through this channel
	// (weave.Address).
	Recipient []byte `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// Total represents a maximum value that can be transferred via this
	// payment channel.
	Total *coin.Coin `protobuf:"bytes,4,opt,name=total" json:"total,omitempty"`
	// Absolute block height value. If reached, channel can be closed by
	// sender.
	Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// Max length 128 character.
	Memo string `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"`
	// Transferred represents total amount that was transferred using allocated
	// (total) value. Transferred must never exceed total value.
	Transferred          *coin.Coin `protobuf:"bytes,7,opt,name=transferred" json:"transferred,omitempty"`
	XXX_NoUnkeyedLiteral struct{}   `json:"-"`
	XXX_sizecache        int32      `json:"-"`
}

func (m *PaymentChannel) Reset()         { *m = PaymentChannel{} }
func (m *PaymentChannel) String() string { return proto.CompactTextString(m) }
func (*PaymentChannel) ProtoMessage()    {}
func (*PaymentChannel) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{0}
}
func (m *PaymentChannel) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *PaymentChannel) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_PaymentChannel.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *PaymentChannel) XXX_Merge(src proto.Message) {
	xxx_messageInfo_PaymentChannel.Merge(dst, src)
}
func (m *PaymentChannel) XXX_Size() int {
	return m.Size()
}
func (m *PaymentChannel) XXX_DiscardUnknown() {
	xxx_messageInfo_PaymentChannel.DiscardUnknown(m)
}

var xxx_messageInfo_PaymentChannel proto.InternalMessageInfo

func (m *PaymentChannel) GetSrc() []byte {
	if m != nil {
		return m.Src
	}
	return nil
}

func (m *PaymentChannel) GetSenderPubkey() *crypto.PublicKey {
	if m != nil {
		return m.SenderPubkey
	}
	return nil
}

func (m *PaymentChannel) GetRecipient() []byte {
	if m != nil {
		return m.Recipient
	}
	return nil
}

func (m *PaymentChannel) GetTotal() *coin.Coin {
	if m != nil {
		return m.Total
	}
	return nil
}

func (m *PaymentChannel) GetTimeout() int64 {
	if m != nil {
		return m.Timeout
	}
	return 0
}

func (m *PaymentChannel) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

func (m *PaymentChannel) GetTransferred() *coin.Coin {
	if m != nil {
		return m.Transferred
	}
	return nil
}

// CreatePaymentChannelMsg creates a new payment channel that can be used to
// transfer value between two parties.
//
// Total amount will be taken from the senders account and allocated for user
// in the transactions done via created payment channel.
type CreatePaymentChannelMsg struct {
	// Sender address (weave.Address).
	Src []byte `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"`
	// Sender public key is for validating transfer message signature.
	SenderPubkey *crypto.PublicKey `protobuf:"bytes,2,opt,name=sender_pubkey,json=senderPubkey" json:"sender_pubkey,omitempty"`
	// Recipient address  (weave.Address).
	Recipient []byte `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"`
	// Maximum amount that can be transferred via this channel.
	Total *coin.Coin `protobuf:"bytes,4,opt,name=total" json:"total,omitempty"`
	// Absolute block height value. If reached, channel can be closed by
	// anyone.
	Timeout int64 `protobuf:"varint,5,opt,name=timeout,proto3" json:"timeout,omitempty"`
	// Max length 128 character.
	Memo                 string   `protobuf:"bytes,6,opt,name=memo,proto3" json:"memo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *CreatePaymentChannelMsg) Reset()         { *m = CreatePaymentChannelMsg{} }
func (m *CreatePaymentChannelMsg) String() string { return proto.CompactTextString(m) }
func (*CreatePaymentChannelMsg) ProtoMessage()    {}
func (*CreatePaymentChannelMsg) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{1}
}
func (m *CreatePaymentChannelMsg) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *CreatePaymentChannelMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_CreatePaymentChannelMsg.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *CreatePaymentChannelMsg) XXX_Merge(src proto.Message) {
	xxx_messageInfo_CreatePaymentChannelMsg.Merge(dst, src)
}
func (m *CreatePaymentChannelMsg) XXX_Size() int {
	return m.Size()
}
func (m *CreatePaymentChannelMsg) XXX_DiscardUnknown() {
	xxx_messageInfo_CreatePaymentChannelMsg.DiscardUnknown(m)
}

var xxx_messageInfo_CreatePaymentChannelMsg proto.InternalMessageInfo

func (m *CreatePaymentChannelMsg) GetSrc() []byte {
	if m != nil {
		return m.Src
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetSenderPubkey() *crypto.PublicKey {
	if m != nil {
		return m.SenderPubkey
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetRecipient() []byte {
	if m != nil {
		return m.Recipient
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetTotal() *coin.Coin {
	if m != nil {
		return m.Total
	}
	return nil
}

func (m *CreatePaymentChannelMsg) GetTimeout() int64 {
	if m != nil {
		return m.Timeout
	}
	return 0
}

func (m *CreatePaymentChannelMsg) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

// Payment is created by the sender. Sender should give the message to the
// recipient, so that it can be redeemed at any time.
//
// Each Payment should be created with amount greater than the previous one.
type Payment struct {
	ChainID   string     `protobuf:"bytes,1,opt,name=chain_id,json=chainId,proto3" json:"chain_id,omitempty"`
	ChannelID []byte     `protobuf:"bytes,2,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	Amount    *coin.Coin `protobuf:"bytes,3,opt,name=amount" json:"amount,omitempty"`
	// Max length 128 character.
	Memo                 string   `protobuf:"bytes,4,opt,name=memo,proto3" json:"memo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *Payment) Reset()         { *m = Payment{} }
func (m *Payment) String() string { return proto.CompactTextString(m) }
func (*Payment) ProtoMessage()    {}
func (*Payment) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{2}
}
func (m *Payment) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *Payment) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_Payment.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *Payment) XXX_Merge(src proto.Message) {
	xxx_messageInfo_Payment.Merge(dst, src)
}
func (m *Payment) XXX_Size() int {
	return m.Size()
}
func (m *Payment) XXX_DiscardUnknown() {
	xxx_messageInfo_Payment.DiscardUnknown(m)
}

var xxx_messageInfo_Payment proto.InternalMessageInfo

func (m *Payment) GetChainID() string {
	if m != nil {
		return m.ChainID
	}
	return ""
}

func (m *Payment) GetChannelID() []byte {
	if m != nil {
		return m.ChannelID
	}
	return nil
}

func (m *Payment) GetAmount() *coin.Coin {
	if m != nil {
		return m.Amount
	}
	return nil
}

func (m *Payment) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

// TransferPaymentChannelMsg binds Payment with a signature created using
// senders private key.
// Signature is there to ensure that payment message was not altered.
type TransferPaymentChannelMsg struct {
	Payment              *Payment          `protobuf:"bytes,1,opt,name=payment" json:"payment,omitempty"`
	Signature            *crypto.Signature `protobuf:"bytes,2,opt,name=signature" json:"signature,omitempty"`
	XXX_NoUnkeyedLiteral struct{}          `json:"-"`
	XXX_sizecache        int32             `json:"-"`
}

func (m *TransferPaymentChannelMsg) Reset()         { *m = TransferPaymentChannelMsg{} }
func (m *TransferPaymentChannelMsg) String() string { return proto.CompactTextString(m) }
func (*TransferPaymentChannelMsg) ProtoMessage()    {}
func (*TransferPaymentChannelMsg) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{3}
}
func (m *TransferPaymentChannelMsg) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *TransferPaymentChannelMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_TransferPaymentChannelMsg.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *TransferPaymentChannelMsg) XXX_Merge(src proto.Message) {
	xxx_messageInfo_TransferPaymentChannelMsg.Merge(dst, src)
}
func (m *TransferPaymentChannelMsg) XXX_Size() int {
	return m.Size()
}
func (m *TransferPaymentChannelMsg) XXX_DiscardUnknown() {
	xxx_messageInfo_TransferPaymentChannelMsg.DiscardUnknown(m)
}

var xxx_messageInfo_TransferPaymentChannelMsg proto.InternalMessageInfo

func (m *TransferPaymentChannelMsg) GetPayment() *Payment {
	if m != nil {
		return m.Payment
	}
	return nil
}

func (m *TransferPaymentChannelMsg) GetSignature() *crypto.Signature {
	if m != nil {
		return m.Signature
	}
	return nil
}

// ClosePaymentChannelMsg close a payment channel and release remaining founds
// by sending them back to the sender account.
//
// Recipient account can close channel at any moment.
//
// Sender can close channel only if the timeout chain height was reached.
type ClosePaymentChannelMsg struct {
	ChannelID []byte `protobuf:"bytes,1,opt,name=channel_id,json=channelId,proto3" json:"channel_id,omitempty"`
	// Max length 128 character.
	Memo                 string   `protobuf:"bytes,2,opt,name=memo,proto3" json:"memo,omitempty"`
	XXX_NoUnkeyedLiteral struct{} `json:"-"`
	XXX_sizecache        int32    `json:"-"`
}

func (m *ClosePaymentChannelMsg) Reset()         { *m = ClosePaymentChannelMsg{} }
func (m *ClosePaymentChannelMsg) String() string { return proto.CompactTextString(m) }
func (*ClosePaymentChannelMsg) ProtoMessage()    {}
func (*ClosePaymentChannelMsg) Descriptor() ([]byte, []int) {
	return fileDescriptor_codec_b27b7a38866d8a21, []int{4}
}
func (m *ClosePaymentChannelMsg) XXX_Unmarshal(b []byte) error {
	return m.Unmarshal(b)
}
func (m *ClosePaymentChannelMsg) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) {
	if deterministic {
		return xxx_messageInfo_ClosePaymentChannelMsg.Marshal(b, m, deterministic)
	} else {
		b = b[:cap(b)]
		n, err := m.MarshalTo(b)
		if err != nil {
			return nil, err
		}
		return b[:n], nil
	}
}
func (dst *ClosePaymentChannelMsg) XXX_Merge(src proto.Message) {
	xxx_messageInfo_ClosePaymentChannelMsg.Merge(dst, src)
}
func (m *ClosePaymentChannelMsg) XXX_Size() int {
	return m.Size()
}
func (m *ClosePaymentChannelMsg) XXX_DiscardUnknown() {
	xxx_messageInfo_ClosePaymentChannelMsg.DiscardUnknown(m)
}

var xxx_messageInfo_ClosePaymentChannelMsg proto.InternalMessageInfo

func (m *ClosePaymentChannelMsg) GetChannelID() []byte {
	if m != nil {
		return m.ChannelID
	}
	return nil
}

func (m *ClosePaymentChannelMsg) GetMemo() string {
	if m != nil {
		return m.Memo
	}
	return ""
}

func init() {
	proto.RegisterType((*PaymentChannel)(nil), "paychan.PaymentChannel")
	proto.RegisterType((*CreatePaymentChannelMsg)(nil), "paychan.CreatePaymentChannelMsg")
	proto.RegisterType((*Payment)(nil), "paychan.Payment")
	proto.RegisterType((*TransferPaymentChannelMsg)(nil), "paychan.TransferPaymentChannelMsg")
	proto.RegisterType((*ClosePaymentChannelMsg)(nil), "paychan.ClosePaymentChannelMsg")
}
func (m *PaymentChannel) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *PaymentChannel) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Src) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Src)))
		i += copy(dAtA[i:], m.Src)
	}
	if m.SenderPubkey != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.SenderPubkey.Size()))
		n1, err := m.SenderPubkey.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n1
	}
	if len(m.Recipient) > 0 {
		dAtA[i] = 0x1a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Recipient)))
		i += copy(dAtA[i:], m.Recipient)
	}
	if m.Total != nil {
		dAtA[i] = 0x22
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Total.Size()))
		n2, err := m.Total.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n2
	}
	if m.Timeout != 0 {
		dAtA[i] = 0x28
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Timeout))
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x32
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	if m.Transferred != nil {
		dAtA[i] = 0x3a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Transferred.Size()))
		n3, err := m.Transferred.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n3
	}
	return i, nil
}

func (m *CreatePaymentChannelMsg) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *CreatePaymentChannelMsg) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.Src) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Src)))
		i += copy(dAtA[i:], m.Src)
	}
	if m.SenderPubkey != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.SenderPubkey.Size()))
		n4, err := m.SenderPubkey.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n4
	}
	if len(m.Recipient) > 0 {
		dAtA[i] = 0x1a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Recipient)))
		i += copy(dAtA[i:], m.Recipient)
	}
	if m.Total != nil {
		dAtA[i] = 0x22
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Total.Size()))
		n5, err := m.Total.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n5
	}
	if m.Timeout != 0 {
		dAtA[i] = 0x28
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Timeout))
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x32
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	return i, nil
}

func (m *Payment) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *Payment) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.ChainID) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.ChainID)))
		i += copy(dAtA[i:], m.ChainID)
	}
	if len(m.ChannelID) > 0 {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.ChannelID)))
		i += copy(dAtA[i:], m.ChannelID)
	}
	if m.Amount != nil {
		dAtA[i] = 0x1a
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Amount.Size()))
		n6, err := m.Amount.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n6
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x22
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	return i, nil
}

func (m *TransferPaymentChannelMsg) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *TransferPaymentChannelMsg) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if m.Payment != nil {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Payment.Size()))
		n7, err := m.Payment.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n7
	}
	if m.Signature != nil {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(m.Signature.Size()))
		n8, err := m.Signature.MarshalTo(dAtA[i:])
		if err != nil {
			return 0, err
		}
		i += n8
	}
	return i, nil
}

func (m *ClosePaymentChannelMsg) Marshal() (dAtA []byte, err error) {
	size := m.Size()
	dAtA = make([]byte, size)
	n, err := m.MarshalTo(dAtA)
	if err != nil {
		return nil, err
	}
	return dAtA[:n], nil
}

func (m *ClosePaymentChannelMsg) MarshalTo(dAtA []byte) (int, error) {
	var i int
	_ = i
	var l int
	_ = l
	if len(m.ChannelID) > 0 {
		dAtA[i] = 0xa
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.ChannelID)))
		i += copy(dAtA[i:], m.ChannelID)
	}
	if len(m.Memo) > 0 {
		dAtA[i] = 0x12
		i++
		i = encodeVarintCodec(dAtA, i, uint64(len(m.Memo)))
		i += copy(dAtA[i:], m.Memo)
	}
	return i, nil
}

func encodeVarintCodec(dAtA []byte, offset int, v uint64) int {
	for v >= 1<<7 {
		dAtA[offset] = uint8(v&0x7f | 0x80)
		v >>= 7
		offset++
	}
	dAtA[offset] = uint8(v)
	return offset + 1
}
func (m *PaymentChannel) Size() (n int) {
	var l int
	_ = l
	l = len(m.Src)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.SenderPubkey != nil {
		l = m.SenderPubkey.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Recipient)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Total != nil {
		l = m.Total.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Timeout != 0 {
		n += 1 + sovCodec(uint64(m.Timeout))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Transferred != nil {
		l = m.Transferred.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *CreatePaymentChannelMsg) Size() (n int) {
	var l int
	_ = l
	l = len(m.Src)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.SenderPubkey != nil {
		l = m.SenderPubkey.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Recipient)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Total != nil {
		l = m.Total.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Timeout != 0 {
		n += 1 + sovCodec(uint64(m.Timeout))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *Payment) Size() (n int) {
	var l int
	_ = l
	l = len(m.ChainID)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.ChannelID)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Amount != nil {
		l = m.Amount.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *TransferPaymentChannelMsg) Size() (n int) {
	var l int
	_ = l
	if m.Payment != nil {
		l = m.Payment.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	if m.Signature != nil {
		l = m.Signature.Size()
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func (m *ClosePaymentChannelMsg) Size() (n int) {
	var l int
	_ = l
	l = len(m.ChannelID)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	l = len(m.Memo)
	if l > 0 {
		n += 1 + l + sovCodec(uint64(l))
	}
	return n
}

func sovCodec(x uint64) (n int) {
	for {
		n++
		x >>= 7
		if x == 0 {
			break
		}
	}
	return n
}
func sozCodec(x uint64) (n int) {
	return sovCodec(uint64((x << 1) ^ uint64((int64(x) >> 63))))
}
func (m *PaymentChannel) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: PaymentChannel: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: PaymentChannel: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Src", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Src = append(m.Src[:0], dAtA[iNdEx:postIndex]...)
			if m.Src == nil {
				m.Src = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SenderPubkey", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.SenderPubkey == nil {
				m.SenderPubkey = &crypto.PublicKey{}
			}
			if err := m.SenderPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Recipient = append(m.Recipient[:0], dAtA[iNdEx:postIndex]...)
			if m.Recipient == nil {
				m.Recipient = []byte{}
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Total == nil {
				m.Total = &coin.Coin{}
			}
			if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 5:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
			}
			m.Timeout = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Timeout |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 6:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 7:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Transferred", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Transferred == nil {
				m.Transferred = &coin.Coin{}
			}
			if err := m.Transferred.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *CreatePaymentChannelMsg) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: CreatePaymentChannelMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: CreatePaymentChannelMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Src", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Src = append(m.Src[:0], dAtA[iNdEx:postIndex]...)
			if m.Src == nil {
				m.Src = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field SenderPubkey", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.SenderPubkey == nil {
				m.SenderPubkey = &crypto.PublicKey{}
			}
			if err := m.SenderPubkey.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Recipient", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Recipient = append(m.Recipient[:0], dAtA[iNdEx:postIndex]...)
			if m.Recipient == nil {
				m.Recipient = []byte{}
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Total", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Total == nil {
				m.Total = &coin.Coin{}
			}
			if err := m.Total.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 5:
			if wireType != 0 {
				return fmt.Errorf("proto: wrong wireType = %d for field Timeout", wireType)
			}
			m.Timeout = 0
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				m.Timeout |= (int64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
		case 6:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *Payment) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: Payment: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: Payment: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ChainID", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ChainID = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ChannelID = append(m.ChannelID[:0], dAtA[iNdEx:postIndex]...)
			if m.ChannelID == nil {
				m.ChannelID = []byte{}
			}
			iNdEx = postIndex
		case 3:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Amount == nil {
				m.Amount = &coin.Coin{}
			}
			if err := m.Amount.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 4:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *TransferPaymentChannelMsg) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: TransferPaymentChannelMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: TransferPaymentChannelMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Payment", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Payment == nil {
				m.Payment = &Payment{}
			}
			if err := m.Payment.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType)
			}
			var msglen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				msglen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if msglen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + msglen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			if m.Signature == nil {
				m.Signature = &crypto.Signature{}
			}
			if err := m.Signature.Unmarshal(dAtA[iNdEx:postIndex]); err != nil {
				return err
			}
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func (m *ClosePaymentChannelMsg) Unmarshal(dAtA []byte) error {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		preIndex := iNdEx
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		fieldNum := int32(wire >> 3)
		wireType := int(wire & 0x7)
		if wireType == 4 {
			return fmt.Errorf("proto: ClosePaymentChannelMsg: wiretype end group for non-group")
		}
		if fieldNum <= 0 {
			return fmt.Errorf("proto: ClosePaymentChannelMsg: illegal tag %d (wire type %d)", fieldNum, wire)
		}
		switch fieldNum {
		case 1:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field ChannelID", wireType)
			}
			var byteLen int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				byteLen |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			if byteLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + byteLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.ChannelID = append(m.ChannelID[:0], dAtA[iNdEx:postIndex]...)
			if m.ChannelID == nil {
				m.ChannelID = []byte{}
			}
			iNdEx = postIndex
		case 2:
			if wireType != 2 {
				return fmt.Errorf("proto: wrong wireType = %d for field Memo", wireType)
			}
			var stringLen uint64
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				stringLen |= (uint64(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			intStringLen := int(stringLen)
			if intStringLen < 0 {
				return ErrInvalidLengthCodec
			}
			postIndex := iNdEx + intStringLen
			if postIndex > l {
				return io.ErrUnexpectedEOF
			}
			m.Memo = string(dAtA[iNdEx:postIndex])
			iNdEx = postIndex
		default:
			iNdEx = preIndex
			skippy, err := skipCodec(dAtA[iNdEx:])
			if err != nil {
				return err
			}
			if skippy < 0 {
				return ErrInvalidLengthCodec
			}
			if (iNdEx + skippy) > l {
				return io.ErrUnexpectedEOF
			}
			iNdEx += skippy
		}
	}

	if iNdEx > l {
		return io.ErrUnexpectedEOF
	}
	return nil
}
func skipCodec(dAtA []byte) (n int, err error) {
	l := len(dAtA)
	iNdEx := 0
	for iNdEx < l {
		var wire uint64
		for shift := uint(0); ; shift += 7 {
			if shift >= 64 {
				return 0, ErrIntOverflowCodec
			}
			if iNdEx >= l {
				return 0, io.ErrUnexpectedEOF
			}
			b := dAtA[iNdEx]
			iNdEx++
			wire |= (uint64(b) & 0x7F) << shift
			if b < 0x80 {
				break
			}
		}
		wireType := int(wire & 0x7)
		switch wireType {
		case 0:
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				iNdEx++
				if dAtA[iNdEx-1] < 0x80 {
					break
				}
			}
			return iNdEx, nil
		case 1:
			iNdEx += 8
			return iNdEx, nil
		case 2:
			var length int
			for shift := uint(0); ; shift += 7 {
				if shift >= 64 {
					return 0, ErrIntOverflowCodec
				}
				if iNdEx >= l {
					return 0, io.ErrUnexpectedEOF
				}
				b := dAtA[iNdEx]
				iNdEx++
				length |= (int(b) & 0x7F) << shift
				if b < 0x80 {
					break
				}
			}
			iNdEx += length
			if length < 0 {
				return 0, ErrInvalidLengthCodec
			}
			return iNdEx, nil
		case 3:
			for {
				var innerWire uint64
				var start int = iNdEx
				for shift := uint(0); ; shift += 7 {
					if shift >= 64 {
						return 0, ErrIntOverflowCodec
					}
					if iNdEx >= l {
						return 0, io.ErrUnexpectedEOF
					}
					b := dAtA[iNdEx]
					iNdEx++
					innerWire |= (uint64(b) & 0x7F) << shift
					if b < 0x80 {
						break
					}
				}
				innerWireType := int(innerWire & 0x7)
				if innerWireType == 4 {
					break
				}
				next, err := skipCodec(dAtA[start:])
				if err != nil {
					return 0, err
				}
				iNdEx = start + next
			}
			return iNdEx, nil
		case 4:
			return iNdEx, nil
		case 5:
			iNdEx += 4
			return iNdEx, nil
		default:
			return 0, fmt.Errorf("proto: illegal wireType %d", wireType)
		}
	}
	panic("unreachable")
}

var (
	ErrInvalidLengthCodec = fmt.Errorf("proto: negative length found during unmarshaling")
	ErrIntOverflowCodec   = fmt.Errorf("proto: integer overflow")
)

func init() { proto.RegisterFile("x/paychan/codec.proto", fileDescriptor_codec_b27b7a38866d8a21) }

var fileDescriptor_codec_b27b7a38866d8a21 = []byte{
	// 480 bytes of a gzipped FileDescriptorProto
	0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xd4, 0x93, 0xc1, 0x6e, 0xd3, 0x40,
	0x10, 0x86, 0xd9, 0x36, 0x8d, 0xf1, 0x24, 0x45, 0x61, 0x25, 0xc0, 0x44, 0x28, 0x8d, 0x72, 0x40,
	0x01, 0xa5, 0xb6, 0x54, 0x24, 0x1e, 0x20, 0xe9, 0x25, 0x42, 0x48, 0x91, 0xe1, 0xc4, 0xa5, 0xda,
	0xac, 0xa7, 0xc9, 0x0a, 0x7b, 0xd7, 0x5a, 0xaf, 0x4b, 0xfd, 0x16, 0xdc, 0x78, 0x25, 0x8e, 0xf0,
	0x02, 0x15, 0x32, 0xef, 0xc0, 0x19, 0x79, 0xed, 0x90, 0x84, 0x82, 0x38, 0x73, 0x9b, 0x99, 0xff,
	0xf7, 0x78, 0xbe, 0x59, 0x0d, 0x3c, 0xb8, 0x0e, 0x52, 0x56, 0xf0, 0x35, 0x93, 0x01, 0x57, 0x11,
	0x72, 0x3f, 0xd5, 0xca, 0x28, 0xea, 0x34, 0xc5, 0xfe, 0xe9, 0x4a, 0x98, 0x75, 0xbe, 0xf4, 0xb9,
	0x4a, 0x82, 0x95, 0x5a, 0xa9, 0xc0, 0xea, 0xcb, 0xfc, 0xd2, 0x66, 0x36, 0xb1, 0x51, 0xfd, 0x5d,
	0xff, 0xd9, 0x8e, 0x5d, 0xa8, 0xab, 0x53, 0x25, 0x31, 0xf8, 0x80, 0xec, 0x0a, 0x03, 0xae, 0xc4,
	0xde, 0x2f, 0xfa, 0x93, 0xbf, 0x5b, 0x75, 0x91, 0x1a, 0x15, 0x24, 0x2a, 0xc2, 0x38, 0xab, 0xdd,
	0xa3, 0x1f, 0x04, 0xee, 0x2d, 0x58, 0x91, 0xa0, 0x34, 0xb3, 0x35, 0x93, 0x12, 0x63, 0xda, 0x83,
	0xc3, 0x4c, 0x73, 0x8f, 0x0c, 0xc9, 0xb8, 0x1b, 0x56, 0x21, 0x7d, 0x09, 0xc7, 0x19, 0xca, 0x08,
	0xf5, 0x45, 0x9a, 0x2f, 0xdf, 0x63, 0xe1, 0x1d, 0x0c, 0xc9, 0xb8, 0x73, 0x76, 0xdf, 0xaf, 0x3b,
	0xfa, 0x8b, 0x7c, 0x19, 0x0b, 0xfe, 0x0a, 0x8b, 0xb0, 0x5b, 0xfb, 0x16, 0xd6, 0x46, 0x9f, 0x80,
	0xab, 0x91, 0x8b, 0x54, 0xa0, 0x34, 0xde, 0xa1, 0xed, 0xb7, 0x2d, 0xd0, 0x21, 0x1c, 0x19, 0x65,
	0x58, 0xec, 0xb5, 0x6c, 0x37, 0xf0, 0x2b, 0x14, 0x7f, 0xa6, 0x84, 0x0c, 0x6b, 0x81, 0x7a, 0xe0,
	0x18, 0x91, 0xa0, 0xca, 0x8d, 0x77, 0x34, 0x24, 0xe3, 0xc3, 0x70, 0x93, 0x52, 0x0a, 0xad, 0x04,
	0x13, 0xe5, 0xb5, 0x87, 0x64, 0xec, 0x86, 0x36, 0xa6, 0x13, 0xe8, 0x18, 0xcd, 0x64, 0x76, 0x89,
	0x5a, 0x63, 0xe4, 0x39, 0xb7, 0xba, 0xee, 0xca, 0xa3, 0xaf, 0x04, 0x1e, 0xcd, 0x34, 0x32, 0x83,
	0xfb, 0xf8, 0xaf, 0xb3, 0xd5, 0xff, 0xba, 0x81, 0xd1, 0x27, 0x02, 0x4e, 0x43, 0x43, 0x9f, 0xc2,
	0x5d, 0xbe, 0x66, 0x42, 0x5e, 0x88, 0xc8, 0x82, 0xb8, 0xd3, 0x4e, 0x79, 0x73, 0xe2, 0xcc, 0xaa,
	0xda, 0xfc, 0x3c, 0x74, 0xac, 0x38, 0x8f, 0xe8, 0x04, 0x80, 0xd7, 0xe4, 0x95, 0xb3, 0xc2, 0xea,
	0x4e, 0x8f, 0xcb, 0x9b, 0x13, 0xb7, 0xd9, 0xc7, 0xfc, 0x3c, 0x74, 0x1b, 0xc3, 0x3c, 0xa2, 0x23,
	0x68, 0xb3, 0x44, 0xe5, 0x0d, 0xcc, 0xfe, 0xc8, 0x8d, 0xf2, 0x6b, 0xb2, 0xd6, 0xce, 0x64, 0xd7,
	0xf0, 0xf8, 0x6d, 0xb3, 0xfc, 0xdb, 0xeb, 0x7e, 0x0e, 0xd5, 0x59, 0x54, 0x45, 0x3b, 0x69, 0xe7,
	0xac, 0xe7, 0x37, 0x67, 0xe2, 0x37, 0xe6, 0x70, 0x63, 0xa0, 0x01, 0xb8, 0x99, 0x58, 0x49, 0x66,
	0x72, 0x8d, 0xbf, 0x3f, 0xc2, 0x9b, 0x8d, 0x10, 0x6e, 0x3d, 0xa3, 0x77, 0xf0, 0x70, 0x16, 0xab,
	0xec, 0x0f, 0xaf, 0xbc, 0x4f, 0x4e, 0xfe, 0x41, 0xbe, 0xa1, 0x3a, 0xd8, 0x52, 0x4d, 0x7b, 0x9f,
	0xcb, 0x01, 0xf9, 0x52, 0x0e, 0xc8, 0xb7, 0x72, 0x40, 0x3e, 0x7e, 0x1f, 0xdc, 0x59, 0xb6, 0xed,
	0x55, 0xbd, 0xf8, 0x19, 0x00, 0x00, 0xff, 0xff, 0x03, 0x7e, 0x70, 0xda, 0xff, 0x03, 0x00, 0x00,
}
