From 3dc82e193506af24571e85a55941cd6eee21b7d1 Mon Sep 17 00:00:00 2001 From: Yilun Date: Fri, 18 Sep 2020 04:02:24 -0700 Subject: [PATCH] Switch from gogo pb to google pb to reduce memory usage on mobile Signed-off-by: Yilun --- Makefile | 2 +- api/common/helper.go | 2 +- api/websocket/server/relay.go | 6 +- api/websocket/server/server.go | 10 +- block/block.go | 8 +- block/header.go | 2 +- chain/blockvalidator.go | 62 +- chain/bvs.go | 38 +- chain/mining.go | 4 +- chain/pool/txpool.go | 14 +- chain/store/stateGenerator.go | 30 +- chain/store/store.go | 22 +- chain/txvalidator/txvalidator.go | 22 +- cmd/nknc/info/pretty.go | 39 +- consensus/config.go | 4 +- consensus/consensus.go | 14 +- consensus/message.go | 38 +- consensus/proposal.go | 22 +- consensus/state.go | 8 +- consensus/vote.go | 4 +- go.mod | 2 +- go.sum | 21 +- node/encryption.go | 2 +- node/info.go | 2 +- node/localnode.go | 6 +- node/message.go | 10 +- node/neighbor.go | 6 +- node/node.go | 4 +- node/relay.go | 18 +- node/remotenode.go | 2 +- node/syncblock.go | 20 +- node/transaction.go | 14 +- pb/block.pb.go | 1521 +------- pb/block.proto | 12 - pb/blockpb_test.go | 461 --- pb/clientmessage.pb.go | 1736 +-------- pb/clientmessage.proto | 13 - pb/clientmessagepb_test.go | 607 --- pb/node.pb.go | 779 +--- pb/node.proto | 13 - pb/nodemessage.pb.go | 6089 +++--------------------------- pb/nodemessage.proto | 12 - pb/nodemessagepb_test.go | 3089 --------------- pb/nodepb_test.go | 169 - pb/sigchain.pb.go | 1358 +------ pb/sigchain.proto | 13 - pb/sigchainpb_test.go | 315 -- pb/transaction.go | 3 +- pb/transaction.pb.go | 4886 ++---------------------- pb/transaction.proto | 13 - pb/transactionpb_test.go | 2213 ----------- por/porpackage.go | 4 +- por/porserver.go | 8 +- por/sigchain.go | 8 +- transaction/payload.go | 89 +- transaction/transaction.go | 26 +- transaction/txBuilder.go | 20 +- 57 files changed, 1401 insertions(+), 22514 deletions(-) delete mode 100644 pb/blockpb_test.go delete mode 100644 pb/clientmessagepb_test.go delete mode 100644 pb/nodemessagepb_test.go delete mode 100644 pb/nodepb_test.go delete mode 100644 pb/sigchainpb_test.go delete mode 100644 pb/transactionpb_test.go diff --git a/Makefile b/Makefile index bc428c80d..a6c550f2a 100644 --- a/Makefile +++ b/Makefile @@ -93,7 +93,7 @@ deepclean: .PHONY: pb pb: - protoc -I=. -I=$(GOPATH)/src -I=$(GOPATH)/src/github.com/gogo/protobuf/protobuf --gogoslick_out=. pb/*.proto + protoc --go_out=. pb/*.proto .PHONY: test test: diff --git a/api/common/helper.go b/api/common/helper.go index 79bbe7558..1274c6264 100644 --- a/api/common/helper.go +++ b/api/common/helper.go @@ -4,7 +4,7 @@ import ( "context" "errors" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/transaction" "github.com/nknorg/nkn/v2/vault" diff --git a/api/websocket/server/relay.go b/api/websocket/server/relay.go index bf443e034..a3b4aec95 100644 --- a/api/websocket/server/relay.go +++ b/api/websocket/server/relay.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/por" "github.com/nknorg/nkn/v2/util/address" @@ -77,7 +77,7 @@ func (ws *WsServer) sendInboundMessage(clientID string, inboundMsg *pb.InboundMe } msg := &pb.ClientMessage{ - MessageType: pb.INBOUND_MESSAGE, + MessageType: pb.ClientMessageType_INBOUND_MESSAGE, Message: buf, } buf, err = proto.Marshal(msg) @@ -178,7 +178,7 @@ func (ws *WsServer) handleReceipt(receipt *pb.Receipt) error { return nil } - destSigChainElem := pb.NewSigChainElem(nil, nil, receipt.Signature, nil, nil, false, pb.SIGNATURE) + destSigChainElem := pb.NewSigChainElem(nil, nil, receipt.Signature, nil, nil, false, pb.SigAlgo_SIGNATURE) por.GetPorServer().AddDestSigChainElem( sci.blockHash, receipt.PrevHash, diff --git a/api/websocket/server/server.go b/api/websocket/server/server.go index 741c3bfa7..3ae7f5eb9 100644 --- a/api/websocket/server/server.go +++ b/api/websocket/server/server.go @@ -16,7 +16,7 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" api "github.com/nknorg/nkn/v2/api/common" "github.com/nknorg/nkn/v2/api/common/errcode" "github.com/nknorg/nkn/v2/api/websocket/messagebuffer" @@ -335,8 +335,8 @@ func (ws *WsServer) OnDataHandle(curSession *session.Session, messageType int, b var r io.Reader = bytes.NewReader(msg.Message) switch msg.CompressionType { - case pb.COMPRESSION_NONE: - case pb.COMPRESSION_ZLIB: + case pb.CompressionType_COMPRESSION_NONE: + case pb.CompressionType_COMPRESSION_ZLIB: r, err = zlib.NewReader(r) if err != nil { return fmt.Errorf("Create zlib reader error: %v", err) @@ -355,14 +355,14 @@ func (ws *WsServer) OnDataHandle(curSession *session.Session, messageType int, b } switch msg.MessageType { - case pb.OUTBOUND_MESSAGE: + case pb.ClientMessageType_OUTBOUND_MESSAGE: outboundMsg := &pb.OutboundMessage{} err = proto.Unmarshal(b, outboundMsg) if err != nil { return fmt.Errorf("Unmarshal outbound message error: %v", err) } ws.sendOutboundRelayMessage(curSession.GetAddrStr(), outboundMsg) - case pb.RECEIPT: + case pb.ClientMessageType_RECEIPT: receipt := &pb.Receipt{} err = proto.Unmarshal(b, receipt) if err != nil { diff --git a/block/block.go b/block/block.go index af993e167..37ddaf7d6 100644 --- a/block/block.go +++ b/block/block.go @@ -7,14 +7,14 @@ import ( "fmt" "io" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/common/serialization" + "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/crypto" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/signature" "github.com/nknorg/nkn/v2/transaction" - "github.com/nknorg/nkn/v2/config" ) type Block struct { @@ -197,7 +197,7 @@ func GenesisBlockInit() (*Block, error) { return nil, fmt.Errorf("parse DonationAddress error: %v", err) } payload := transaction.NewCoinbase(donationProgramhash, rewardAddress, common.Fixed64(0)) - pl, err := transaction.Pack(pb.COINBASE_TYPE, payload) + pl, err := transaction.Pack(pb.PayloadType_COINBASE_TYPE, payload) if err != nil { return nil, err } @@ -257,7 +257,7 @@ func (b *Block) GetInfo() ([]byte, error) { info := &blockInfo{ Header: unmarshaledHeader, Transactions: make([]interface{}, 0), - Size: b.ToMsgBlock().Size(), + Size: proto.Size(b.ToMsgBlock()), Hash: hash.ToHexString(), } diff --git a/block/header.go b/block/header.go index 6984496ca..c3d1d0bce 100644 --- a/block/header.go +++ b/block/header.go @@ -7,7 +7,7 @@ import ( "fmt" "io" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/common/serialization" "github.com/nknorg/nkn/v2/pb" diff --git a/chain/blockvalidator.go b/chain/blockvalidator.go index 0192d9633..d1db95330 100644 --- a/chain/blockvalidator.go +++ b/chain/blockvalidator.go @@ -9,7 +9,7 @@ import ( "hash/fnv" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain/txvalidator" "github.com/nknorg/nkn/v2/common" @@ -76,7 +76,7 @@ func TransactionCheck(ctx context.Context, block *block.Block) error { return errors.New("serialized block is too big") } - if block.Transactions[0].UnsignedTx.Payload.Type != pb.COINBASE_TYPE { + if block.Transactions[0].UnsignedTx.Payload.Type != pb.PayloadType_COINBASE_TYPE { return errors.New("first transaction in block is not Coinbase") } @@ -128,7 +128,7 @@ func TransactionCheck(ctx context.Context, block *block.Block) error { default: } - if i != 0 && txn.UnsignedTx.Payload.Type == pb.COINBASE_TYPE { + if i != 0 && txn.UnsignedTx.Payload.Type == pb.PayloadType_COINBASE_TYPE { return errors.New("Coinbase transaction order is incorrect") } if err := txvalidator.VerifyTransaction(txn, block.Header.UnsignedHeader.Height); err != nil { @@ -144,9 +144,9 @@ func TransactionCheck(ctx context.Context, block *block.Block) error { } switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: - case pb.SIG_CHAIN_TXN_TYPE: - case pb.NANO_PAY_TYPE: + case pb.PayloadType_COINBASE_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: default: addr, err := common.ToCodeHash(txn.Programs[0].Code) if err != nil { @@ -202,7 +202,7 @@ func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.Winn var chordID []byte winnerType := header.UnsignedHeader.WinnerType - if winnerType == pb.GENESIS_SIGNER { + if winnerType == pb.WinnerType_GENESIS_SIGNER { genesisBlockHash, err := DefaultLedger.Store.GetBlockHash(0) if err != nil { return nil, nil, 0, err @@ -218,7 +218,7 @@ func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.Winn return nil, nil, 0, err } - return publicKey, chordID, pb.GENESIS_SIGNER, nil + return publicKey, chordID, pb.WinnerType_GENESIS_SIGNER, nil } if timestamp <= header.UnsignedHeader.Timestamp { @@ -233,7 +233,7 @@ func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.Winn return nil, nil, 0, nil } - winnerType = pb.BLOCK_SIGNER + winnerType = pb.WinnerType_BLOCK_SIGNER proposerBlockHeight := int64(DefaultLedger.Store.GetHeight()) - timeSinceLastBlock/proposerChangeTime if proposerBlockHeight < 0 { @@ -258,14 +258,14 @@ func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.Winn } switch winnerType { - case pb.TXN_SIGNER: + case pb.WinnerType_TXN_SIGNER: whash, _ := common.Uint256ParseFromBytes(header.UnsignedHeader.WinnerHash) txn, err := DefaultLedger.Store.GetTransaction(whash) if err != nil { return nil, nil, 0, err } - if txn.UnsignedTx.Payload.Type != pb.SIG_CHAIN_TXN_TYPE { + if txn.UnsignedTx.Payload.Type != pb.PayloadType_SIG_CHAIN_TXN_TYPE { return nil, nil, 0, errors.New("invalid transaction type") } @@ -281,7 +281,7 @@ func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.Winn if err != nil { return nil, nil, 0, err } - case pb.BLOCK_SIGNER: + case pb.WinnerType_BLOCK_SIGNER: } } @@ -292,19 +292,19 @@ func GetNextBlockSigner(height uint32, timestamp int64) ([]byte, []byte, pb.Winn // sigchain from PoR server. func GetNextMiningSigChainTxnHash(height uint32) (common.Uint256, pb.WinnerType, error) { if height < NumGenesisBlocks { - return common.EmptyUint256, pb.GENESIS_SIGNER, nil + return common.EmptyUint256, pb.WinnerType_GENESIS_SIGNER, nil } nextMiningSigChainTxnHash, err := por.GetPorServer().GetMiningSigChainTxnHash(height + 1) if err != nil { - return common.EmptyUint256, pb.TXN_SIGNER, err + return common.EmptyUint256, pb.WinnerType_TXN_SIGNER, err } if nextMiningSigChainTxnHash == common.EmptyUint256 { - return common.EmptyUint256, pb.BLOCK_SIGNER, nil + return common.EmptyUint256, pb.WinnerType_BLOCK_SIGNER, nil } - return nextMiningSigChainTxnHash, pb.TXN_SIGNER, nil + return nextMiningSigChainTxnHash, pb.WinnerType_TXN_SIGNER, nil } func SignerCheck(header *block.Header) error { @@ -397,8 +397,8 @@ func HeaderCheck(b *block.Block) error { return fmt.Errorf("header timestamp %d is not greater than prev timestamp %d", header.UnsignedHeader.Timestamp, prevHeader.UnsignedHeader.Timestamp) } - if header.UnsignedHeader.WinnerType == pb.GENESIS_SIGNER && header.UnsignedHeader.Height >= NumGenesisBlocks { - return fmt.Errorf("invalid winner type %v for height %d", pb.GENESIS_SIGNER, header.UnsignedHeader.Height) + if header.UnsignedHeader.WinnerType == pb.WinnerType_GENESIS_SIGNER && header.UnsignedHeader.Height >= NumGenesisBlocks { + return fmt.Errorf("invalid winner type %v for height %d", pb.WinnerType_GENESIS_SIGNER, header.UnsignedHeader.Height) } if len(header.UnsignedHeader.RandomBeacon) != config.RandomBeaconLength { @@ -526,8 +526,8 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er } switch txn.UnsignedTx.Payload.Type { - case pb.NANO_PAY_TYPE: - case pb.SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: default: if txn.UnsignedTx.Nonce < DefaultLedger.Store.GetNonce(pg[0]) { return errors.New("nonce is too low") @@ -537,7 +537,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er var amount int64 switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: donationAmount, err := DefaultLedger.Store.GetDonation() if err != nil { return err @@ -548,11 +548,11 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er if amount < donationAmount { return errors.New("not sufficient funds in doation account") } - case pb.TRANSFER_ASSET_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: pld := payload.(*pb.TransferAsset) amount += pld.Amount - case pb.SIG_CHAIN_TXN_TYPE: - case pb.REGISTER_NAME_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: pld := payload.(*pb.RegisterName) if config.LegacyNameService.GetValueAtHeight(height) { name, err := DefaultLedger.Store.GetName_legacy(pld.Registrant) @@ -580,7 +580,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er } amount += pld.RegistrationFee } - case pb.TRANSFER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: pld := payload.(*pb.TransferName) registrant, _, err := DefaultLedger.Store.GetRegistrant(pld.Name) @@ -604,7 +604,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er return fmt.Errorf("can not transfer names which did not belongs to you") } - case pb.DELETE_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: pld := payload.(*pb.DeleteName) if config.LegacyNameService.GetValueAtHeight(height) { name, err := DefaultLedger.Store.GetName_legacy(pld.Registrant) @@ -629,7 +629,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er } } - case pb.SUBSCRIBE_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: pld := payload.(*pb.Subscribe) subscribed, err := DefaultLedger.Store.IsSubscribed(pld.Topic, pld.Bucket, pld.Subscriber, pld.Identifier) if err != nil { @@ -642,7 +642,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er return fmt.Errorf("subscription count to %s can't be more than %d", pld.Topic, maxSubscriptionCount) } } - case pb.UNSUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: pld := payload.(*pb.Unsubscribe) subscribed, err := DefaultLedger.Store.IsSubscribed(pld.Topic, 0, pld.Subscriber, pld.Identifier) if err != nil { @@ -651,7 +651,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er if !subscribed { return fmt.Errorf("subscription to %s doesn't exist", pld.Topic) } - case pb.GENERATE_ID_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: pld := payload.(*pb.GenerateID) id, err := DefaultLedger.Store.GetID(pld.PublicKey) if err != nil { @@ -661,7 +661,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er return ErrIDRegistered } amount += pld.RegistrationFee - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: pld := payload.(*pb.NanoPay) channelBalance, _, err := DefaultLedger.Store.GetNanoPay( @@ -685,7 +685,7 @@ func VerifyTransactionWithLedger(txn *transaction.Transaction, height uint32) er return errors.New("invalid amount") } amount += balanceToClaim - case pb.ISSUE_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: assetID := txn.Hash() _, _, _, _, err := DefaultLedger.Store.GetAsset(assetID) if err == nil { diff --git a/chain/bvs.go b/chain/bvs.go index 7f0bb490d..283fbe37b 100644 --- a/chain/bvs.go +++ b/chain/bvs.go @@ -151,7 +151,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra fee := common.Fixed64(txn.UnsignedTx.Fee) switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: coinbase := payload.(*pb.Coinbase) donationAmount, err := DefaultLedger.Store.GetDonation() if err != nil { @@ -160,10 +160,10 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra if common.Fixed64(coinbase.Amount) != GetRewardByHeight(height)+donationAmount { return errors.New("mining reward incorrectly") } - case pb.TRANSFER_ASSET_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: transfer := payload.(*pb.TransferAsset) amount = common.Fixed64(transfer.Amount) - case pb.REGISTER_NAME_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: namePayload := payload.(*pb.RegisterName) name := namePayload.Name @@ -187,7 +187,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra }) } }() - case pb.TRANSFER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: namePayload := payload.(*pb.TransferName) name := namePayload.Name @@ -198,7 +198,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra }) } }() - case pb.DELETE_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: namePayload := payload.(*pb.DeleteName) name := namePayload.Name @@ -221,7 +221,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra }) } }() - case pb.SUBSCRIBE_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: subscribePayload := payload.(*pb.Subscribe) topic := subscribePayload.Topic bucket := subscribePayload.Bucket @@ -251,7 +251,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra }) } }() - case pb.UNSUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: unsubscribePayload := payload.(*pb.Unsubscribe) topic := unsubscribePayload.Topic key := subscription{topic, 0, string(unsubscribePayload.Subscriber), unsubscribePayload.Identifier} @@ -275,7 +275,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra }) } }() - case pb.GENERATE_ID_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: generateIDPayload := payload.(*pb.GenerateID) amount = common.Fixed64(generateIDPayload.RegistrationFee) publicKey := hex.EncodeToString(generateIDPayload.PublicKey) @@ -290,7 +290,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra }) } }() - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: npPayload := payload.(*pb.NanoPay) if height > npPayload.TxnExpiration { return errors.New("[VerifyTransactionWithBlock] nano pay txn has expired") @@ -327,7 +327,7 @@ func (bvs *BlockValidationState) VerifyTransactionWithBlock(txn *transaction.Tra } }() - case pb.ISSUE_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: } if amount+npAmount+fee > 0 { @@ -371,10 +371,10 @@ func (bvs *BlockValidationState) CleanSubmittedTransactions(txns []*transaction. fee := common.Fixed64(txn.UnsignedTx.Fee) switch txn.UnsignedTx.Payload.Type { - case pb.TRANSFER_ASSET_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: transfer := payload.(*pb.TransferAsset) amount = common.Fixed64(transfer.Amount) - case pb.REGISTER_NAME_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: namePayload := payload.(*pb.RegisterName) amount = common.Fixed64(namePayload.RegistrationFee) @@ -383,11 +383,11 @@ func (bvs *BlockValidationState) CleanSubmittedTransactions(txns []*transaction. registrant := hex.EncodeToString(namePayload.Registrant) delete(bvs.nameRegistrants, registrant) - case pb.TRANSFER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: namePayload := payload.(*pb.TransferName) name := namePayload.Name delete(bvs.registeredNames, name) - case pb.DELETE_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: namePayload := payload.(*pb.DeleteName) name := namePayload.Name @@ -395,7 +395,7 @@ func (bvs *BlockValidationState) CleanSubmittedTransactions(txns []*transaction. registrant := hex.EncodeToString(namePayload.Registrant) delete(bvs.nameRegistrants, registrant) - case pb.SUBSCRIBE_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: subscribePayload := payload.(*pb.Subscribe) topic := subscribePayload.Topic bucket := subscribePayload.Bucket @@ -411,7 +411,7 @@ func (bvs *BlockValidationState) CleanSubmittedTransactions(txns []*transaction. } } } - case pb.UNSUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: unsubscribePayload := payload.(*pb.Unsubscribe) topic := unsubscribePayload.Topic key := subscription{topic, 0, string(unsubscribePayload.Subscriber), unsubscribePayload.Identifier} @@ -420,17 +420,17 @@ func (bvs *BlockValidationState) CleanSubmittedTransactions(txns []*transaction. bvs.subscriptionCount[topic]++ } - case pb.GENERATE_ID_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: generateIDPayload := payload.(*pb.GenerateID) amount = common.Fixed64(generateIDPayload.RegistrationFee) publicKey := hex.EncodeToString(generateIDPayload.PublicKey) delete(bvs.generateIDs, publicKey) - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: npPayload := payload.(*pb.NanoPay) key := nanoPay{hex.EncodeToString(npPayload.Sender), hex.EncodeToString(npPayload.Recipient), npPayload.Id} delete(bvs.nanoPays, key) delete(bvs.nanoPayPayloads, txn.Hash()) - case pb.ISSUE_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: } if amount > 0 || fee > 0 { diff --git a/chain/mining.go b/chain/mining.go index 36081a8cd..3e1b35274 100644 --- a/chain/mining.go +++ b/chain/mining.go @@ -69,7 +69,7 @@ func (bm *BuiltinMining) BuildBlock(ctx context.Context, height uint32, chordID totalTxCount := uint32(1) var lowFeeTxCount, lowFeeTxSize uint32 - if winnerType == pb.TXN_SIGNER { + if winnerType == pb.WinnerType_TXN_SIGNER { if _, err = DefaultLedger.Store.GetTransaction(winnerHash); err != nil { var miningSigChainTxn *transaction.Transaction miningSigChainTxn, err = por.GetPorServer().GetSigChainTxn(winnerHash) @@ -223,7 +223,7 @@ func (bm *BuiltinMining) CreateCoinbaseTransaction(reward common.Fixed64) *trans donationProgramhash, _ := common.ToScriptHash(config.DonationAddress) payload := transaction.NewCoinbase(donationProgramhash, redeemHash, reward) - pl, err := transaction.Pack(pb.COINBASE_TYPE, payload) + pl, err := transaction.Pack(pb.PayloadType_COINBASE_TYPE, payload) if err != nil { return nil } diff --git a/chain/pool/txpool.go b/chain/pool/txpool.go index c83fb4d93..6a411423e 100644 --- a/chain/pool/txpool.go +++ b/chain/pool/txpool.go @@ -148,7 +148,7 @@ func (tp *TxnPool) DropTxns() { txn := heap.Pop((*dropTxnsHeap)(&dropList)).(*transaction.Transaction) switch txn.UnsignedTx.Payload.Type { - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: if _, ok := tp.NanoPayTxs.Load(txn.Hash()); !ok { continue } @@ -303,12 +303,12 @@ func (tp *TxnPool) processTx(txn *transaction.Transaction) error { defer tp.blockValidationState.Unlock() switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: return fmt.Errorf("Invalid txn type %v", txn.UnsignedTx.Payload.Type) - case pb.SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: // sigchain txn should not be added to txn pool return nil - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: if err := tp.blockValidationState.VerifyTransactionWithBlock(txn, chain.DefaultLedger.Store.GetHeight()+1); err != nil { tp.blockValidationState.Reset() return err @@ -534,11 +534,11 @@ func (tp *TxnPool) removeTransactions(txns []*transaction.Transaction) []*transa txnsToRemove := make([]*transaction.Transaction, 0) switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: continue - case pb.SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: continue - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: if _, ok := tp.NanoPayTxs.Load(txn.Hash()); ok { tp.NanoPayTxs.Delete(txn.Hash()) txnsToRemove = append(txnsToRemove, txn) diff --git a/chain/store/stateGenerator.go b/chain/store/stateGenerator.go index 295fef1cb..a2a3524a2 100644 --- a/chain/store/stateGenerator.go +++ b/chain/store/stateGenerator.go @@ -27,12 +27,12 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac } switch txn.UnsignedTx.Payload.Type { - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: if !config.ChargeNanoPayTxnFee.GetValueAtHeight(height) { break } fallthrough - case pb.COINBASE_TYPE, pb.SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_COINBASE_TYPE, pb.PayloadType_SIG_CHAIN_TXN_TYPE: // For compatibility with existing database, otherwise state root will be different if txn.UnsignedTx.Fee == 0 { break @@ -45,8 +45,8 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac } switch txn.UnsignedTx.Payload.Type { - case pb.NANO_PAY_TYPE: - case pb.SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: default: if err = states.IncrNonce(pg[0]); err != nil { return err @@ -54,7 +54,7 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac } switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: coinbase := pl.(*pb.Coinbase) if !genesis { donationAmount, err := cs.GetDonation() @@ -76,7 +76,7 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac return err } } - case pb.TRANSFER_ASSET_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: transfer := pl.(*pb.TransferAsset) if err = states.UpdateBalance(common.BytesToUint160(transfer.Sender), config.NKNAssetID, common.Fixed64(transfer.Amount), Subtraction); err != nil { return err @@ -85,7 +85,7 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac if err = states.UpdateBalance(common.BytesToUint160(transfer.Recipient), config.NKNAssetID, common.Fixed64(transfer.Amount), Addition); err != nil { return err } - case pb.REGISTER_NAME_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: registerNamePayload := pl.(*pb.RegisterName) if err = states.UpdateBalance(pg[0], config.NKNAssetID, common.Fixed64(registerNamePayload.RegistrationFee), Subtraction); err != nil { return err @@ -107,12 +107,12 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac return err } } - case pb.TRANSFER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: transferNamePayload := pl.(*pb.TransferName) if err = states.transferName(transferNamePayload.Name, transferNamePayload.Recipient); err != nil { return err } - case pb.DELETE_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: deleteNamePayload := pl.(*pb.DeleteName) if config.LegacyNameService.GetValueAtHeight(height) { states.deleteNameForRegistrant_legacy(deleteNamePayload.Registrant, deleteNamePayload.Name) @@ -121,17 +121,17 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac return err } } - case pb.SUBSCRIBE_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: subscribePayload := pl.(*pb.Subscribe) if err = states.subscribe(subscribePayload.Topic, subscribePayload.Bucket, subscribePayload.Subscriber, subscribePayload.Identifier, subscribePayload.Meta, height+subscribePayload.Duration); err != nil { return err } - case pb.UNSUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: unsubscribePayload := pl.(*pb.Unsubscribe) if err = states.unsubscribe(unsubscribePayload.Topic, unsubscribePayload.Subscriber, unsubscribePayload.Identifier); err != nil { return err } - case pb.GENERATE_ID_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: genID := pl.(*pb.GenerateID) if err = states.UpdateBalance(pg[0], config.NKNAssetID, common.Fixed64(genID.RegistrationFee), Subtraction); err != nil { @@ -150,7 +150,7 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac if err = states.UpdateBalance(donationAddress, config.NKNAssetID, common.Fixed64(genID.RegistrationFee), Addition); err != nil { return err } - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: nanoPay := pl.(*pb.NanoPay) addrRecipient := common.BytesToUint160(nanoPay.Recipient) @@ -171,7 +171,7 @@ func (cs *ChainStore) spendTransaction(states *StateDB, txn *transaction.Transac if err = states.SetNanoPay(pg[0], addrRecipient, nanoPay.Id, common.Fixed64(nanoPay.Amount), nanoPay.NanoPayExpiration); err != nil { return err } - case pb.ISSUE_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: issue := pl.(*pb.IssueAsset) if err = states.SetAsset(txn.Hash(), issue.Name, issue.Symbol, common.Fixed64(issue.TotalSupply), issue.Precision, pg[0]); err != nil { return err @@ -248,7 +248,7 @@ func (cs *ChainStore) generateStateRoot(ctx context.Context, b *block.Block, gen preBlockHash := prevBlock.Hash() for _, txn := range prevBlock.Transactions { - if txn.UnsignedTx.Payload.Type == pb.GENERATE_ID_TYPE { + if txn.UnsignedTx.Payload.Type == pb.PayloadType_GENERATE_ID_TYPE { select { case <-ctx.Done(): return nil, common.EmptyUint256, errors.New("context deadline exceeded") diff --git a/chain/store/store.go b/chain/store/store.go index 83789606d..06cd57b59 100644 --- a/chain/store/store.go +++ b/chain/store/store.go @@ -311,17 +311,17 @@ func (cs *ChainStore) persist(b *block.Block) error { } switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: - case pb.SIG_CHAIN_TXN_TYPE: - case pb.TRANSFER_ASSET_TYPE: - case pb.ISSUE_ASSET_TYPE: - case pb.REGISTER_NAME_TYPE: - case pb.TRANSFER_NAME_TYPE: - case pb.DELETE_NAME_TYPE: - case pb.SUBSCRIBE_TYPE: - case pb.UNSUBSCRIBE_TYPE: - case pb.GENERATE_ID_TYPE: - case pb.NANO_PAY_TYPE: + case pb.PayloadType_COINBASE_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: default: return errors.New("unsupported transaction type") } diff --git a/chain/txvalidator/txvalidator.go b/chain/txvalidator/txvalidator.go index 2ef0befa1..3dbf31f6c 100644 --- a/chain/txvalidator/txvalidator.go +++ b/chain/txvalidator/txvalidator.go @@ -97,7 +97,7 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error } switch txn.UnsignedTx.Payload.Type { - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: pld := payload.(*pb.Coinbase) if len(pld.Sender) != common.UINT160SIZE && len(pld.Recipient) != common.UINT160SIZE { return errors.New("length of programhash error") @@ -111,7 +111,7 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error if err = CheckAmount(pld.Amount); err != nil { return err } - case pb.TRANSFER_ASSET_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: pld := payload.(*pb.TransferAsset) if len(pld.Sender) != common.UINT160SIZE && len(pld.Recipient) != common.UINT160SIZE { return errors.New("length of programhash error") @@ -125,8 +125,8 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error if err = CheckAmount(pld.Amount); err != nil { return err } - case pb.SIG_CHAIN_TXN_TYPE: - case pb.REGISTER_NAME_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: if ok := config.AllowTxnRegisterName.GetValueAtHeight(height); !ok { return errors.New("Register name transaction is not supported yet") } @@ -148,17 +148,17 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error if !match { return fmt.Errorf("name %s should match regex %s", pld.Name, regexPattern) } - case pb.TRANSFER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: pld := payload.(*pb.TransferName) if len(pld.Registrant) != ed25519.PublicKeySize { return fmt.Errorf("registrant invalid") } - case pb.DELETE_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: pld := payload.(*pb.DeleteName) if len(pld.Registrant) != ed25519.PublicKeySize { return fmt.Errorf("registrant invalid") } - case pb.SUBSCRIBE_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: pld := payload.(*pb.Subscribe) if pld.Duration == 0 { @@ -188,13 +188,13 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error if len(pld.Meta) > int(maxMetaLen) { return fmt.Errorf("subscribe meta len %d is greater than %d", len(pld.Meta), maxMetaLen) } - case pb.UNSUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: pld := payload.(*pb.Unsubscribe) if err := verifyPubSubTopic(pld.Topic, height); err != nil { return err } - case pb.GENERATE_ID_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: pld := payload.(*pb.GenerateID) err := crypto.CheckPublicKey(pld.PublicKey) if err != nil { @@ -213,7 +213,7 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error if txnHash.CompareTo(config.MaxGenerateIDTxnHash.GetValueAtHeight(height)) > 0 { return errors.New("txn hash is greater than MaxGenerateIDTxnHash") } - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: pld := payload.(*pb.NanoPay) if len(pld.Sender) != common.UINT160SIZE && len(pld.Recipient) != common.UINT160SIZE { @@ -233,7 +233,7 @@ func CheckTransactionPayload(txn *transaction.Transaction, height uint32) error return errors.New("txn expiration should be no later than nano pay expiration") } - case pb.ISSUE_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: pld := payload.(*pb.IssueAsset) if len(pld.Sender) != common.UINT160SIZE { return errors.New("length of programhash error") diff --git a/cmd/nknc/info/pretty.go b/cmd/nknc/info/pretty.go index 9dad01c82..a8b005887 100644 --- a/cmd/nknc/info/pretty.go +++ b/cmd/nknc/info/pretty.go @@ -5,6 +5,7 @@ import ( "encoding/json" "fmt" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/pb" ) @@ -27,51 +28,51 @@ func TxnUnmarshal(m map[string]interface{}) (interface{}, error) { } switch typ { - case pb.PayloadType_name[int32(pb.SIG_CHAIN_TXN_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_SIG_CHAIN_TXN_TYPE)]: sigChainTxn := &pb.SigChainTxn{} - if err = sigChainTxn.Unmarshal(buf); err == nil { // bin to pb struct of SigChainTxnType txn + if err = proto.Unmarshal(buf, sigChainTxn); err == nil { // bin to pb struct of SigChainTxnType txn m["payloadData"] = sigChainTxn.ToMap() } - case pb.PayloadType_name[int32(pb.COINBASE_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_COINBASE_TYPE)]: coinBaseTxn := &pb.Coinbase{} - if err = coinBaseTxn.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, coinBaseTxn); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = coinBaseTxn.ToMap() } - case pb.PayloadType_name[int32(pb.TRANSFER_ASSET_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_TRANSFER_ASSET_TYPE)]: trans := &pb.TransferAsset{} - if err = trans.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, trans); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = trans.ToMap() } - case pb.PayloadType_name[int32(pb.GENERATE_ID_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_GENERATE_ID_TYPE)]: genID := &pb.GenerateID{} - if err = genID.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, genID); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = genID.ToMap() } - case pb.PayloadType_name[int32(pb.REGISTER_NAME_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_REGISTER_NAME_TYPE)]: regName := &pb.RegisterName{} - if err = regName.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, regName); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = regName.ToMap() } - case pb.PayloadType_name[int32(pb.SUBSCRIBE_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_SUBSCRIBE_TYPE)]: sub := &pb.Subscribe{} - if err = sub.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, sub); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = sub.ToMap() } - case pb.PayloadType_name[int32(pb.UNSUBSCRIBE_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_UNSUBSCRIBE_TYPE)]: sub := &pb.Unsubscribe{} - if err = sub.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, sub); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = sub.ToMap() } - case pb.PayloadType_name[int32(pb.NANO_PAY_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_NANO_PAY_TYPE)]: pay := &pb.NanoPay{} - if err = pay.Unmarshal(buf); err == nil { // bin to pb struct of Coinbase txn + if err = proto.Unmarshal(buf, pay); err == nil { // bin to pb struct of Coinbase txn m["payloadData"] = pay.ToMap() } - case pb.PayloadType_name[int32(pb.TRANSFER_NAME_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_TRANSFER_NAME_TYPE)]: fallthrough //TODO - case pb.PayloadType_name[int32(pb.DELETE_NAME_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_DELETE_NAME_TYPE)]: fallthrough //TODO - case pb.PayloadType_name[int32(pb.ISSUE_ASSET_TYPE)]: + case pb.PayloadType_name[int32(pb.PayloadType_ISSUE_ASSET_TYPE)]: fallthrough //TODO default: return nil, fmt.Errorf("Unknow txType[%s] for pretty print", typ) diff --git a/consensus/config.go b/consensus/config.go index 605781acf..e39c178a6 100644 --- a/consensus/config.go +++ b/consensus/config.go @@ -4,8 +4,8 @@ import ( "time" "github.com/nknorg/nkn/v2/chain" - "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/config" + "github.com/nknorg/nkn/v2/pb" ) const ( @@ -29,6 +29,6 @@ const ( changeVoteMinRelativeWeight = 0.5 consensusMinRelativeWeight = 2.0 / 3.0 syncMinRelativeWeight = 1.0 / 2.0 - defaultRequestTransactionType = pb.REQUEST_TRANSACTION_SHORT_HASH + defaultRequestTransactionType = pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH acceptVoteHeightRange = 32 ) diff --git a/consensus/consensus.go b/consensus/consensus.go index 0b2be6066..75c54cfab 100644 --- a/consensus/consensus.go +++ b/consensus/consensus.go @@ -8,12 +8,12 @@ import ( "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/common" + "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/consensus/election" "github.com/nknorg/nkn/v2/event" "github.com/nknorg/nkn/v2/node" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/por" - "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/util/log" "github.com/nknorg/nkn/v2/vault" ) @@ -129,7 +129,7 @@ func (consensus *Consensus) prefillNeighborVotes(elc *election.Election, height neighbors := consensus.localNode.GetNeighbors(nil) neighborIDs := make([]interface{}, 0, len(neighbors)) for _, rn := range neighbors { - if rn.GetSyncState() != pb.PERSIST_FINISHED { + if rn.GetSyncState() != pb.SyncState_PERSIST_FINISHED { continue } // This is for nodes who just finished syncing but cannot verify block yet @@ -296,8 +296,8 @@ func (consensus *Consensus) saveAcceptedBlock(electedBlockHash common.Uint256) e syncState := consensus.localNode.GetSyncState() if block.Header.UnsignedHeader.Height == chain.DefaultLedger.Store.GetHeight()+1 { - if syncState == pb.WAIT_FOR_SYNCING { - consensus.localNode.SetSyncState(pb.PERSIST_FINISHED) + if syncState == pb.SyncState_WAIT_FOR_SYNCING { + consensus.localNode.SetSyncState(pb.SyncState_PERSIST_FINISHED) } err = chain.DefaultLedger.Blockchain.AddBlock(block, config.LivePruning) if err != nil { @@ -307,7 +307,7 @@ func (consensus *Consensus) saveAcceptedBlock(electedBlockHash common.Uint256) e return nil } - if syncState == pb.SYNC_STARTED || syncState == pb.SYNC_FINISHED { + if syncState == pb.SyncState_SYNC_STARTED || syncState == pb.SyncState_SYNC_FINISHED { return nil } @@ -351,13 +351,13 @@ func (consensus *Consensus) saveAcceptedBlock(electedBlockHash common.Uint256) e err = consensus.saveBlocksAcceptedDuringSync(block.Header.UnsignedHeader.Height) if err != nil { log.Errorf("Error saving blocks accepted during sync: %v", err) - consensus.localNode.SetSyncState(pb.WAIT_FOR_SYNCING) + consensus.localNode.SetSyncState(pb.SyncState_WAIT_FOR_SYNCING) return } consensus.localNode.SetMinVerifiableHeight(chain.DefaultLedger.Store.GetHeight() + por.SigChainMiningHeightOffset) - consensus.localNode.SetSyncState(pb.PERSIST_FINISHED) + consensus.localNode.SetSyncState(pb.SyncState_PERSIST_FINISHED) }() return nil diff --git a/consensus/message.go b/consensus/message.go index 004238cbb..1bbf2bb64 100644 --- a/consensus/message.go +++ b/consensus/message.go @@ -4,7 +4,7 @@ import ( "crypto/sha256" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/common" @@ -26,7 +26,7 @@ func NewVoteMessage(height uint32, blockHash common.Uint256) (*pb.UnsignedMessag } msg := &pb.UnsignedMessage{ - MessageType: pb.VOTE, + MessageType: pb.MessageType_VOTE, Message: buf, } @@ -46,7 +46,7 @@ func NewIHaveBlockProposalMessage(height uint32, blockHash common.Uint256) (*pb. } msg := &pb.UnsignedMessage{ - MessageType: pb.I_HAVE_BLOCK_PROPOSAL, + MessageType: pb.MessageType_I_HAVE_BLOCK_PROPOSAL, Message: buf, } @@ -69,7 +69,7 @@ func NewRequestBlockProposalMessage(blockHash common.Uint256, requestType pb.Req } msg := &pb.UnsignedMessage{ - MessageType: pb.REQUEST_BLOCK_PROPOSAL, + MessageType: pb.MessageType_REQUEST_BLOCK_PROPOSAL, Message: buf, } @@ -90,7 +90,7 @@ func NewRequestBlockProposalReply(b *block.Block, txnsHash [][]byte) (*pb.Unsign } msg := &pb.UnsignedMessage{ - MessageType: pb.REQUEST_BLOCK_PROPOSAL_REPLY, + MessageType: pb.MessageType_REQUEST_BLOCK_PROPOSAL_REPLY, Message: buf, } @@ -107,7 +107,7 @@ func NewGetConsensusStateMessage() (*pb.UnsignedMessage, error) { } msg := &pb.UnsignedMessage{ - MessageType: pb.GET_CONSENSUS_STATE, + MessageType: pb.MessageType_GET_CONSENSUS_STATE, Message: buf, } @@ -131,7 +131,7 @@ func NewGetConsensusStateReply(ledgerBlockHash common.Uint256, ledgerHeight, con } msg := &pb.UnsignedMessage{ - MessageType: pb.GET_CONSENSUS_STATE_REPLY, + MessageType: pb.MessageType_GET_CONSENSUS_STATE_REPLY, Message: buf, } @@ -155,7 +155,7 @@ func NewRequestProposalTransactionsMessage(blockHash common.Uint256, requestType } msg := &pb.UnsignedMessage{ - MessageType: pb.REQUEST_PROPOSAL_TRANSACTIONS, + MessageType: pb.MessageType_REQUEST_PROPOSAL_TRANSACTIONS, Message: buf, } @@ -181,7 +181,7 @@ func NewRequestProposalTransactionsReply(transactions []*transaction.Transaction } msg := &pb.UnsignedMessage{ - MessageType: pb.REQUEST_PROPOSAL_TRANSACTIONS_REPLY, + MessageType: pb.MessageType_REQUEST_PROPOSAL_TRANSACTIONS_REPLY, Message: buf, } @@ -279,9 +279,9 @@ func (consensus *Consensus) requestBlockProposalMessageHandler(remoteMessage *no var txnsHash [][]byte switch msgBody.Type { - case pb.REQUEST_FULL_TRANSACTION: + case pb.RequestTransactionType_REQUEST_FULL_TRANSACTION: b = fullBlock - case pb.REQUEST_TRANSACTION_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_HASH: b = &block.Block{Header: fullBlock.Header} if len(fullBlock.Transactions) > 0 { b.Transactions = []*transaction.Transaction{fullBlock.Transactions[0]} @@ -291,7 +291,7 @@ func (consensus *Consensus) requestBlockProposalMessageHandler(remoteMessage *no txnHash := txn.Hash() txnsHash[i] = txnHash.ToArray() } - case pb.REQUEST_TRANSACTION_SHORT_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH: if msgBody.ShortHashSize > sha256.Size { return replyBuf, false, fmt.Errorf("hash size %d is greater than %d", msgBody.ShortHashSize, sha256.Size) } @@ -349,7 +349,7 @@ func (consensus *Consensus) requestProposalTransactionsMessageHandler(remoteMess txns := make([]*transaction.Transaction, len(msgBody.TransactionsHash)) switch msgBody.Type { - case pb.REQUEST_TRANSACTION_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_HASH: txnMap := make(map[common.Uint256]*transaction.Transaction) for _, txn := range b.Transactions { txnMap[txn.Hash()] = txn @@ -366,7 +366,7 @@ func (consensus *Consensus) requestProposalTransactionsMessageHandler(remoteMess return replyBuf, false, fmt.Errorf("Transaction %s not found in block", txnHash.ToHexString()) } } - case pb.REQUEST_TRANSACTION_SHORT_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH: txnMap := make(map[string]*transaction.Transaction) for _, txn := range b.Transactions { txnMap[string(txn.ShortHash(msgBody.ShortHashSalt, msgBody.ShortHashSize))] = txn @@ -390,9 +390,9 @@ func (consensus *Consensus) requestProposalTransactionsMessageHandler(remoteMess } func (consensus *Consensus) registerMessageHandler() { - consensus.localNode.AddMessageHandler(pb.VOTE, consensus.voteMessageHandler) - consensus.localNode.AddMessageHandler(pb.I_HAVE_BLOCK_PROPOSAL, consensus.iHaveBlockProposalMessageHandler) - consensus.localNode.AddMessageHandler(pb.GET_CONSENSUS_STATE, consensus.getConsensusStateMessageHandler) - consensus.localNode.AddMessageHandler(pb.REQUEST_BLOCK_PROPOSAL, consensus.requestBlockProposalMessageHandler) - consensus.localNode.AddMessageHandler(pb.REQUEST_PROPOSAL_TRANSACTIONS, consensus.requestProposalTransactionsMessageHandler) + consensus.localNode.AddMessageHandler(pb.MessageType_VOTE, consensus.voteMessageHandler) + consensus.localNode.AddMessageHandler(pb.MessageType_I_HAVE_BLOCK_PROPOSAL, consensus.iHaveBlockProposalMessageHandler) + consensus.localNode.AddMessageHandler(pb.MessageType_GET_CONSENSUS_STATE, consensus.getConsensusStateMessageHandler) + consensus.localNode.AddMessageHandler(pb.MessageType_REQUEST_BLOCK_PROPOSAL, consensus.requestBlockProposalMessageHandler) + consensus.localNode.AddMessageHandler(pb.MessageType_REQUEST_PROPOSAL_TRANSACTIONS, consensus.requestProposalTransactionsMessageHandler) } diff --git a/consensus/proposal.go b/consensus/proposal.go index b6a72e5c1..b3dcda670 100644 --- a/consensus/proposal.go +++ b/consensus/proposal.go @@ -9,17 +9,17 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/common" + "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/consensus/election" "github.com/nknorg/nkn/v2/crypto" "github.com/nknorg/nkn/v2/node" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/por" "github.com/nknorg/nkn/v2/transaction" - "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/util/log" "github.com/nknorg/nkn/v2/util/timer" ) @@ -308,7 +308,7 @@ func (consensus *Consensus) receiveProposalHash(neighborID string, height uint32 func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash common.Uint256, height uint32, requestType pb.RequestTransactionType) (*block.Block, error) { var shortHashSalt []byte var shortHashSize uint32 - if requestType == pb.REQUEST_TRANSACTION_SHORT_HASH { + if requestType == pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH { shortHashSalt = config.ShortHashSalt shortHashSize = config.ShortHashSize } @@ -370,7 +370,7 @@ func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash missingTxnsHash := make([][]byte, 0) switch requestType { - case pb.REQUEST_FULL_TRANSACTION: + case pb.RequestTransactionType_REQUEST_FULL_TRANSACTION: txnsHash := make([]common.Uint256, len(b.Transactions)) for i, txn := range b.Transactions { txnsHash[i] = txn.Hash() @@ -382,7 +382,7 @@ func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash } return b, nil - case pb.REQUEST_TRANSACTION_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_HASH: txnsHash := make([]common.Uint256, len(replyMsg.TransactionsHash)) for i, txnHashBytes := range replyMsg.TransactionsHash { txnsHash[i], err = common.Uint256ParseFromBytes(txnHashBytes) @@ -412,7 +412,7 @@ func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash missingTxnsHash = append(missingTxnsHash, txnsHash[i].ToArray()) } } - case pb.REQUEST_TRANSACTION_SHORT_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH: blockTxns := make(map[string]*transaction.Transaction, len(b.Transactions)) for _, txn := range b.Transactions { blockTxns[string(txn.ShortHash(config.ShortHashSalt, config.ShortHashSize))] = txn @@ -452,7 +452,7 @@ func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash mergedTxns = existingTxns } - if requestType == pb.REQUEST_TRANSACTION_SHORT_HASH { + if requestType == pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH { txnsHash := make([]common.Uint256, len(mergedTxns)) for i, txn := range mergedTxns { txnsHash[i] = txn.Hash() @@ -461,7 +461,7 @@ func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash err = crypto.VerifyRoot(txnsHash, b.Header.UnsignedHeader.TransactionsRoot) if err != nil { log.Warningf("Short hash verify root error: %v, fallback to full transaction hash", err) - return consensus.requestProposal(neighbor, blockHash, height, pb.REQUEST_TRANSACTION_HASH) + return consensus.requestProposal(neighbor, blockHash, height, pb.RequestTransactionType_REQUEST_TRANSACTION_HASH) } } @@ -473,10 +473,10 @@ func (consensus *Consensus) requestProposal(neighbor *node.RemoteNode, blockHash func getTxnHash(txn *transaction.Transaction, requestType pb.RequestTransactionType) ([]byte, error) { var txnHashBytes []byte switch requestType { - case pb.REQUEST_TRANSACTION_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_HASH: txnHash := txn.Hash() txnHashBytes = txnHash.ToArray() - case pb.REQUEST_TRANSACTION_SHORT_HASH: + case pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH: txnHashBytes = txn.ShortHash(config.ShortHashSalt, config.ShortHashSize) default: return nil, fmt.Errorf("unsupported request type %v", requestType) @@ -531,7 +531,7 @@ func mergeTxns(existingTxns, requestedTxns, mergedTxns []*transaction.Transactio func (consensus *Consensus) requestProposalTransactions(neighbor *node.RemoteNode, blockHash common.Uint256, requestType pb.RequestTransactionType, txnsHash [][]byte) ([]*transaction.Transaction, error) { var shortHashSalt []byte var shortHashSize uint32 - if requestType == pb.REQUEST_TRANSACTION_SHORT_HASH { + if requestType == pb.RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH { shortHashSalt = config.ShortHashSalt shortHashSize = config.ShortHashSize } diff --git a/consensus/state.go b/consensus/state.go index fc8edb03f..931ad32cf 100644 --- a/consensus/state.go +++ b/consensus/state.go @@ -4,7 +4,7 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/node" "github.com/nknorg/nkn/v2/pb" @@ -44,8 +44,8 @@ func (consensus *Consensus) startGettingNeighborConsensusState() { if majorityConsensusHeight+1 > localLedgerHeight { consensus.setNextConsensusHeight(majorityConsensusHeight + 1) consensus.localNode.SetMinVerifiableHeight(majorityConsensusHeight + 1 + por.SigChainMiningHeightOffset) - if consensus.localNode.GetSyncState() == pb.PERSIST_FINISHED { - consensus.localNode.SetSyncState(pb.WAIT_FOR_SYNCING) + if consensus.localNode.GetSyncState() == pb.SyncState_PERSIST_FINISHED { + consensus.localNode.SetSyncState(pb.SyncState_WAIT_FOR_SYNCING) } } } @@ -129,7 +129,7 @@ func (consensus *Consensus) getNeighborsMajorityConsensusHeight() uint32 { totalCount := 0 for _, neighbor := range consensus.localNode.GetVotingNeighbors(nil) { if consensusState, ok := allStates[neighbor.GetID()]; ok { - if consensusState.SyncState != pb.WAIT_FOR_SYNCING && consensusState.ConsensusHeight > 0 { + if consensusState.SyncState != pb.SyncState_WAIT_FOR_SYNCING && consensusState.ConsensusHeight > 0 { counter[consensusState.ConsensusHeight]++ totalCount++ } diff --git a/consensus/vote.go b/consensus/vote.go index 4ad2fb861..e8eab0ab8 100644 --- a/consensus/vote.go +++ b/consensus/vote.go @@ -13,7 +13,7 @@ import ( func (consensus *Consensus) receiveVote(neighborID string, height uint32, blockHash common.Uint256) error { log.Debugf("Receive vote %s for height %d from neighbor %v", blockHash.ToHexString(), height, neighborID) - if consensus.localNode.GetSyncState() == pb.PERSIST_FINISHED { + if consensus.localNode.GetSyncState() == pb.SyncState_PERSIST_FINISHED { expectedHeight := consensus.GetExpectedHeight() if math.Abs(float64(height)-float64(expectedHeight)) > acceptVoteHeightRange { return fmt.Errorf("receive invalid vote height %d, expecting %d +- %d", height, expectedHeight, acceptVoteHeightRange) @@ -22,7 +22,7 @@ func (consensus *Consensus) receiveVote(neighborID string, height uint32, blockH if blockHash != common.EmptyUint256 { err := consensus.receiveProposalHash(neighborID, height, blockHash) - if err != nil && consensus.localNode.GetSyncState() == pb.PERSIST_FINISHED { + if err != nil && consensus.localNode.GetSyncState() == pb.SyncState_PERSIST_FINISHED { log.Warningf("Receive block hash error when receive vote: %v", err) } } diff --git a/go.mod b/go.mod index 37cc0a8f9..53cfa3f2c 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/gin-contrib/sessions v0.0.0-20190512062852-3cb4c4f2d615 github.com/gin-gonic/gin v1.4.0 github.com/go-acme/lego/v3 v3.8.0 - github.com/gogo/protobuf v1.3.1 + github.com/golang/protobuf v1.4.1 github.com/gorilla/securecookie v1.1.1 github.com/gorilla/websocket v1.4.0 github.com/howeyc/gopass v0.0.0-20170109162249-bf9dde6d0d2c diff --git a/go.sum b/go.sum index 7650a87c0..d984355d3 100644 --- a/go.sum +++ b/go.sum @@ -104,9 +104,8 @@ github.com/go-sql-driver/mysql v1.5.0/go.mod h1:DCzpHaOWr8IXmIStZouvnhqoel9Qv2LB github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= +github.com/gogo/protobuf v1.2.0 h1:xU6/SpYbvkNYiptHJYEDRseDLvYE7wSqhYYNy0QSUzI= github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ= -github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls= -github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o= github.com/goji/httpauth v0.0.0-20160601135302-2da839ab0f4d/go.mod h1:nnjvkQ9ptGaCkuDUx6wNykzzlUixGxvkme+H/lnzb+A= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= @@ -124,6 +123,13 @@ github.com/golang/protobuf v1.3.2/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5y github.com/golang/protobuf v1.3.3/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= github.com/golang/protobuf v1.3.4 h1:87PNWwrRvUSnqS4dlcBU/ftvOIBep4sYuBLlh6rX2wk= github.com/golang/protobuf v1.3.4/go.mod h1:vzj43D7+SQXF/4pzW/hwtAqwc6iTitCiVSaWz5lYuqw= +github.com/golang/protobuf v1.4.0-rc.1/go.mod h1:ceaxUfeHdC40wWswd/P6IGgMaK3YpKi5j83Wpe3EHw8= +github.com/golang/protobuf v1.4.0-rc.1.0.20200221234624-67d41d38c208/go.mod h1:xKAWHe0F5eneWXFV3EuXVDTCmh+JuBKY0li0aMyXATA= +github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrUpVNzEA03Pprs= +github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= +github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.1 h1:ZFgWrT+bLgsYPirOnRfKLYJLvssAegOj/hgyMFdJZe0= +github.com/golang/protobuf v1.4.1/go.mod h1:U8fpvMrcmy5pZrNK1lt4xCsGvpyWQ/VVv6QDs8UjoX8= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db h1:woRePGFeVFfLKN/pOkfl+p/TAqKOfFu+7KPlMVpok/w= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/gomodule/redigo v2.0.0+incompatible/go.mod h1:B4C85qUVwatsJoIUNIfCRsp7qO0iAmpGFZ4EELWSbC4= @@ -132,6 +138,7 @@ github.com/google/btree v1.0.0/go.mod h1:lNA+9X1NB3Zf8V7Ke586lFgjr2dZNuvo3lPJSGZ github.com/google/go-cmp v0.2.0/go.mod h1:oXzfMopK8JAjlY9xF4vHSVASa0yLyX7SntLO5aqRK0M= github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= +github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4= github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE= github.com/google/go-querystring v1.0.0/go.mod h1:odCYkC5MyYFN7vkCjXpyrEuKhc/BUO6wN/zVPAxq5ck= github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= @@ -204,7 +211,6 @@ github.com/jstemmer/go-junit-report v0.9.1/go.mod h1:Brl9GWCQeLvo8nXZwPNNblvFj/X github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= github.com/kidstuff/mongostore v0.0.0-20181113001930-e650cd85ee4b/go.mod h1:g2nVr8KZVXJSS97Jo8pJ0jgq29P6H7dG0oplUA86MQw= -github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= github.com/klauspost/cpuid v1.2.1 h1:vJi+O/nMdFt0vqm8NZBI6wzALWdA2X+egi0ogNyrC/w= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -491,7 +497,6 @@ golang.org/x/time v0.0.0-20191024005414-555d28b269f0 h1:/5xXl8Y5W96D+TtHSlonuFqG golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= golang.org/x/tools v0.0.0-20180828015842-6cd1fcedba52/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= -golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY= golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs= @@ -525,6 +530,7 @@ golang.org/x/tools v0.0.0-20200224181240-023911ca70b2/go.mod h1:TB2adYChydJhpapK golang.org/x/tools v0.0.0-20200304193943-95d2e580d8eb/go.mod h1:o4KQGtdN14AW+yjsvvwRTJJuXz8XRtIHtEnmAXLyFUw= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= @@ -569,6 +575,13 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.26.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.27.1/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= +google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= +google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= +google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= +google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miEFZTKqfCUM6K7xSMQL9OKL/b6hQv+e19PK+JZNE= +google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= +google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= +google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= diff --git a/node/encryption.go b/node/encryption.go index 224a46767..c0422a439 100644 --- a/node/encryption.go +++ b/node/encryption.go @@ -5,7 +5,7 @@ import ( "errors" "fmt" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/crypto/ed25519" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/util/log" diff --git a/node/info.go b/node/info.go index e176e52a6..79923f5c3 100644 --- a/node/info.go +++ b/node/info.go @@ -5,7 +5,7 @@ import ( "encoding/json" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/util/log" nnetnode "github.com/nknorg/nnet/node" diff --git a/node/localnode.go b/node/localnode.go index c8771b845..3a280daa0 100644 --- a/node/localnode.go +++ b/node/localnode.go @@ -9,12 +9,12 @@ import ( "sync/atomic" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/chain/pool" + "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/event" "github.com/nknorg/nkn/v2/pb" - "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/util/log" "github.com/nknorg/nkn/v2/vault" "github.com/nknorg/nnet" @@ -232,7 +232,7 @@ func (localNode *LocalNode) GetHeight() uint32 { func (localNode *LocalNode) SetSyncState(s pb.SyncState) bool { log.Infof("Set sync state to %s", s.String()) changed := localNode.Node.SetSyncState(s) - if changed && s == pb.PERSIST_FINISHED { + if changed && s == pb.SyncState_PERSIST_FINISHED { config.SyncPruning = config.LivePruning localNode.verifyNeighbors() } diff --git a/node/message.go b/node/message.go index 5ed3a5586..74205b80b 100644 --- a/node/message.go +++ b/node/message.go @@ -6,7 +6,7 @@ import ( "fmt" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/crypto" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/util/log" @@ -157,7 +157,7 @@ func (localNode *LocalNode) remoteMessageRouted(remoteMessage *nnetnode.RemoteMe } } - if unsignedMsg.MessageType == pb.RELAY { + if unsignedMsg.MessageType == pb.MessageType_RELAY { relayMessage := &pb.Relay{} err = proto.Unmarshal(unsignedMsg.Message, relayMessage) if err != nil { @@ -206,7 +206,7 @@ func (localNode *LocalNode) remoteMessageRouted(remoteMessage *nnetnode.RemoteMe localNode.IncrementRelayMessageCount() } - if unsignedMsg.MessageType == pb.TRANSACTIONS && nnetLocalNode != nil { + if unsignedMsg.MessageType == pb.MessageType_TRANSACTIONS && nnetLocalNode != nil { txnMsg := &pb.Transactions{} err = proto.Unmarshal(unsignedMsg.Message, txnMsg) if err != nil { @@ -281,8 +281,8 @@ func (localNode *LocalNode) receiveMessage(sender *Node, unsignedMsg *pb.Unsigne // checkMessageType checks if a message type is allowed func checkMessageType(messageType pb.MessageType) error { - if messageType == pb.MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE { - return fmt.Errorf("message type %s should not be used", pb.MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE.String()) + if messageType == pb.MessageType_MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE { + return fmt.Errorf("message type %s should not be used", pb.MessageType_MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE.String()) } return nil diff --git a/node/neighbor.go b/node/neighbor.go index 2037f96f2..920a084ee 100644 --- a/node/neighbor.go +++ b/node/neighbor.go @@ -10,13 +10,13 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/chain" + "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/crypto" "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/util" "github.com/nknorg/nkn/v2/util/address" - "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/util/log" nnetnode "github.com/nknorg/nnet/node" "github.com/nknorg/nnet/overlay/chord" @@ -323,7 +323,7 @@ func (localNode *LocalNode) shouldConnectToNode(n *nnetpb.Node) error { id, err := chain.DefaultLedger.Store.GetID(nodeData.PublicKey) if err != nil || len(id) == 0 || bytes.Equal(id, crypto.Sha256ZeroHash) { - if localNode.GetSyncState() == pb.PERSIST_FINISHED { + if localNode.GetSyncState() == pb.SyncState_PERSIST_FINISHED { return fmt.Errorf("remote node id can not be found in local ledger: err-%v, id-%v", err, id) } } else { diff --git a/node/node.go b/node/node.go index 0fba637ed..006c25888 100644 --- a/node/node.go +++ b/node/node.go @@ -6,7 +6,7 @@ import ( "net/url" "sync" - "github.com/gogo/protobuf/jsonpb" + "github.com/golang/protobuf/jsonpb" "github.com/nknorg/nkn/v2/crypto" "github.com/nknorg/nkn/v2/pb" nnetpb "github.com/nknorg/nnet/protobuf" @@ -66,7 +66,7 @@ func NewNode(nnetNode *nnetpb.Node, nodeData *pb.NodeData) (*Node, error) { Node: nnetNode, NodeData: nodeData, publicKey: nodeData.PublicKey, - syncState: pb.WAIT_FOR_SYNCING, + syncState: pb.SyncState_WAIT_FOR_SYNCING, } return node, nil diff --git a/node/relay.go b/node/relay.go index 35ea9e704..1357b7126 100644 --- a/node/relay.go +++ b/node/relay.go @@ -4,7 +4,7 @@ import ( "fmt" "sync" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/chain/txvalidator" @@ -39,9 +39,9 @@ func (rs *RelayService) Start() error { event.Queue.Subscribe(event.NewBlockProduced, rs.flushSigChain) event.Queue.Subscribe(event.PinSigChain, rs.startPinSigChain) event.Queue.Subscribe(event.BacktrackSigChain, rs.backtrackDestSigChain) - rs.localNode.AddMessageHandler(pb.RELAY, rs.relayMessageHandler) - rs.localNode.AddMessageHandler(pb.PIN_SIGNATURE_CHAIN, rs.pinSigChainMessageHandler) - rs.localNode.AddMessageHandler(pb.BACKTRACK_SIGNATURE_CHAIN, rs.backtrackSigChainMessageHandler) + rs.localNode.AddMessageHandler(pb.MessageType_RELAY, rs.relayMessageHandler) + rs.localNode.AddMessageHandler(pb.MessageType_PIN_SIGNATURE_CHAIN, rs.pinSigChainMessageHandler) + rs.localNode.AddMessageHandler(pb.MessageType_BACKTRACK_SIGNATURE_CHAIN, rs.backtrackSigChainMessageHandler) return nil } @@ -64,7 +64,7 @@ func NewRelayMessage(srcIdentifier string, srcPubkey, destID, payload, blockHash } msg := &pb.UnsignedMessage{ - MessageType: pb.RELAY, + MessageType: pb.MessageType_RELAY, Message: buf, } @@ -83,7 +83,7 @@ func NewPinSigChainMessage(hash []byte) (*pb.UnsignedMessage, error) { } msg := &pb.UnsignedMessage{ - MessageType: pb.PIN_SIGNATURE_CHAIN, + MessageType: pb.MessageType_PIN_SIGNATURE_CHAIN, Message: buf, } @@ -103,7 +103,7 @@ func NewBacktrackSigChainMessage(sigChainElems []*pb.SigChainElem, hash []byte) } msg := &pb.UnsignedMessage{ - MessageType: pb.BACKTRACK_SIGNATURE_CHAIN, + MessageType: pb.MessageType_BACKTRACK_SIGNATURE_CHAIN, Message: buf, } @@ -305,7 +305,7 @@ func (rs *RelayService) updateRelayMessage(relayMessage *pb.Relay, nextHop, prev nextPubkey = nextHop.GetPubKey() } - mining := config.Parameters.Mining && rs.localNode.GetSyncState() == pb.PERSIST_FINISHED + mining := config.Parameters.Mining && rs.localNode.GetSyncState() == pb.SyncState_PERSIST_FINISHED var prevNodeID []byte if prevHop != nil { @@ -339,7 +339,7 @@ func (localNode *LocalNode) SendRelayMessage(srcAddr, destAddr string, payload, destID, destPubkey, signature, - pb.SIGNATURE, + pb.SigAlgo_SIGNATURE, ) if err != nil { return err diff --git a/node/remotenode.go b/node/remotenode.go index b4ed4ca68..b9b691fee 100644 --- a/node/remotenode.go +++ b/node/remotenode.go @@ -6,7 +6,7 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/pb" nnetnode "github.com/nknorg/nnet/node" ) diff --git a/node/syncblock.go b/node/syncblock.go index e27b09900..ed05c8e6b 100644 --- a/node/syncblock.go +++ b/node/syncblock.go @@ -6,13 +6,13 @@ import ( "sync" "time" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/consequential" "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/common" - "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/config" + "github.com/nknorg/nkn/v2/pb" "github.com/nknorg/nkn/v2/util/log" ) @@ -38,7 +38,7 @@ func NewGetBlockHeadersMessage(startHeight, endHeight uint32) (*pb.UnsignedMessa } msg := &pb.UnsignedMessage{ - MessageType: pb.GET_BLOCK_HEADERS, + MessageType: pb.MessageType_GET_BLOCK_HEADERS, Message: buf, } @@ -63,7 +63,7 @@ func NewGetBlockHeadersReply(headers []*block.Header) (*pb.UnsignedMessage, erro } msg := &pb.UnsignedMessage{ - MessageType: pb.GET_BLOCK_HEADERS_REPLY, + MessageType: pb.MessageType_GET_BLOCK_HEADERS_REPLY, Message: buf, } @@ -83,7 +83,7 @@ func NewGetBlocksMessage(startHeight, endHeight uint32) (*pb.UnsignedMessage, er } msg := &pb.UnsignedMessage{ - MessageType: pb.GET_BLOCKS, + MessageType: pb.MessageType_GET_BLOCKS, Message: buf, } @@ -108,7 +108,7 @@ func NewGetBlocksReply(blocks []*block.Block) (*pb.UnsignedMessage, error) { } msg := &pb.UnsignedMessage{ - MessageType: pb.GET_BLOCKS_REPLY, + MessageType: pb.MessageType_GET_BLOCKS_REPLY, Message: buf, } @@ -359,8 +359,8 @@ func (localNode *LocalNode) getNeighborsMajorityBlockHashByHeight(height uint32, // initSyncing initializes block syncing state and registers message handler func (localNode *LocalNode) initSyncing() { - localNode.AddMessageHandler(pb.GET_BLOCK_HEADERS, localNode.getBlockHeadersMessageHandler) - localNode.AddMessageHandler(pb.GET_BLOCKS, localNode.getBlocksMessageHandler) + localNode.AddMessageHandler(pb.MessageType_GET_BLOCK_HEADERS, localNode.getBlockHeadersMessageHandler) + localNode.AddMessageHandler(pb.MessageType_GET_BLOCKS, localNode.getBlocksMessageHandler) localNode.ResetSyncing() } @@ -376,7 +376,7 @@ func (localNode *LocalNode) StartSyncing(syncStopHash common.Uint256, syncStopHe syncOnce.Do(func() { started = true - localNode.SetSyncState(pb.SYNC_STARTED) + localNode.SetSyncState(pb.SyncState_SYNC_STARTED) currentHeight := chain.DefaultLedger.Store.GetHeight() if syncStopHeight <= currentHeight { @@ -442,7 +442,7 @@ func (localNode *LocalNode) StartSyncing(syncStopHash common.Uint256, syncStopHe } } - localNode.SetSyncState(pb.SYNC_FINISHED) + localNode.SetSyncState(pb.SyncState_SYNC_FINISHED) }) return started, err diff --git a/node/transaction.go b/node/transaction.go index 39584a828..0cefe07a9 100644 --- a/node/transaction.go +++ b/node/transaction.go @@ -6,7 +6,7 @@ import ( "fmt" "hash/fnv" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/block" "github.com/nknorg/nkn/v2/chain" "github.com/nknorg/nkn/v2/chain/pool" @@ -154,8 +154,8 @@ func (rt *receiveTxnMsg) receiveTxnMsg(txnMsg *pb.Transactions, remoteMessage *n } func (localNode *LocalNode) initTxnHandlers() { - localNode.AddMessageHandler(pb.I_HAVE_SIGNATURE_CHAIN_TRANSACTION, localNode.iHaveSignatureChainTransactionMessageHandler) - localNode.AddMessageHandler(pb.REQUEST_SIGNATURE_CHAIN_TRANSACTION, localNode.requestSignatureChainTransactionMessageHandler) + localNode.AddMessageHandler(pb.MessageType_I_HAVE_SIGNATURE_CHAIN_TRANSACTION, localNode.iHaveSignatureChainTransactionMessageHandler) + localNode.AddMessageHandler(pb.MessageType_REQUEST_SIGNATURE_CHAIN_TRANSACTION, localNode.requestSignatureChainTransactionMessageHandler) localNode.startRequestingSigChainTxn() localNode.startReceivingTxnMsg() } @@ -274,7 +274,7 @@ func NewTransactionsMessage(transactions []*transaction.Transaction) (*pb.Unsign } msg := &pb.UnsignedMessage{ - MessageType: pb.TRANSACTIONS, + MessageType: pb.MessageType_TRANSACTIONS, Message: buf, } @@ -295,7 +295,7 @@ func NewIHaveSignatureChainTransactionMessage(height uint32, sigHash []byte) (*p } msg := &pb.UnsignedMessage{ - MessageType: pb.I_HAVE_SIGNATURE_CHAIN_TRANSACTION, + MessageType: pb.MessageType_I_HAVE_SIGNATURE_CHAIN_TRANSACTION, Message: buf, } @@ -315,7 +315,7 @@ func NewRequestSignatureChainTransactionMessage(sigHash []byte) (*pb.UnsignedMes } msg := &pb.UnsignedMessage{ - MessageType: pb.REQUEST_SIGNATURE_CHAIN_TRANSACTION, + MessageType: pb.MessageType_REQUEST_SIGNATURE_CHAIN_TRANSACTION, Message: buf, } @@ -336,7 +336,7 @@ func NewRequestSignatureChainTransactionReply(transaction *transaction.Transacti } msg := &pb.UnsignedMessage{ - MessageType: pb.REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY, + MessageType: pb.MessageType_REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY, Message: buf, } diff --git a/pb/block.pb.go b/pb/block.pb.go index 6932b4c94..642219eb2 100644 --- a/pb/block.pb.go +++ b/pb/block.pb.go @@ -1,21 +1,11 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: pb/block.proto package pb -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strconv "strconv" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -26,14 +16,14 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type WinnerType int32 const ( - GENESIS_SIGNER WinnerType = 0 - TXN_SIGNER WinnerType = 1 - BLOCK_SIGNER WinnerType = 2 + WinnerType_GENESIS_SIGNER WinnerType = 0 + WinnerType_TXN_SIGNER WinnerType = 1 + WinnerType_BLOCK_SIGNER WinnerType = 2 ) var WinnerType_name = map[int32]string{ @@ -47,49 +37,47 @@ var WinnerType_value = map[string]int32{ "BLOCK_SIGNER": 2, } +func (x WinnerType) String() string { + return proto.EnumName(WinnerType_name, int32(x)) +} func (WinnerType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_block_3db5cb9d430df00f, []int{0} + return fileDescriptor_block_623cc3ece9da7f8b, []int{0} } type UnsignedHeader struct { - Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` - PrevBlockHash []byte `protobuf:"bytes,2,opt,name=prev_block_hash,json=prevBlockHash,proto3" json:"prev_block_hash,omitempty"` - TransactionsRoot []byte `protobuf:"bytes,3,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactions_root,omitempty"` - StateRoot []byte `protobuf:"bytes,4,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` - Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` - Height uint32 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"` - RandomBeacon []byte `protobuf:"bytes,7,opt,name=random_beacon,json=randomBeacon,proto3" json:"random_beacon,omitempty"` - WinnerHash []byte `protobuf:"bytes,8,opt,name=winner_hash,json=winnerHash,proto3" json:"winner_hash,omitempty"` - WinnerType WinnerType `protobuf:"varint,9,opt,name=winner_type,json=winnerType,proto3,enum=pb.WinnerType" json:"winner_type,omitempty"` - SignerPk []byte `protobuf:"bytes,10,opt,name=signer_pk,json=signerPk,proto3" json:"signer_pk,omitempty"` - SignerId []byte `protobuf:"bytes,11,opt,name=signer_id,json=signerId,proto3" json:"signer_id,omitempty"` -} - -func (m *UnsignedHeader) Reset() { *m = UnsignedHeader{} } -func (*UnsignedHeader) ProtoMessage() {} + Version uint32 `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"` + PrevBlockHash []byte `protobuf:"bytes,2,opt,name=prev_block_hash,json=prevBlockHash,proto3" json:"prev_block_hash,omitempty"` + TransactionsRoot []byte `protobuf:"bytes,3,opt,name=transactions_root,json=transactionsRoot,proto3" json:"transactions_root,omitempty"` + StateRoot []byte `protobuf:"bytes,4,opt,name=state_root,json=stateRoot,proto3" json:"state_root,omitempty"` + Timestamp int64 `protobuf:"varint,5,opt,name=timestamp,proto3" json:"timestamp,omitempty"` + Height uint32 `protobuf:"varint,6,opt,name=height,proto3" json:"height,omitempty"` + RandomBeacon []byte `protobuf:"bytes,7,opt,name=random_beacon,json=randomBeacon,proto3" json:"random_beacon,omitempty"` + WinnerHash []byte `protobuf:"bytes,8,opt,name=winner_hash,json=winnerHash,proto3" json:"winner_hash,omitempty"` + WinnerType WinnerType `protobuf:"varint,9,opt,name=winner_type,json=winnerType,proto3,enum=pb.WinnerType" json:"winner_type,omitempty"` + SignerPk []byte `protobuf:"bytes,10,opt,name=signer_pk,json=signerPk,proto3" json:"signer_pk,omitempty"` + SignerId []byte `protobuf:"bytes,11,opt,name=signer_id,json=signerId,proto3" json:"signer_id,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UnsignedHeader) Reset() { *m = UnsignedHeader{} } +func (m *UnsignedHeader) String() string { return proto.CompactTextString(m) } +func (*UnsignedHeader) ProtoMessage() {} func (*UnsignedHeader) Descriptor() ([]byte, []int) { - return fileDescriptor_block_3db5cb9d430df00f, []int{0} + return fileDescriptor_block_623cc3ece9da7f8b, []int{0} } func (m *UnsignedHeader) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_UnsignedHeader.Unmarshal(m, b) } func (m *UnsignedHeader) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnsignedHeader.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_UnsignedHeader.Marshal(b, m, deterministic) } func (dst *UnsignedHeader) XXX_Merge(src proto.Message) { xxx_messageInfo_UnsignedHeader.Merge(dst, src) } func (m *UnsignedHeader) XXX_Size() int { - return m.Size() + return xxx_messageInfo_UnsignedHeader.Size(m) } func (m *UnsignedHeader) XXX_DiscardUnknown() { xxx_messageInfo_UnsignedHeader.DiscardUnknown(m) @@ -157,7 +145,7 @@ func (m *UnsignedHeader) GetWinnerType() WinnerType { if m != nil { return m.WinnerType } - return GENESIS_SIGNER + return WinnerType_GENESIS_SIGNER } func (m *UnsignedHeader) GetSignerPk() []byte { @@ -175,35 +163,30 @@ func (m *UnsignedHeader) GetSignerId() []byte { } type Header struct { - UnsignedHeader *UnsignedHeader `protobuf:"bytes,1,opt,name=unsigned_header,json=unsignedHeader" json:"unsigned_header,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + UnsignedHeader *UnsignedHeader `protobuf:"bytes,1,opt,name=unsigned_header,json=unsignedHeader,proto3" json:"unsigned_header,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Header) Reset() { *m = Header{} } -func (*Header) ProtoMessage() {} +func (m *Header) Reset() { *m = Header{} } +func (m *Header) String() string { return proto.CompactTextString(m) } +func (*Header) ProtoMessage() {} func (*Header) Descriptor() ([]byte, []int) { - return fileDescriptor_block_3db5cb9d430df00f, []int{1} + return fileDescriptor_block_623cc3ece9da7f8b, []int{1} } func (m *Header) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Header.Unmarshal(m, b) } func (m *Header) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Header.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Header.Marshal(b, m, deterministic) } func (dst *Header) XXX_Merge(src proto.Message) { xxx_messageInfo_Header.Merge(dst, src) } func (m *Header) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Header.Size(m) } func (m *Header) XXX_DiscardUnknown() { xxx_messageInfo_Header.DiscardUnknown(m) @@ -226,35 +209,30 @@ func (m *Header) GetSignature() []byte { } type Block struct { - Header *Header `protobuf:"bytes,1,opt,name=header" json:"header,omitempty"` - Transactions []*Transaction `protobuf:"bytes,2,rep,name=transactions" json:"transactions,omitempty"` + Header *Header `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"` + Transactions []*Transaction `protobuf:"bytes,2,rep,name=transactions,proto3" json:"transactions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Block) Reset() { *m = Block{} } -func (*Block) ProtoMessage() {} +func (m *Block) Reset() { *m = Block{} } +func (m *Block) String() string { return proto.CompactTextString(m) } +func (*Block) ProtoMessage() {} func (*Block) Descriptor() ([]byte, []int) { - return fileDescriptor_block_3db5cb9d430df00f, []int{2} + return fileDescriptor_block_623cc3ece9da7f8b, []int{2} } func (m *Block) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Block.Unmarshal(m, b) } func (m *Block) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Block.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Block.Marshal(b, m, deterministic) } func (dst *Block) XXX_Merge(src proto.Message) { xxx_messageInfo_Block.Merge(dst, src) } func (m *Block) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Block.Size(m) } func (m *Block) XXX_DiscardUnknown() { xxx_messageInfo_Block.DiscardUnknown(m) @@ -282,1357 +260,36 @@ func init() { proto.RegisterType((*Block)(nil), "pb.Block") proto.RegisterEnum("pb.WinnerType", WinnerType_name, WinnerType_value) } -func (x WinnerType) String() string { - s, ok := WinnerType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *UnsignedHeader) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UnsignedHeader) - if !ok { - that2, ok := that.(UnsignedHeader) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Version != that1.Version { - return false - } - if !bytes.Equal(this.PrevBlockHash, that1.PrevBlockHash) { - return false - } - if !bytes.Equal(this.TransactionsRoot, that1.TransactionsRoot) { - return false - } - if !bytes.Equal(this.StateRoot, that1.StateRoot) { - return false - } - if this.Timestamp != that1.Timestamp { - return false - } - if this.Height != that1.Height { - return false - } - if !bytes.Equal(this.RandomBeacon, that1.RandomBeacon) { - return false - } - if !bytes.Equal(this.WinnerHash, that1.WinnerHash) { - return false - } - if this.WinnerType != that1.WinnerType { - return false - } - if !bytes.Equal(this.SignerPk, that1.SignerPk) { - return false - } - if !bytes.Equal(this.SignerId, that1.SignerId) { - return false - } - return true -} -func (this *Header) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Header) - if !ok { - that2, ok := that.(Header) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.UnsignedHeader.Equal(that1.UnsignedHeader) { - return false - } - if !bytes.Equal(this.Signature, that1.Signature) { - return false - } - return true -} -func (this *Block) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Block) - if !ok { - that2, ok := that.(Block) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Header.Equal(that1.Header) { - return false - } - if len(this.Transactions) != len(that1.Transactions) { - return false - } - for i := range this.Transactions { - if !this.Transactions[i].Equal(that1.Transactions[i]) { - return false - } - } - return true -} -func (this *UnsignedHeader) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 15) - s = append(s, "&pb.UnsignedHeader{") - s = append(s, "Version: "+fmt.Sprintf("%#v", this.Version)+",\n") - s = append(s, "PrevBlockHash: "+fmt.Sprintf("%#v", this.PrevBlockHash)+",\n") - s = append(s, "TransactionsRoot: "+fmt.Sprintf("%#v", this.TransactionsRoot)+",\n") - s = append(s, "StateRoot: "+fmt.Sprintf("%#v", this.StateRoot)+",\n") - s = append(s, "Timestamp: "+fmt.Sprintf("%#v", this.Timestamp)+",\n") - s = append(s, "Height: "+fmt.Sprintf("%#v", this.Height)+",\n") - s = append(s, "RandomBeacon: "+fmt.Sprintf("%#v", this.RandomBeacon)+",\n") - s = append(s, "WinnerHash: "+fmt.Sprintf("%#v", this.WinnerHash)+",\n") - s = append(s, "WinnerType: "+fmt.Sprintf("%#v", this.WinnerType)+",\n") - s = append(s, "SignerPk: "+fmt.Sprintf("%#v", this.SignerPk)+",\n") - s = append(s, "SignerId: "+fmt.Sprintf("%#v", this.SignerId)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Header) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Header{") - if this.UnsignedHeader != nil { - s = append(s, "UnsignedHeader: "+fmt.Sprintf("%#v", this.UnsignedHeader)+",\n") - } - s = append(s, "Signature: "+fmt.Sprintf("%#v", this.Signature)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Block) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Block{") - if this.Header != nil { - s = append(s, "Header: "+fmt.Sprintf("%#v", this.Header)+",\n") - } - if this.Transactions != nil { - s = append(s, "Transactions: "+fmt.Sprintf("%#v", this.Transactions)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringBlock(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *UnsignedHeader) 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 *UnsignedHeader) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Version != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintBlock(dAtA, i, uint64(m.Version)) - } - if len(m.PrevBlockHash) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.PrevBlockHash))) - i += copy(dAtA[i:], m.PrevBlockHash) - } - if len(m.TransactionsRoot) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.TransactionsRoot))) - i += copy(dAtA[i:], m.TransactionsRoot) - } - if len(m.StateRoot) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.StateRoot))) - i += copy(dAtA[i:], m.StateRoot) - } - if m.Timestamp != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintBlock(dAtA, i, uint64(m.Timestamp)) - } - if m.Height != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintBlock(dAtA, i, uint64(m.Height)) - } - if len(m.RandomBeacon) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.RandomBeacon))) - i += copy(dAtA[i:], m.RandomBeacon) - } - if len(m.WinnerHash) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.WinnerHash))) - i += copy(dAtA[i:], m.WinnerHash) - } - if m.WinnerType != 0 { - dAtA[i] = 0x48 - i++ - i = encodeVarintBlock(dAtA, i, uint64(m.WinnerType)) - } - if len(m.SignerPk) > 0 { - dAtA[i] = 0x52 - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.SignerPk))) - i += copy(dAtA[i:], m.SignerPk) - } - if len(m.SignerId) > 0 { - dAtA[i] = 0x5a - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.SignerId))) - i += copy(dAtA[i:], m.SignerId) - } - return i, nil -} - -func (m *Header) 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 *Header) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.UnsignedHeader != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintBlock(dAtA, i, uint64(m.UnsignedHeader.Size())) - n1, err := m.UnsignedHeader.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.Signature) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintBlock(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - return i, nil -} - -func (m *Block) 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 *Block) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Header != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintBlock(dAtA, i, uint64(m.Header.Size())) - n2, err := m.Header.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if len(m.Transactions) > 0 { - for _, msg := range m.Transactions { - dAtA[i] = 0x12 - i++ - i = encodeVarintBlock(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func encodeVarintBlock(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 NewPopulatedUnsignedHeader(r randyBlock, easy bool) *UnsignedHeader { - this := &UnsignedHeader{} - this.Version = uint32(r.Uint32()) - v1 := r.Intn(100) - this.PrevBlockHash = make([]byte, v1) - for i := 0; i < v1; i++ { - this.PrevBlockHash[i] = byte(r.Intn(256)) - } - v2 := r.Intn(100) - this.TransactionsRoot = make([]byte, v2) - for i := 0; i < v2; i++ { - this.TransactionsRoot[i] = byte(r.Intn(256)) - } - v3 := r.Intn(100) - this.StateRoot = make([]byte, v3) - for i := 0; i < v3; i++ { - this.StateRoot[i] = byte(r.Intn(256)) - } - this.Timestamp = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Timestamp *= -1 - } - this.Height = uint32(r.Uint32()) - v4 := r.Intn(100) - this.RandomBeacon = make([]byte, v4) - for i := 0; i < v4; i++ { - this.RandomBeacon[i] = byte(r.Intn(256)) - } - v5 := r.Intn(100) - this.WinnerHash = make([]byte, v5) - for i := 0; i < v5; i++ { - this.WinnerHash[i] = byte(r.Intn(256)) - } - this.WinnerType = WinnerType([]int32{0, 1, 2}[r.Intn(3)]) - v6 := r.Intn(100) - this.SignerPk = make([]byte, v6) - for i := 0; i < v6; i++ { - this.SignerPk[i] = byte(r.Intn(256)) - } - v7 := r.Intn(100) - this.SignerId = make([]byte, v7) - for i := 0; i < v7; i++ { - this.SignerId[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedHeader(r randyBlock, easy bool) *Header { - this := &Header{} - if r.Intn(10) != 0 { - this.UnsignedHeader = NewPopulatedUnsignedHeader(r, easy) - } - v8 := r.Intn(100) - this.Signature = make([]byte, v8) - for i := 0; i < v8; i++ { - this.Signature[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedBlock(r randyBlock, easy bool) *Block { - this := &Block{} - if r.Intn(10) != 0 { - this.Header = NewPopulatedHeader(r, easy) - } - if r.Intn(10) != 0 { - v9 := r.Intn(5) - this.Transactions = make([]*Transaction, v9) - for i := 0; i < v9; i++ { - this.Transactions[i] = NewPopulatedTransaction(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyBlock interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneBlock(r randyBlock) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringBlock(r randyBlock) string { - v10 := r.Intn(100) - tmps := make([]rune, v10) - for i := 0; i < v10; i++ { - tmps[i] = randUTF8RuneBlock(r) - } - return string(tmps) -} -func randUnrecognizedBlock(r randyBlock, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldBlock(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldBlock(dAtA []byte, r randyBlock, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateBlock(dAtA, uint64(key)) - v11 := r.Int63() - if r.Intn(2) == 0 { - v11 *= -1 - } - dAtA = encodeVarintPopulateBlock(dAtA, uint64(v11)) - case 1: - dAtA = encodeVarintPopulateBlock(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateBlock(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateBlock(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateBlock(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateBlock(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *UnsignedHeader) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Version != 0 { - n += 1 + sovBlock(uint64(m.Version)) - } - l = len(m.PrevBlockHash) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - l = len(m.TransactionsRoot) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - l = len(m.StateRoot) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - if m.Timestamp != 0 { - n += 1 + sovBlock(uint64(m.Timestamp)) - } - if m.Height != 0 { - n += 1 + sovBlock(uint64(m.Height)) - } - l = len(m.RandomBeacon) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - l = len(m.WinnerHash) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - if m.WinnerType != 0 { - n += 1 + sovBlock(uint64(m.WinnerType)) - } - l = len(m.SignerPk) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - l = len(m.SignerId) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - return n -} - -func (m *Header) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnsignedHeader != nil { - l = m.UnsignedHeader.Size() - n += 1 + l + sovBlock(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovBlock(uint64(l)) - } - return n -} - -func (m *Block) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Header != nil { - l = m.Header.Size() - n += 1 + l + sovBlock(uint64(l)) - } - if len(m.Transactions) > 0 { - for _, e := range m.Transactions { - l = e.Size() - n += 1 + l + sovBlock(uint64(l)) - } - } - return n -} - -func sovBlock(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozBlock(x uint64) (n int) { - return sovBlock(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *UnsignedHeader) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&UnsignedHeader{`, - `Version:` + fmt.Sprintf("%v", this.Version) + `,`, - `PrevBlockHash:` + fmt.Sprintf("%v", this.PrevBlockHash) + `,`, - `TransactionsRoot:` + fmt.Sprintf("%v", this.TransactionsRoot) + `,`, - `StateRoot:` + fmt.Sprintf("%v", this.StateRoot) + `,`, - `Timestamp:` + fmt.Sprintf("%v", this.Timestamp) + `,`, - `Height:` + fmt.Sprintf("%v", this.Height) + `,`, - `RandomBeacon:` + fmt.Sprintf("%v", this.RandomBeacon) + `,`, - `WinnerHash:` + fmt.Sprintf("%v", this.WinnerHash) + `,`, - `WinnerType:` + fmt.Sprintf("%v", this.WinnerType) + `,`, - `SignerPk:` + fmt.Sprintf("%v", this.SignerPk) + `,`, - `SignerId:` + fmt.Sprintf("%v", this.SignerId) + `,`, - `}`, - }, "") - return s -} -func (this *Header) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Header{`, - `UnsignedHeader:` + strings.Replace(fmt.Sprintf("%v", this.UnsignedHeader), "UnsignedHeader", "UnsignedHeader", 1) + `,`, - `Signature:` + fmt.Sprintf("%v", this.Signature) + `,`, - `}`, - }, "") - return s -} -func (this *Block) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Block{`, - `Header:` + strings.Replace(fmt.Sprintf("%v", this.Header), "Header", "Header", 1) + `,`, - `Transactions:` + strings.Replace(fmt.Sprintf("%v", this.Transactions), "Transaction", "Transaction", 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringBlock(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *UnsignedHeader) 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 ErrIntOverflowBlock - } - 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: UnsignedHeader: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnsignedHeader: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Version", wireType) - } - m.Version = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Version |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevBlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevBlockHash = append(m.PrevBlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.PrevBlockHash == nil { - m.PrevBlockHash = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionsRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransactionsRoot = append(m.TransactionsRoot[:0], dAtA[iNdEx:postIndex]...) - if m.TransactionsRoot == nil { - m.TransactionsRoot = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field StateRoot", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.StateRoot = append(m.StateRoot[:0], dAtA[iNdEx:postIndex]...) - if m.StateRoot == nil { - m.StateRoot = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Timestamp", wireType) - } - m.Timestamp = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Timestamp |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field RandomBeacon", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.RandomBeacon = append(m.RandomBeacon[:0], dAtA[iNdEx:postIndex]...) - if m.RandomBeacon == nil { - m.RandomBeacon = []byte{} - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field WinnerHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.WinnerHash = append(m.WinnerHash[:0], dAtA[iNdEx:postIndex]...) - if m.WinnerHash == nil { - m.WinnerHash = []byte{} - } - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WinnerType", wireType) - } - m.WinnerType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.WinnerType |= (WinnerType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 10: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignerPk", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignerPk = append(m.SignerPk[:0], dAtA[iNdEx:postIndex]...) - if m.SignerPk == nil { - m.SignerPk = []byte{} - } - iNdEx = postIndex - case 11: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignerId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignerId = append(m.SignerId[:0], dAtA[iNdEx:postIndex]...) - if m.SignerId == nil { - m.SignerId = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBlock(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthBlock - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Header) 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 ErrIntOverflowBlock - } - 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: Header: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Header: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnsignedHeader", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.UnsignedHeader == nil { - m.UnsignedHeader = &UnsignedHeader{} - } - if err := m.UnsignedHeader.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 byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBlock(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthBlock - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Block) 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 ErrIntOverflowBlock - } - 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: Block: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Block: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Header", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Header == nil { - m.Header = &Header{} - } - if err := m.Header.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowBlock - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthBlock - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Transactions = append(m.Transactions, &Transaction{}) - if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipBlock(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthBlock - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipBlock(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, ErrIntOverflowBlock - } - 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, ErrIntOverflowBlock - } - 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, ErrIntOverflowBlock - } - 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, ErrInvalidLengthBlock - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowBlock - } - 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 := skipBlock(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 ( - ErrInvalidLengthBlock = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowBlock = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("pb/block.proto", fileDescriptor_block_3db5cb9d430df00f) } -var fileDescriptor_block_3db5cb9d430df00f = []byte{ - // 520 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0xc1, 0x8f, 0xd2, 0x4e, - 0x14, 0xc7, 0x3b, 0xf0, 0x5b, 0x76, 0x79, 0x40, 0xe1, 0x37, 0x31, 0x66, 0xb2, 0xae, 0x23, 0xc1, - 0xc4, 0x10, 0x8d, 0x90, 0xb0, 0x47, 0x3d, 0x61, 0xc8, 0x2e, 0xd1, 0xa0, 0x29, 0x18, 0xbd, 0xd5, - 0x16, 0x46, 0xda, 0x20, 0x9d, 0x66, 0x3a, 0xac, 0xd9, 0x9b, 0x17, 0xef, 0xfe, 0x19, 0xfe, 0x09, - 0xfe, 0x09, 0x1e, 0x39, 0xee, 0x51, 0xca, 0xc5, 0xe3, 0x1e, 0x3d, 0x9a, 0xbe, 0x16, 0x29, 0xb7, - 0xbe, 0xcf, 0xf7, 0x3b, 0xef, 0xcd, 0xbc, 0x6f, 0xc1, 0x0c, 0xdd, 0xae, 0xfb, 0x49, 0x4e, 0x17, - 0x9d, 0x50, 0x49, 0x2d, 0x69, 0x21, 0x74, 0x4f, 0x9f, 0xce, 0x7d, 0xed, 0xad, 0xdc, 0xce, 0x54, - 0x2e, 0xbb, 0x73, 0x39, 0x97, 0x5d, 0x94, 0xdc, 0xd5, 0x47, 0xac, 0xb0, 0xc0, 0xaf, 0xf4, 0xc8, - 0xe9, 0x9d, 0xd0, 0xed, 0x6a, 0xe5, 0x04, 0x91, 0x33, 0xd5, 0xbe, 0x0c, 0x52, 0xda, 0xfa, 0x5a, - 0x04, 0xf3, 0x6d, 0x10, 0xf9, 0xf3, 0x40, 0xcc, 0x2e, 0x85, 0x33, 0x13, 0x8a, 0x32, 0x38, 0xbe, - 0x12, 0x2a, 0xf2, 0x65, 0xc0, 0x48, 0x93, 0xb4, 0x6b, 0xd6, 0xae, 0xa4, 0x8f, 0xa0, 0x1e, 0x2a, - 0x71, 0x65, 0xe3, 0x4d, 0x6c, 0xcf, 0x89, 0x3c, 0x56, 0x68, 0x92, 0x76, 0xd5, 0xaa, 0x25, 0xb8, - 0x9f, 0xd0, 0x4b, 0x27, 0xf2, 0xe8, 0x13, 0xf8, 0x3f, 0x37, 0x29, 0xb2, 0x95, 0x94, 0x9a, 0x15, - 0xd1, 0xd9, 0xc8, 0x0b, 0x96, 0x94, 0x9a, 0xde, 0x07, 0x88, 0xb4, 0xa3, 0x45, 0xea, 0xfa, 0x0f, - 0x5d, 0x65, 0x24, 0x28, 0x9f, 0x41, 0x59, 0xfb, 0x4b, 0x11, 0x69, 0x67, 0x19, 0xb2, 0xa3, 0x26, - 0x69, 0x17, 0xad, 0x3d, 0xa0, 0x77, 0xa1, 0xe4, 0x09, 0x7f, 0xee, 0x69, 0x56, 0xc2, 0xab, 0x66, - 0x15, 0x7d, 0x08, 0x35, 0xe5, 0x04, 0x33, 0xb9, 0xb4, 0x5d, 0xe1, 0x4c, 0x65, 0xc0, 0x8e, 0xb1, - 0x6f, 0x35, 0x85, 0x7d, 0x64, 0xf4, 0x01, 0x54, 0x3e, 0xfb, 0x41, 0x20, 0x54, 0xfa, 0x94, 0x13, - 0xb4, 0x40, 0x8a, 0xf0, 0x1d, 0xdd, 0x7f, 0x06, 0x7d, 0x1d, 0x0a, 0x56, 0x6e, 0x92, 0xb6, 0xd9, - 0x33, 0x3b, 0xa1, 0xdb, 0x79, 0x87, 0x78, 0x72, 0x1d, 0x8a, 0xdd, 0x81, 0xe4, 0x9b, 0xde, 0x83, - 0x32, 0xae, 0x52, 0xd9, 0xe1, 0x82, 0x01, 0xf6, 0x3b, 0x49, 0xc1, 0x9b, 0x45, 0x4e, 0xf4, 0x67, - 0xac, 0x92, 0x17, 0x87, 0xb3, 0xd6, 0x14, 0x4a, 0xd9, 0xfa, 0x9f, 0x41, 0x7d, 0x95, 0x05, 0x62, - 0x7b, 0x88, 0x30, 0x86, 0x4a, 0x8f, 0x26, 0x83, 0x0f, 0xb3, 0xb2, 0xcc, 0xd5, 0x61, 0x76, 0x67, - 0xe9, 0x0c, 0x47, 0xaf, 0x94, 0xc8, 0xb2, 0xd9, 0x83, 0xd6, 0x07, 0x38, 0xc2, 0x90, 0x68, 0x2b, - 0x59, 0x5b, 0xae, 0x35, 0x24, 0xad, 0xb3, 0x96, 0x99, 0x42, 0xcf, 0xa1, 0x9a, 0xcf, 0x8a, 0x15, - 0x9a, 0xc5, 0x76, 0xa5, 0x57, 0x4f, 0x9c, 0x93, 0x3d, 0xb7, 0x0e, 0x4c, 0x8f, 0xfb, 0x00, 0xfb, - 0xd5, 0x50, 0x0a, 0xe6, 0xc5, 0x60, 0x34, 0x18, 0x0f, 0xc7, 0xf6, 0x78, 0x78, 0x31, 0x1a, 0x58, - 0x0d, 0x83, 0x9a, 0x00, 0x93, 0xf7, 0xa3, 0x5d, 0x4d, 0x68, 0x03, 0xaa, 0xfd, 0x57, 0xaf, 0x5f, - 0xbc, 0xdc, 0x91, 0x42, 0xff, 0xf9, 0x7a, 0xc3, 0x8d, 0x9b, 0x0d, 0x37, 0x6e, 0x37, 0x9c, 0xfc, - 0xd9, 0x70, 0xf2, 0x25, 0xe6, 0xe4, 0x7b, 0xcc, 0xc9, 0x8f, 0x98, 0x93, 0x9f, 0x31, 0x27, 0xeb, - 0x98, 0x93, 0x5f, 0x31, 0x27, 0xbf, 0x63, 0x6e, 0xdc, 0xc6, 0x9c, 0x7c, 0xdb, 0x72, 0x63, 0xbd, - 0xe5, 0xc6, 0xcd, 0x96, 0x1b, 0x6e, 0x09, 0xff, 0xeb, 0xf3, 0xbf, 0x01, 0x00, 0x00, 0xff, 0xff, - 0x2e, 0xe8, 0xa6, 0xfa, 0x32, 0x03, 0x00, 0x00, +func init() { proto.RegisterFile("pb/block.proto", fileDescriptor_block_623cc3ece9da7f8b) } + +var fileDescriptor_block_623cc3ece9da7f8b = []byte{ + // 421 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x92, 0x51, 0x8b, 0xd3, 0x40, + 0x14, 0x85, 0x4d, 0xeb, 0x76, 0xb7, 0xb7, 0x6d, 0x5a, 0x2f, 0x22, 0x83, 0xae, 0x18, 0x2a, 0x48, + 0x50, 0x68, 0xa1, 0xfb, 0xe8, 0x5b, 0xa5, 0xec, 0x16, 0xa5, 0x4a, 0x5a, 0xd1, 0xb7, 0x38, 0x69, + 0x86, 0x4d, 0xa8, 0x9d, 0x19, 0x66, 0xa6, 0x2b, 0xfb, 0x03, 0xfc, 0xdf, 0x92, 0x9b, 0xc4, 0xa4, + 0x6f, 0x99, 0xef, 0x9c, 0x9c, 0x9b, 0xb9, 0x27, 0xe0, 0xeb, 0x64, 0x9e, 0xfc, 0x56, 0xfb, 0xc3, + 0x4c, 0x1b, 0xe5, 0x14, 0x76, 0x74, 0xf2, 0xf2, 0xb9, 0x4e, 0xe6, 0xce, 0x70, 0x69, 0xf9, 0xde, + 0xe5, 0x4a, 0x96, 0xca, 0xf4, 0x6f, 0x17, 0xfc, 0xef, 0xd2, 0xe6, 0xf7, 0x52, 0xa4, 0x77, 0x82, + 0xa7, 0xc2, 0x20, 0x83, 0xcb, 0x07, 0x61, 0x6c, 0xae, 0x24, 0xf3, 0x02, 0x2f, 0x1c, 0x45, 0xf5, + 0x11, 0xdf, 0xc1, 0x58, 0x1b, 0xf1, 0x10, 0x53, 0x74, 0x9c, 0x71, 0x9b, 0xb1, 0x4e, 0xe0, 0x85, + 0xc3, 0x68, 0x54, 0xe0, 0x65, 0x41, 0xef, 0xb8, 0xcd, 0xf0, 0x03, 0x3c, 0x6b, 0x4d, 0xb2, 0xb1, + 0x51, 0xca, 0xb1, 0x2e, 0x39, 0x27, 0x6d, 0x21, 0x52, 0xca, 0xe1, 0x6b, 0x00, 0xeb, 0xb8, 0x13, + 0xa5, 0xeb, 0x29, 0xb9, 0xfa, 0x44, 0x48, 0xbe, 0x86, 0xbe, 0xcb, 0x8f, 0xc2, 0x3a, 0x7e, 0xd4, + 0xec, 0x22, 0xf0, 0xc2, 0x6e, 0xd4, 0x00, 0x7c, 0x01, 0xbd, 0x4c, 0xe4, 0xf7, 0x99, 0x63, 0x3d, + 0xfa, 0xd4, 0xea, 0x84, 0x6f, 0x61, 0x64, 0xb8, 0x4c, 0xd5, 0x31, 0x4e, 0x04, 0xdf, 0x2b, 0xc9, + 0x2e, 0x29, 0x77, 0x58, 0xc2, 0x25, 0x31, 0x7c, 0x03, 0x83, 0x3f, 0xb9, 0x94, 0xc2, 0x94, 0x57, + 0xb9, 0x22, 0x0b, 0x94, 0x88, 0xee, 0x31, 0xff, 0x6f, 0x70, 0x8f, 0x5a, 0xb0, 0x7e, 0xe0, 0x85, + 0xfe, 0xc2, 0x9f, 0xe9, 0x64, 0xf6, 0x83, 0xf0, 0xee, 0x51, 0x8b, 0xfa, 0x85, 0xe2, 0x19, 0x5f, + 0x41, 0x9f, 0x56, 0x69, 0x62, 0x7d, 0x60, 0x40, 0x79, 0x57, 0x25, 0xf8, 0x76, 0x68, 0x89, 0x79, + 0xca, 0x06, 0x6d, 0x71, 0x9d, 0x4e, 0xf7, 0xd0, 0xab, 0xd6, 0xff, 0x11, 0xc6, 0xa7, 0xaa, 0x90, + 0x38, 0x23, 0x44, 0x35, 0x0c, 0x16, 0x58, 0x0c, 0x3e, 0xef, 0x2a, 0xf2, 0x4f, 0xe7, 0xdd, 0x5d, + 0x97, 0x33, 0xb8, 0x3b, 0x19, 0x51, 0x75, 0xd3, 0x80, 0xe9, 0x2f, 0xb8, 0xa0, 0x92, 0x70, 0x5a, + 0xac, 0xad, 0x15, 0x0d, 0x45, 0x74, 0x15, 0x59, 0x29, 0x78, 0x03, 0xc3, 0x76, 0x57, 0xac, 0x13, + 0x74, 0xc3, 0xc1, 0x62, 0x5c, 0x38, 0x77, 0x0d, 0x8f, 0xce, 0x4c, 0xef, 0x97, 0x00, 0xcd, 0x6a, + 0x10, 0xc1, 0xbf, 0x5d, 0x6d, 0x56, 0xdb, 0xf5, 0x36, 0xde, 0xae, 0x6f, 0x37, 0xab, 0x68, 0xf2, + 0x04, 0x7d, 0x80, 0xdd, 0xcf, 0x4d, 0x7d, 0xf6, 0x70, 0x02, 0xc3, 0xe5, 0x97, 0xaf, 0x9f, 0x3e, + 0xd7, 0xa4, 0x93, 0xf4, 0xe8, 0xcf, 0xbc, 0xf9, 0x17, 0x00, 0x00, 0xff, 0xff, 0x1e, 0x49, 0x85, + 0xf0, 0xc5, 0x02, 0x00, 0x00, } diff --git a/pb/block.proto b/pb/block.proto index 28a440127..90909cf6e 100644 --- a/pb/block.proto +++ b/pb/block.proto @@ -2,20 +2,8 @@ syntax = "proto3"; package pb; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "pb/transaction.proto"; -option (gogoproto.gostring_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option (gogoproto.testgen_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.populate_all) = true; - enum WinnerType { GENESIS_SIGNER = 0; TXN_SIGNER = 1; diff --git a/pb/blockpb_test.go b/pb/blockpb_test.go deleted file mode 100644 index 39f5f2e0a..000000000 --- a/pb/blockpb_test.go +++ /dev/null @@ -1,461 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb/block.proto - -package pb - -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import fmt "fmt" -import go_parser "go/parser" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestUnsignedHeaderProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedHeader(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedHeader{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestUnsignedHeaderMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedHeader(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedHeader{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestHeaderProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedHeader(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Header{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestHeaderMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedHeader(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Header{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBlockProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBlock(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Block{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestBlockMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBlock(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Block{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedHeaderJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedHeader(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedHeader{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestHeaderJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedHeader(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Header{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestBlockJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBlock(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Block{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestUnsignedHeaderProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedHeader(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &UnsignedHeader{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedHeaderProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedHeader(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &UnsignedHeader{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestHeaderProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedHeader(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Header{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestHeaderProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedHeader(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Header{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBlockProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBlock(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Block{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBlockProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBlock(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Block{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedHeaderGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsignedHeader(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestHeaderGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedHeader(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestBlockGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedBlock(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestUnsignedHeaderSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedHeader(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestHeaderSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedHeader(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestBlockSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBlock(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestUnsignedHeaderStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsignedHeader(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestHeaderStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedHeader(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestBlockStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedBlock(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/pb/clientmessage.pb.go b/pb/clientmessage.pb.go index b1f4c5be8..04853d796 100644 --- a/pb/clientmessage.pb.go +++ b/pb/clientmessage.pb.go @@ -1,21 +1,11 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: pb/clientmessage.proto package pb -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strconv "strconv" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -26,14 +16,14 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type ClientMessageType int32 const ( - OUTBOUND_MESSAGE ClientMessageType = 0 - INBOUND_MESSAGE ClientMessageType = 1 - RECEIPT ClientMessageType = 2 + ClientMessageType_OUTBOUND_MESSAGE ClientMessageType = 0 + ClientMessageType_INBOUND_MESSAGE ClientMessageType = 1 + ClientMessageType_RECEIPT ClientMessageType = 2 ) var ClientMessageType_name = map[int32]string{ @@ -47,15 +37,18 @@ var ClientMessageType_value = map[string]int32{ "RECEIPT": 2, } +func (x ClientMessageType) String() string { + return proto.EnumName(ClientMessageType_name, int32(x)) +} func (ClientMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_clientmessage_f54769dd684aff8a, []int{0} + return fileDescriptor_clientmessage_46737de2f3be5fed, []int{0} } type CompressionType int32 const ( - COMPRESSION_NONE CompressionType = 0 - COMPRESSION_ZLIB CompressionType = 1 + CompressionType_COMPRESSION_NONE CompressionType = 0 + CompressionType_COMPRESSION_ZLIB CompressionType = 1 ) var CompressionType_name = map[int32]string{ @@ -67,41 +60,39 @@ var CompressionType_value = map[string]int32{ "COMPRESSION_ZLIB": 1, } +func (x CompressionType) String() string { + return proto.EnumName(CompressionType_name, int32(x)) +} func (CompressionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_clientmessage_f54769dd684aff8a, []int{1} + return fileDescriptor_clientmessage_46737de2f3be5fed, []int{1} } type ClientMessage struct { - MessageType ClientMessageType `protobuf:"varint,1,opt,name=message_type,json=messageType,proto3,enum=pb.ClientMessageType" json:"message_type,omitempty"` - Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` - CompressionType CompressionType `protobuf:"varint,3,opt,name=compression_type,json=compressionType,proto3,enum=pb.CompressionType" json:"compression_type,omitempty"` + MessageType ClientMessageType `protobuf:"varint,1,opt,name=message_type,json=messageType,proto3,enum=pb.ClientMessageType" json:"message_type,omitempty"` + Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + CompressionType CompressionType `protobuf:"varint,3,opt,name=compression_type,json=compressionType,proto3,enum=pb.CompressionType" json:"compression_type,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *ClientMessage) Reset() { *m = ClientMessage{} } -func (*ClientMessage) ProtoMessage() {} +func (m *ClientMessage) Reset() { *m = ClientMessage{} } +func (m *ClientMessage) String() string { return proto.CompactTextString(m) } +func (*ClientMessage) ProtoMessage() {} func (*ClientMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_clientmessage_f54769dd684aff8a, []int{0} + return fileDescriptor_clientmessage_46737de2f3be5fed, []int{0} } func (m *ClientMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_ClientMessage.Unmarshal(m, b) } func (m *ClientMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_ClientMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_ClientMessage.Marshal(b, m, deterministic) } func (dst *ClientMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_ClientMessage.Merge(dst, src) } func (m *ClientMessage) XXX_Size() int { - return m.Size() + return xxx_messageInfo_ClientMessage.Size(m) } func (m *ClientMessage) XXX_DiscardUnknown() { xxx_messageInfo_ClientMessage.DiscardUnknown(m) @@ -113,7 +104,7 @@ func (m *ClientMessage) GetMessageType() ClientMessageType { if m != nil { return m.MessageType } - return OUTBOUND_MESSAGE + return ClientMessageType_OUTBOUND_MESSAGE } func (m *ClientMessage) GetMessage() []byte { @@ -127,45 +118,40 @@ func (m *ClientMessage) GetCompressionType() CompressionType { if m != nil { return m.CompressionType } - return COMPRESSION_NONE + return CompressionType_COMPRESSION_NONE } type OutboundMessage struct { - Dest string `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"` - Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - Dests []string `protobuf:"bytes,3,rep,name=dests" json:"dests,omitempty"` - MaxHoldingSeconds uint32 `protobuf:"varint,4,opt,name=max_holding_seconds,json=maxHoldingSeconds,proto3" json:"max_holding_seconds,omitempty"` - Nonce uint32 `protobuf:"varint,5,opt,name=nonce,proto3" json:"nonce,omitempty"` - BlockHash []byte `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - Signatures [][]byte `protobuf:"bytes,7,rep,name=signatures" json:"signatures,omitempty"` - Payloads [][]byte `protobuf:"bytes,8,rep,name=payloads" json:"payloads,omitempty"` -} - -func (m *OutboundMessage) Reset() { *m = OutboundMessage{} } -func (*OutboundMessage) ProtoMessage() {} + Dest string `protobuf:"bytes,1,opt,name=dest,proto3" json:"dest,omitempty"` + Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + Dests []string `protobuf:"bytes,3,rep,name=dests,proto3" json:"dests,omitempty"` + MaxHoldingSeconds uint32 `protobuf:"varint,4,opt,name=max_holding_seconds,json=maxHoldingSeconds,proto3" json:"max_holding_seconds,omitempty"` + Nonce uint32 `protobuf:"varint,5,opt,name=nonce,proto3" json:"nonce,omitempty"` + BlockHash []byte `protobuf:"bytes,6,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Signatures [][]byte `protobuf:"bytes,7,rep,name=signatures,proto3" json:"signatures,omitempty"` + Payloads [][]byte `protobuf:"bytes,8,rep,name=payloads,proto3" json:"payloads,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *OutboundMessage) Reset() { *m = OutboundMessage{} } +func (m *OutboundMessage) String() string { return proto.CompactTextString(m) } +func (*OutboundMessage) ProtoMessage() {} func (*OutboundMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_clientmessage_f54769dd684aff8a, []int{1} + return fileDescriptor_clientmessage_46737de2f3be5fed, []int{1} } func (m *OutboundMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_OutboundMessage.Unmarshal(m, b) } func (m *OutboundMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_OutboundMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_OutboundMessage.Marshal(b, m, deterministic) } func (dst *OutboundMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_OutboundMessage.Merge(dst, src) } func (m *OutboundMessage) XXX_Size() int { - return m.Size() + return xxx_messageInfo_OutboundMessage.Size(m) } func (m *OutboundMessage) XXX_DiscardUnknown() { xxx_messageInfo_OutboundMessage.DiscardUnknown(m) @@ -230,36 +216,31 @@ func (m *OutboundMessage) GetPayloads() [][]byte { } type InboundMessage struct { - Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` - Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` - PrevHash []byte `protobuf:"bytes,3,opt,name=prev_hash,json=prevHash,proto3" json:"prev_hash,omitempty"` + Src string `protobuf:"bytes,1,opt,name=src,proto3" json:"src,omitempty"` + Payload []byte `protobuf:"bytes,2,opt,name=payload,proto3" json:"payload,omitempty"` + PrevHash []byte `protobuf:"bytes,3,opt,name=prev_hash,json=prevHash,proto3" json:"prev_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *InboundMessage) Reset() { *m = InboundMessage{} } -func (*InboundMessage) ProtoMessage() {} +func (m *InboundMessage) Reset() { *m = InboundMessage{} } +func (m *InboundMessage) String() string { return proto.CompactTextString(m) } +func (*InboundMessage) ProtoMessage() {} func (*InboundMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_clientmessage_f54769dd684aff8a, []int{2} + return fileDescriptor_clientmessage_46737de2f3be5fed, []int{2} } func (m *InboundMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_InboundMessage.Unmarshal(m, b) } func (m *InboundMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_InboundMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_InboundMessage.Marshal(b, m, deterministic) } func (dst *InboundMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_InboundMessage.Merge(dst, src) } func (m *InboundMessage) XXX_Size() int { - return m.Size() + return xxx_messageInfo_InboundMessage.Size(m) } func (m *InboundMessage) XXX_DiscardUnknown() { xxx_messageInfo_InboundMessage.DiscardUnknown(m) @@ -289,35 +270,30 @@ func (m *InboundMessage) GetPrevHash() []byte { } type Receipt struct { - PrevHash []byte `protobuf:"bytes,1,opt,name=prev_hash,json=prevHash,proto3" json:"prev_hash,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + PrevHash []byte `protobuf:"bytes,1,opt,name=prev_hash,json=prevHash,proto3" json:"prev_hash,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Receipt) Reset() { *m = Receipt{} } -func (*Receipt) ProtoMessage() {} +func (m *Receipt) Reset() { *m = Receipt{} } +func (m *Receipt) String() string { return proto.CompactTextString(m) } +func (*Receipt) ProtoMessage() {} func (*Receipt) Descriptor() ([]byte, []int) { - return fileDescriptor_clientmessage_f54769dd684aff8a, []int{3} + return fileDescriptor_clientmessage_46737de2f3be5fed, []int{3} } func (m *Receipt) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Receipt.Unmarshal(m, b) } func (m *Receipt) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Receipt.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Receipt.Marshal(b, m, deterministic) } func (dst *Receipt) XXX_Merge(src proto.Message) { xxx_messageInfo_Receipt.Merge(dst, src) } func (m *Receipt) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Receipt.Size(m) } func (m *Receipt) XXX_DiscardUnknown() { xxx_messageInfo_Receipt.DiscardUnknown(m) @@ -347,1533 +323,39 @@ func init() { proto.RegisterEnum("pb.ClientMessageType", ClientMessageType_name, ClientMessageType_value) proto.RegisterEnum("pb.CompressionType", CompressionType_name, CompressionType_value) } -func (x ClientMessageType) String() string { - s, ok := ClientMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x CompressionType) String() string { - s, ok := CompressionType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *ClientMessage) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*ClientMessage) - if !ok { - that2, ok := that.(ClientMessage) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.MessageType != that1.MessageType { - return false - } - if !bytes.Equal(this.Message, that1.Message) { - return false - } - if this.CompressionType != that1.CompressionType { - return false - } - return true -} -func (this *OutboundMessage) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*OutboundMessage) - if !ok { - that2, ok := that.(OutboundMessage) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Dest != that1.Dest { - return false - } - if !bytes.Equal(this.Payload, that1.Payload) { - return false - } - if len(this.Dests) != len(that1.Dests) { - return false - } - for i := range this.Dests { - if this.Dests[i] != that1.Dests[i] { - return false - } - } - if this.MaxHoldingSeconds != that1.MaxHoldingSeconds { - return false - } - if this.Nonce != that1.Nonce { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - if len(this.Signatures) != len(that1.Signatures) { - return false - } - for i := range this.Signatures { - if !bytes.Equal(this.Signatures[i], that1.Signatures[i]) { - return false - } - } - if len(this.Payloads) != len(that1.Payloads) { - return false - } - for i := range this.Payloads { - if !bytes.Equal(this.Payloads[i], that1.Payloads[i]) { - return false - } - } - return true -} -func (this *InboundMessage) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*InboundMessage) - if !ok { - that2, ok := that.(InboundMessage) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Src != that1.Src { - return false - } - if !bytes.Equal(this.Payload, that1.Payload) { - return false - } - if !bytes.Equal(this.PrevHash, that1.PrevHash) { - return false - } - return true -} -func (this *Receipt) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Receipt) - if !ok { - that2, ok := that.(Receipt) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.PrevHash, that1.PrevHash) { - return false - } - if !bytes.Equal(this.Signature, that1.Signature) { - return false - } - return true -} -func (this *ClientMessage) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.ClientMessage{") - s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") - s = append(s, "Message: "+fmt.Sprintf("%#v", this.Message)+",\n") - s = append(s, "CompressionType: "+fmt.Sprintf("%#v", this.CompressionType)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *OutboundMessage) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 12) - s = append(s, "&pb.OutboundMessage{") - s = append(s, "Dest: "+fmt.Sprintf("%#v", this.Dest)+",\n") - s = append(s, "Payload: "+fmt.Sprintf("%#v", this.Payload)+",\n") - s = append(s, "Dests: "+fmt.Sprintf("%#v", this.Dests)+",\n") - s = append(s, "MaxHoldingSeconds: "+fmt.Sprintf("%#v", this.MaxHoldingSeconds)+",\n") - s = append(s, "Nonce: "+fmt.Sprintf("%#v", this.Nonce)+",\n") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "Signatures: "+fmt.Sprintf("%#v", this.Signatures)+",\n") - s = append(s, "Payloads: "+fmt.Sprintf("%#v", this.Payloads)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *InboundMessage) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.InboundMessage{") - s = append(s, "Src: "+fmt.Sprintf("%#v", this.Src)+",\n") - s = append(s, "Payload: "+fmt.Sprintf("%#v", this.Payload)+",\n") - s = append(s, "PrevHash: "+fmt.Sprintf("%#v", this.PrevHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Receipt) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Receipt{") - s = append(s, "PrevHash: "+fmt.Sprintf("%#v", this.PrevHash)+",\n") - s = append(s, "Signature: "+fmt.Sprintf("%#v", this.Signature)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringClientmessage(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *ClientMessage) 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 *ClientMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.MessageType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(m.MessageType)) - } - if len(m.Message) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } - if m.CompressionType != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(m.CompressionType)) - } - return i, nil -} - -func (m *OutboundMessage) 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 *OutboundMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Dest) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.Dest))) - i += copy(dAtA[i:], m.Dest) - } - if len(m.Payload) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.Payload))) - i += copy(dAtA[i:], m.Payload) - } - if len(m.Dests) > 0 { - for _, s := range m.Dests { - dAtA[i] = 0x1a - i++ - l = len(s) - for l >= 1<<7 { - dAtA[i] = uint8(uint64(l)&0x7f | 0x80) - l >>= 7 - i++ - } - dAtA[i] = uint8(l) - i++ - i += copy(dAtA[i:], s) - } - } - if m.MaxHoldingSeconds != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(m.MaxHoldingSeconds)) - } - if m.Nonce != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(m.Nonce)) - } - if len(m.BlockHash) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - dAtA[i] = 0x3a - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - if len(m.Payloads) > 0 { - for _, b := range m.Payloads { - dAtA[i] = 0x42 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - return i, nil -} - -func (m *InboundMessage) 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 *InboundMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Src) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.Src))) - i += copy(dAtA[i:], m.Src) - } - if len(m.Payload) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.Payload))) - i += copy(dAtA[i:], m.Payload) - } - if len(m.PrevHash) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.PrevHash))) - i += copy(dAtA[i:], m.PrevHash) - } - return i, nil -} - -func (m *Receipt) 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 *Receipt) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.PrevHash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.PrevHash))) - i += copy(dAtA[i:], m.PrevHash) - } - if len(m.Signature) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintClientmessage(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - return i, nil -} - -func encodeVarintClientmessage(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 NewPopulatedClientMessage(r randyClientmessage, easy bool) *ClientMessage { - this := &ClientMessage{} - this.MessageType = ClientMessageType([]int32{0, 1, 2}[r.Intn(3)]) - v1 := r.Intn(100) - this.Message = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Message[i] = byte(r.Intn(256)) - } - this.CompressionType = CompressionType([]int32{0, 1}[r.Intn(2)]) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedOutboundMessage(r randyClientmessage, easy bool) *OutboundMessage { - this := &OutboundMessage{} - this.Dest = string(randStringClientmessage(r)) - v2 := r.Intn(100) - this.Payload = make([]byte, v2) - for i := 0; i < v2; i++ { - this.Payload[i] = byte(r.Intn(256)) - } - v3 := r.Intn(10) - this.Dests = make([]string, v3) - for i := 0; i < v3; i++ { - this.Dests[i] = string(randStringClientmessage(r)) - } - this.MaxHoldingSeconds = uint32(r.Uint32()) - this.Nonce = uint32(r.Uint32()) - v4 := r.Intn(100) - this.BlockHash = make([]byte, v4) - for i := 0; i < v4; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - v5 := r.Intn(10) - this.Signatures = make([][]byte, v5) - for i := 0; i < v5; i++ { - v6 := r.Intn(100) - this.Signatures[i] = make([]byte, v6) - for j := 0; j < v6; j++ { - this.Signatures[i][j] = byte(r.Intn(256)) - } - } - v7 := r.Intn(10) - this.Payloads = make([][]byte, v7) - for i := 0; i < v7; i++ { - v8 := r.Intn(100) - this.Payloads[i] = make([]byte, v8) - for j := 0; j < v8; j++ { - this.Payloads[i][j] = byte(r.Intn(256)) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedInboundMessage(r randyClientmessage, easy bool) *InboundMessage { - this := &InboundMessage{} - this.Src = string(randStringClientmessage(r)) - v9 := r.Intn(100) - this.Payload = make([]byte, v9) - for i := 0; i < v9; i++ { - this.Payload[i] = byte(r.Intn(256)) - } - v10 := r.Intn(100) - this.PrevHash = make([]byte, v10) - for i := 0; i < v10; i++ { - this.PrevHash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedReceipt(r randyClientmessage, easy bool) *Receipt { - this := &Receipt{} - v11 := r.Intn(100) - this.PrevHash = make([]byte, v11) - for i := 0; i < v11; i++ { - this.PrevHash[i] = byte(r.Intn(256)) - } - v12 := r.Intn(100) - this.Signature = make([]byte, v12) - for i := 0; i < v12; i++ { - this.Signature[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyClientmessage interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneClientmessage(r randyClientmessage) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringClientmessage(r randyClientmessage) string { - v13 := r.Intn(100) - tmps := make([]rune, v13) - for i := 0; i < v13; i++ { - tmps[i] = randUTF8RuneClientmessage(r) - } - return string(tmps) -} -func randUnrecognizedClientmessage(r randyClientmessage, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldClientmessage(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldClientmessage(dAtA []byte, r randyClientmessage, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateClientmessage(dAtA, uint64(key)) - v14 := r.Int63() - if r.Intn(2) == 0 { - v14 *= -1 - } - dAtA = encodeVarintPopulateClientmessage(dAtA, uint64(v14)) - case 1: - dAtA = encodeVarintPopulateClientmessage(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateClientmessage(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateClientmessage(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateClientmessage(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateClientmessage(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *ClientMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MessageType != 0 { - n += 1 + sovClientmessage(uint64(m.MessageType)) - } - l = len(m.Message) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - if m.CompressionType != 0 { - n += 1 + sovClientmessage(uint64(m.CompressionType)) - } - return n -} - -func (m *OutboundMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Dest) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - if len(m.Dests) > 0 { - for _, s := range m.Dests { - l = len(s) - n += 1 + l + sovClientmessage(uint64(l)) - } - } - if m.MaxHoldingSeconds != 0 { - n += 1 + sovClientmessage(uint64(m.MaxHoldingSeconds)) - } - if m.Nonce != 0 { - n += 1 + sovClientmessage(uint64(m.Nonce)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - if len(m.Signatures) > 0 { - for _, b := range m.Signatures { - l = len(b) - n += 1 + l + sovClientmessage(uint64(l)) - } - } - if len(m.Payloads) > 0 { - for _, b := range m.Payloads { - l = len(b) - n += 1 + l + sovClientmessage(uint64(l)) - } - } - return n -} - -func (m *InboundMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Src) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - l = len(m.PrevHash) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - return n -} - -func (m *Receipt) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PrevHash) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovClientmessage(uint64(l)) - } - return n -} - -func sovClientmessage(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozClientmessage(x uint64) (n int) { - return sovClientmessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *ClientMessage) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&ClientMessage{`, - `MessageType:` + fmt.Sprintf("%v", this.MessageType) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `CompressionType:` + fmt.Sprintf("%v", this.CompressionType) + `,`, - `}`, - }, "") - return s -} -func (this *OutboundMessage) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&OutboundMessage{`, - `Dest:` + fmt.Sprintf("%v", this.Dest) + `,`, - `Payload:` + fmt.Sprintf("%v", this.Payload) + `,`, - `Dests:` + fmt.Sprintf("%v", this.Dests) + `,`, - `MaxHoldingSeconds:` + fmt.Sprintf("%v", this.MaxHoldingSeconds) + `,`, - `Nonce:` + fmt.Sprintf("%v", this.Nonce) + `,`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `Signatures:` + fmt.Sprintf("%v", this.Signatures) + `,`, - `Payloads:` + fmt.Sprintf("%v", this.Payloads) + `,`, - `}`, - }, "") - return s -} -func (this *InboundMessage) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&InboundMessage{`, - `Src:` + fmt.Sprintf("%v", this.Src) + `,`, - `Payload:` + fmt.Sprintf("%v", this.Payload) + `,`, - `PrevHash:` + fmt.Sprintf("%v", this.PrevHash) + `,`, - `}`, - }, "") - return s -} -func (this *Receipt) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Receipt{`, - `PrevHash:` + fmt.Sprintf("%v", this.PrevHash) + `,`, - `Signature:` + fmt.Sprintf("%v", this.Signature) + `,`, - `}`, - }, "") - return s -} -func valueToStringClientmessage(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *ClientMessage) 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 ErrIntOverflowClientmessage - } - 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: ClientMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: ClientMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageType", wireType) - } - m.MessageType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MessageType |= (ClientMessageType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) - if m.Message == nil { - m.Message = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field CompressionType", wireType) - } - m.CompressionType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.CompressionType |= (CompressionType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipClientmessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthClientmessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *OutboundMessage) 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 ErrIntOverflowClientmessage - } - 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: OutboundMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: OutboundMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dest", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - 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 ErrInvalidLengthClientmessage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Dest = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Dests", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - 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 ErrInvalidLengthClientmessage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Dests = append(m.Dests, string(dAtA[iNdEx:postIndex])) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxHoldingSeconds", wireType) - } - m.MaxHoldingSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxHoldingSeconds |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) - } - m.Nonce = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nonce |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signatures", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signatures = append(m.Signatures, make([]byte, postIndex-iNdEx)) - copy(m.Signatures[len(m.Signatures)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payloads", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payloads = append(m.Payloads, make([]byte, postIndex-iNdEx)) - copy(m.Payloads[len(m.Payloads)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipClientmessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthClientmessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *InboundMessage) 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 ErrIntOverflowClientmessage - } - 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: InboundMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: InboundMessage: 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 stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - 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 ErrInvalidLengthClientmessage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Src = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevHash = append(m.PrevHash[:0], dAtA[iNdEx:postIndex]...) - if m.PrevHash == nil { - m.PrevHash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipClientmessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthClientmessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Receipt) 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 ErrIntOverflowClientmessage - } - 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: Receipt: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Receipt: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PrevHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PrevHash = append(m.PrevHash[:0], dAtA[iNdEx:postIndex]...) - if m.PrevHash == nil { - m.PrevHash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowClientmessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthClientmessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipClientmessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthClientmessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipClientmessage(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, ErrIntOverflowClientmessage - } - 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, ErrIntOverflowClientmessage - } - 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, ErrIntOverflowClientmessage - } - 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, ErrInvalidLengthClientmessage - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowClientmessage - } - 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 := skipClientmessage(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 ( - ErrInvalidLengthClientmessage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowClientmessage = fmt.Errorf("proto: integer overflow") -) func init() { - proto.RegisterFile("pb/clientmessage.proto", fileDescriptor_clientmessage_f54769dd684aff8a) -} - -var fileDescriptor_clientmessage_f54769dd684aff8a = []byte{ - // 538 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x93, 0x31, 0x6f, 0xd3, 0x4e, - 0x18, 0xc6, 0x7d, 0x71, 0xdb, 0x24, 0x6f, 0xd3, 0xc6, 0xbd, 0xf4, 0xff, 0x97, 0x55, 0xe0, 0x14, - 0x65, 0x8a, 0x2a, 0x91, 0x48, 0xb0, 0x30, 0x00, 0x12, 0x49, 0x23, 0x1a, 0x41, 0xe2, 0xca, 0x49, - 0x07, 0x58, 0x2c, 0xdb, 0x39, 0x1c, 0x8b, 0xd8, 0x67, 0xe5, 0x6c, 0xd4, 0x6c, 0x7c, 0x04, 0xbe, - 0x03, 0x0b, 0x1f, 0x81, 0x8f, 0xc0, 0x98, 0xb1, 0x23, 0x71, 0x16, 0xc6, 0x4e, 0x88, 0x11, 0xf9, - 0xec, 0x34, 0xb8, 0x48, 0x6c, 0xf7, 0x3c, 0xcf, 0xeb, 0xdf, 0x3d, 0xaf, 0x74, 0x86, 0xff, 0x03, - 0xab, 0x6d, 0xcf, 0x5c, 0xea, 0x87, 0x1e, 0xe5, 0xdc, 0x74, 0x68, 0x2b, 0x98, 0xb3, 0x90, 0xe1, - 0x42, 0x60, 0x9d, 0x3c, 0x74, 0xdc, 0x70, 0x1a, 0x59, 0x2d, 0x9b, 0x79, 0x6d, 0x87, 0x39, 0xac, - 0x2d, 0x22, 0x2b, 0x7a, 0x27, 0x94, 0x10, 0xe2, 0x94, 0x7e, 0xd2, 0xf8, 0x8c, 0xe0, 0xa0, 0x2b, - 0x50, 0x83, 0x14, 0x85, 0x9f, 0x40, 0x25, 0xa3, 0x1a, 0xe1, 0x22, 0xa0, 0x2a, 0xaa, 0xa3, 0xe6, - 0xe1, 0xa3, 0xff, 0x5a, 0x81, 0xd5, 0xca, 0x0d, 0x8e, 0x17, 0x01, 0xd5, 0xf7, 0xbd, 0xad, 0xc0, - 0x2a, 0x14, 0x33, 0xa9, 0x16, 0xea, 0xa8, 0x59, 0xd1, 0x37, 0x12, 0x3f, 0x07, 0xc5, 0x66, 0x5e, - 0x30, 0xa7, 0x9c, 0xbb, 0xcc, 0x4f, 0xb9, 0xb2, 0xe0, 0xd6, 0x04, 0x77, 0x9b, 0x09, 0x6a, 0xd5, - 0xce, 0x1b, 0x8d, 0x9f, 0x08, 0xaa, 0x5a, 0x14, 0x5a, 0x2c, 0xf2, 0x27, 0x9b, 0x9e, 0x18, 0x76, - 0x26, 0x94, 0x87, 0xa2, 0x5f, 0x59, 0x17, 0xe7, 0xa4, 0x41, 0x60, 0x2e, 0x66, 0xcc, 0x9c, 0x6c, - 0x1a, 0x64, 0x12, 0x1f, 0xc3, 0x6e, 0x32, 0xc1, 0x55, 0xb9, 0x2e, 0x37, 0xcb, 0x7a, 0x2a, 0x70, - 0x0b, 0x6a, 0x9e, 0x79, 0x65, 0x4c, 0xd9, 0x6c, 0xe2, 0xfa, 0x8e, 0xc1, 0xa9, 0xcd, 0xfc, 0x09, - 0x57, 0x77, 0xea, 0xa8, 0x79, 0xa0, 0x1f, 0x79, 0xe6, 0xd5, 0x79, 0x9a, 0x8c, 0xd2, 0x20, 0xa1, - 0xf8, 0xcc, 0xb7, 0xa9, 0xba, 0x2b, 0x26, 0x52, 0x81, 0x1f, 0x00, 0x58, 0x33, 0x66, 0xbf, 0x37, - 0xa6, 0x26, 0x9f, 0xaa, 0x7b, 0xe2, 0xe2, 0xb2, 0x70, 0xce, 0x4d, 0x3e, 0xc5, 0x04, 0x80, 0xbb, - 0x8e, 0x6f, 0x86, 0xd1, 0x9c, 0x72, 0xb5, 0x58, 0x97, 0x9b, 0x15, 0xfd, 0x0f, 0x07, 0x9f, 0x40, - 0x29, 0x6b, 0xc9, 0xd5, 0x92, 0x48, 0x6f, 0x75, 0xe3, 0x0d, 0x1c, 0xf6, 0xfd, 0xdc, 0xda, 0x0a, - 0xc8, 0x7c, 0x6e, 0x67, 0x5b, 0x27, 0xc7, 0x7f, 0x2c, 0x7d, 0x0f, 0xca, 0xc1, 0x9c, 0x7e, 0x48, - 0x7b, 0xc9, 0x22, 0x2b, 0x25, 0x46, 0x52, 0xab, 0x71, 0x06, 0x45, 0x9d, 0xda, 0xd4, 0x0d, 0xc2, - 0xfc, 0x1c, 0xca, 0xcf, 0xe1, 0xfb, 0x50, 0xbe, 0x2d, 0x9b, 0x5d, 0xb0, 0x35, 0x4e, 0x5f, 0xc1, - 0xd1, 0x5f, 0xaf, 0x02, 0x1f, 0x83, 0xa2, 0x5d, 0x8e, 0x3b, 0xda, 0xe5, 0xf0, 0xcc, 0x18, 0xf4, - 0x46, 0xa3, 0x17, 0x2f, 0x7b, 0x8a, 0x84, 0x6b, 0x50, 0xed, 0x0f, 0xf3, 0x26, 0xc2, 0xfb, 0x50, - 0xd4, 0x7b, 0xdd, 0x5e, 0xff, 0x62, 0xac, 0x14, 0x4e, 0x9f, 0x41, 0xf5, 0xce, 0x53, 0x48, 0x50, - 0x5d, 0x6d, 0x70, 0xa1, 0xf7, 0x46, 0xa3, 0xbe, 0x36, 0x34, 0x86, 0xda, 0x30, 0x41, 0xdd, 0x71, - 0xdf, 0xbe, 0xee, 0x77, 0x14, 0xd4, 0x79, 0xba, 0x5c, 0x11, 0xe9, 0x7a, 0x45, 0xa4, 0x9b, 0x15, - 0x41, 0xbf, 0x56, 0x04, 0x7d, 0x8c, 0x09, 0xfa, 0x12, 0x13, 0xf4, 0x35, 0x26, 0xe8, 0x5b, 0x4c, - 0xd0, 0x32, 0x26, 0xe8, 0x7b, 0x4c, 0xd0, 0x8f, 0x98, 0x48, 0x37, 0x31, 0x41, 0x9f, 0xd6, 0x44, - 0x5a, 0xae, 0x89, 0x74, 0xbd, 0x26, 0x92, 0xb5, 0x27, 0x7e, 0x88, 0xc7, 0xbf, 0x03, 0x00, 0x00, - 0xff, 0xff, 0x90, 0xe1, 0x26, 0x87, 0x5d, 0x03, 0x00, 0x00, + proto.RegisterFile("pb/clientmessage.proto", fileDescriptor_clientmessage_46737de2f3be5fed) +} + +var fileDescriptor_clientmessage_46737de2f3be5fed = []byte{ + // 437 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x7c, 0x52, 0x4b, 0x6f, 0xd3, 0x40, + 0x10, 0x66, 0xe3, 0xb6, 0x89, 0xa7, 0x69, 0xe3, 0x6e, 0x0a, 0x5a, 0xf1, 0x92, 0x95, 0x93, 0xd5, + 0x43, 0x90, 0xe0, 0xc2, 0x05, 0x24, 0x9a, 0x5a, 0xd4, 0x82, 0xd8, 0xd5, 0x3a, 0x3d, 0xc0, 0xc5, + 0xf2, 0x63, 0x95, 0x58, 0xc4, 0xbb, 0x2b, 0xaf, 0x83, 0x9a, 0xdf, 0xc3, 0x7f, 0xe4, 0x8c, 0xbc, + 0x76, 0x1a, 0x1c, 0x24, 0x6e, 0xf3, 0x3d, 0xf4, 0xcd, 0x37, 0xd2, 0xc0, 0x33, 0x99, 0xbc, 0x49, + 0xd7, 0x39, 0xe3, 0x55, 0xc1, 0x94, 0x8a, 0x97, 0x6c, 0x2a, 0x4b, 0x51, 0x09, 0xdc, 0x93, 0xc9, + 0xe4, 0x17, 0x82, 0xb3, 0x99, 0xd6, 0xe6, 0x8d, 0x86, 0xdf, 0xc3, 0xb0, 0xb5, 0x45, 0xd5, 0x56, + 0x32, 0x82, 0x6c, 0xe4, 0x9c, 0xbf, 0x7d, 0x3a, 0x95, 0xc9, 0xb4, 0x63, 0x5c, 0x6c, 0x25, 0xa3, + 0xa7, 0xc5, 0x1e, 0x60, 0x02, 0xfd, 0x16, 0x92, 0x9e, 0x8d, 0x9c, 0x21, 0xdd, 0x41, 0xfc, 0x11, + 0xac, 0x54, 0x14, 0xb2, 0x64, 0x4a, 0xe5, 0x82, 0x37, 0xb9, 0x86, 0xce, 0x1d, 0xeb, 0xdc, 0xbd, + 0xa6, 0x53, 0x47, 0x69, 0x97, 0x98, 0xfc, 0x46, 0x30, 0x0a, 0x36, 0x55, 0x22, 0x36, 0x3c, 0xdb, + 0xf5, 0xc4, 0x70, 0x94, 0x31, 0x55, 0xe9, 0x7e, 0x26, 0xd5, 0x73, 0xdd, 0x40, 0xc6, 0xdb, 0xb5, + 0x88, 0xb3, 0x5d, 0x83, 0x16, 0xe2, 0x4b, 0x38, 0xae, 0x1d, 0x8a, 0x18, 0xb6, 0xe1, 0x98, 0xb4, + 0x01, 0x78, 0x0a, 0xe3, 0x22, 0x7e, 0x88, 0x56, 0x62, 0x9d, 0xe5, 0x7c, 0x19, 0x29, 0x96, 0x0a, + 0x9e, 0x29, 0x72, 0x64, 0x23, 0xe7, 0x8c, 0x5e, 0x14, 0xf1, 0xc3, 0x6d, 0xa3, 0x84, 0x8d, 0x50, + 0xa7, 0x70, 0xc1, 0x53, 0x46, 0x8e, 0xb5, 0xa3, 0x01, 0xf8, 0x15, 0x40, 0xb2, 0x16, 0xe9, 0x8f, + 0x68, 0x15, 0xab, 0x15, 0x39, 0xd1, 0x8b, 0x4d, 0xcd, 0xdc, 0xc6, 0x6a, 0x85, 0x5f, 0x03, 0xa8, + 0x7c, 0xc9, 0xe3, 0x6a, 0x53, 0x32, 0x45, 0xfa, 0xb6, 0xe1, 0x0c, 0xe9, 0x5f, 0x0c, 0x7e, 0x0e, + 0x83, 0xb6, 0xa5, 0x22, 0x03, 0xad, 0x3e, 0xe2, 0xc9, 0x37, 0x38, 0xf7, 0x78, 0xe7, 0x6c, 0x0b, + 0x0c, 0x55, 0xa6, 0xed, 0xd5, 0xf5, 0xf8, 0x9f, 0xa3, 0x5f, 0x80, 0x29, 0x4b, 0xf6, 0xb3, 0xe9, + 0x65, 0x68, 0x6d, 0x50, 0x13, 0x75, 0xad, 0xc9, 0x0d, 0xf4, 0x29, 0x4b, 0x59, 0x2e, 0xab, 0xae, + 0x0f, 0x75, 0x7d, 0xf8, 0x25, 0x98, 0x8f, 0x65, 0xdb, 0x05, 0x7b, 0xe2, 0xea, 0x0b, 0x5c, 0xfc, + 0xf3, 0x15, 0xf8, 0x12, 0xac, 0xe0, 0x7e, 0x71, 0x1d, 0xdc, 0xfb, 0x37, 0xd1, 0xdc, 0x0d, 0xc3, + 0x4f, 0x9f, 0x5d, 0xeb, 0x09, 0x1e, 0xc3, 0xc8, 0xf3, 0xbb, 0x24, 0xc2, 0xa7, 0xd0, 0xa7, 0xee, + 0xcc, 0xf5, 0xee, 0x16, 0x56, 0xef, 0xea, 0x03, 0x8c, 0x0e, 0x5e, 0xa1, 0x8e, 0x9a, 0x05, 0xf3, + 0x3b, 0xea, 0x86, 0xa1, 0x17, 0xf8, 0x91, 0x1f, 0xf8, 0x75, 0xd4, 0x01, 0xfb, 0xfd, 0xab, 0x77, + 0x6d, 0xa1, 0xe4, 0x44, 0xbf, 0xf5, 0xbb, 0x3f, 0x01, 0x00, 0x00, 0xff, 0xff, 0x34, 0x50, 0xae, + 0x17, 0xf0, 0x02, 0x00, 0x00, } diff --git a/pb/clientmessage.proto b/pb/clientmessage.proto index 469dba809..f263110ce 100644 --- a/pb/clientmessage.proto +++ b/pb/clientmessage.proto @@ -2,19 +2,6 @@ syntax = "proto3"; package pb; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.gostring_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option (gogoproto.testgen_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.populate_all) = true; - enum ClientMessageType { OUTBOUND_MESSAGE = 0; INBOUND_MESSAGE = 1; diff --git a/pb/clientmessagepb_test.go b/pb/clientmessagepb_test.go deleted file mode 100644 index 32119b569..000000000 --- a/pb/clientmessagepb_test.go +++ /dev/null @@ -1,607 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb/clientmessage.proto - -package pb - -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import fmt "fmt" -import go_parser "go/parser" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestClientMessageProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedClientMessage(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &ClientMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestClientMessageMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedClientMessage(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &ClientMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestOutboundMessageProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOutboundMessage(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &OutboundMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestOutboundMessageMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOutboundMessage(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &OutboundMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestInboundMessageProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInboundMessage(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &InboundMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestInboundMessageMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInboundMessage(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &InboundMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestReceiptProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedReceipt(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Receipt{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestReceiptMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedReceipt(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Receipt{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestClientMessageJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedClientMessage(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &ClientMessage{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestOutboundMessageJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOutboundMessage(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &OutboundMessage{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestInboundMessageJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInboundMessage(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &InboundMessage{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestReceiptJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedReceipt(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Receipt{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestClientMessageProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedClientMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &ClientMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestClientMessageProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedClientMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &ClientMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestOutboundMessageProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOutboundMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &OutboundMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestOutboundMessageProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOutboundMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &OutboundMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestInboundMessageProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInboundMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &InboundMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestInboundMessageProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInboundMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &InboundMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestReceiptProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedReceipt(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Receipt{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestReceiptProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedReceipt(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Receipt{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestClientMessageGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedClientMessage(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestOutboundMessageGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedOutboundMessage(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestInboundMessageGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedInboundMessage(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestReceiptGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedReceipt(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestClientMessageSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedClientMessage(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestOutboundMessageSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedOutboundMessage(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestInboundMessageSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedInboundMessage(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestReceiptSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedReceipt(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestClientMessageStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedClientMessage(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestOutboundMessageStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedOutboundMessage(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestInboundMessageStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedInboundMessage(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestReceiptStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedReceipt(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/pb/node.pb.go b/pb/node.pb.go index 934d1061f..5ab736680 100644 --- a/pb/node.pb.go +++ b/pb/node.pb.go @@ -1,21 +1,11 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: pb/node.proto package pb -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strconv "strconv" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -26,15 +16,15 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type SyncState int32 const ( - WAIT_FOR_SYNCING SyncState = 0 - SYNC_STARTED SyncState = 1 - SYNC_FINISHED SyncState = 2 - PERSIST_FINISHED SyncState = 3 + SyncState_WAIT_FOR_SYNCING SyncState = 0 + SyncState_SYNC_STARTED SyncState = 1 + SyncState_SYNC_FINISHED SyncState = 2 + SyncState_PERSIST_FINISHED SyncState = 3 ) var SyncState_name = map[int32]string{ @@ -50,46 +40,44 @@ var SyncState_value = map[string]int32{ "PERSIST_FINISHED": 3, } +func (x SyncState) String() string { + return proto.EnumName(SyncState_name, int32(x)) +} func (SyncState) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_node_50427c037d11104f, []int{0} + return fileDescriptor_node_c55aed2e3f1b2fcb, []int{0} } type NodeData struct { - PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - WebsocketPort uint32 `protobuf:"varint,2,opt,name=websocket_port,json=websocketPort,proto3" json:"websocket_port,omitempty"` - JsonRpcPort uint32 `protobuf:"varint,3,opt,name=json_rpc_port,json=jsonRpcPort,proto3" json:"json_rpc_port,omitempty"` - ProtocolVersion uint32 `protobuf:"varint,4,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` - TlsWebsocketDomain string `protobuf:"bytes,5,opt,name=tls_websocket_domain,json=tlsWebsocketDomain,proto3" json:"tls_websocket_domain,omitempty"` - TlsWebsocketPort uint32 `protobuf:"varint,6,opt,name=tls_websocket_port,json=tlsWebsocketPort,proto3" json:"tls_websocket_port,omitempty"` - TlsJsonRpcDomain string `protobuf:"bytes,7,opt,name=tls_json_rpc_domain,json=tlsJsonRpcDomain,proto3" json:"tls_json_rpc_domain,omitempty"` - TlsJsonRpcPort uint32 `protobuf:"varint,8,opt,name=tls_json_rpc_port,json=tlsJsonRpcPort,proto3" json:"tls_json_rpc_port,omitempty"` -} - -func (m *NodeData) Reset() { *m = NodeData{} } -func (*NodeData) ProtoMessage() {} + PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + WebsocketPort uint32 `protobuf:"varint,2,opt,name=websocket_port,json=websocketPort,proto3" json:"websocket_port,omitempty"` + JsonRpcPort uint32 `protobuf:"varint,3,opt,name=json_rpc_port,json=jsonRpcPort,proto3" json:"json_rpc_port,omitempty"` + ProtocolVersion uint32 `protobuf:"varint,4,opt,name=protocol_version,json=protocolVersion,proto3" json:"protocol_version,omitempty"` + TlsWebsocketDomain string `protobuf:"bytes,5,opt,name=tls_websocket_domain,json=tlsWebsocketDomain,proto3" json:"tls_websocket_domain,omitempty"` + TlsWebsocketPort uint32 `protobuf:"varint,6,opt,name=tls_websocket_port,json=tlsWebsocketPort,proto3" json:"tls_websocket_port,omitempty"` + TlsJsonRpcDomain string `protobuf:"bytes,7,opt,name=tls_json_rpc_domain,json=tlsJsonRpcDomain,proto3" json:"tls_json_rpc_domain,omitempty"` + TlsJsonRpcPort uint32 `protobuf:"varint,8,opt,name=tls_json_rpc_port,json=tlsJsonRpcPort,proto3" json:"tls_json_rpc_port,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NodeData) Reset() { *m = NodeData{} } +func (m *NodeData) String() string { return proto.CompactTextString(m) } +func (*NodeData) ProtoMessage() {} func (*NodeData) Descriptor() ([]byte, []int) { - return fileDescriptor_node_50427c037d11104f, []int{0} + return fileDescriptor_node_c55aed2e3f1b2fcb, []int{0} } func (m *NodeData) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_NodeData.Unmarshal(m, b) } func (m *NodeData) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NodeData.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_NodeData.Marshal(b, m, deterministic) } func (dst *NodeData) XXX_Merge(src proto.Message) { xxx_messageInfo_NodeData.Merge(dst, src) } func (m *NodeData) XXX_Size() int { - return m.Size() + return xxx_messageInfo_NodeData.Size(m) } func (m *NodeData) XXX_DiscardUnknown() { xxx_messageInfo_NodeData.DiscardUnknown(m) @@ -157,686 +145,29 @@ func init() { proto.RegisterType((*NodeData)(nil), "pb.NodeData") proto.RegisterEnum("pb.SyncState", SyncState_name, SyncState_value) } -func (x SyncState) String() string { - s, ok := SyncState_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *NodeData) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*NodeData) - if !ok { - that2, ok := that.(NodeData) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.PublicKey, that1.PublicKey) { - return false - } - if this.WebsocketPort != that1.WebsocketPort { - return false - } - if this.JsonRpcPort != that1.JsonRpcPort { - return false - } - if this.ProtocolVersion != that1.ProtocolVersion { - return false - } - if this.TlsWebsocketDomain != that1.TlsWebsocketDomain { - return false - } - if this.TlsWebsocketPort != that1.TlsWebsocketPort { - return false - } - if this.TlsJsonRpcDomain != that1.TlsJsonRpcDomain { - return false - } - if this.TlsJsonRpcPort != that1.TlsJsonRpcPort { - return false - } - return true -} -func (this *NodeData) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 12) - s = append(s, "&pb.NodeData{") - s = append(s, "PublicKey: "+fmt.Sprintf("%#v", this.PublicKey)+",\n") - s = append(s, "WebsocketPort: "+fmt.Sprintf("%#v", this.WebsocketPort)+",\n") - s = append(s, "JsonRpcPort: "+fmt.Sprintf("%#v", this.JsonRpcPort)+",\n") - s = append(s, "ProtocolVersion: "+fmt.Sprintf("%#v", this.ProtocolVersion)+",\n") - s = append(s, "TlsWebsocketDomain: "+fmt.Sprintf("%#v", this.TlsWebsocketDomain)+",\n") - s = append(s, "TlsWebsocketPort: "+fmt.Sprintf("%#v", this.TlsWebsocketPort)+",\n") - s = append(s, "TlsJsonRpcDomain: "+fmt.Sprintf("%#v", this.TlsJsonRpcDomain)+",\n") - s = append(s, "TlsJsonRpcPort: "+fmt.Sprintf("%#v", this.TlsJsonRpcPort)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringNode(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *NodeData) 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 *NodeData) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.PublicKey) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNode(dAtA, i, uint64(len(m.PublicKey))) - i += copy(dAtA[i:], m.PublicKey) - } - if m.WebsocketPort != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintNode(dAtA, i, uint64(m.WebsocketPort)) - } - if m.JsonRpcPort != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintNode(dAtA, i, uint64(m.JsonRpcPort)) - } - if m.ProtocolVersion != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintNode(dAtA, i, uint64(m.ProtocolVersion)) - } - if len(m.TlsWebsocketDomain) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintNode(dAtA, i, uint64(len(m.TlsWebsocketDomain))) - i += copy(dAtA[i:], m.TlsWebsocketDomain) - } - if m.TlsWebsocketPort != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintNode(dAtA, i, uint64(m.TlsWebsocketPort)) - } - if len(m.TlsJsonRpcDomain) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintNode(dAtA, i, uint64(len(m.TlsJsonRpcDomain))) - i += copy(dAtA[i:], m.TlsJsonRpcDomain) - } - if m.TlsJsonRpcPort != 0 { - dAtA[i] = 0x40 - i++ - i = encodeVarintNode(dAtA, i, uint64(m.TlsJsonRpcPort)) - } - return i, nil -} - -func encodeVarintNode(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 NewPopulatedNodeData(r randyNode, easy bool) *NodeData { - this := &NodeData{} - v1 := r.Intn(100) - this.PublicKey = make([]byte, v1) - for i := 0; i < v1; i++ { - this.PublicKey[i] = byte(r.Intn(256)) - } - this.WebsocketPort = uint32(r.Uint32()) - this.JsonRpcPort = uint32(r.Uint32()) - this.ProtocolVersion = uint32(r.Uint32()) - this.TlsWebsocketDomain = string(randStringNode(r)) - this.TlsWebsocketPort = uint32(r.Uint32()) - this.TlsJsonRpcDomain = string(randStringNode(r)) - this.TlsJsonRpcPort = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyNode interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneNode(r randyNode) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringNode(r randyNode) string { - v2 := r.Intn(100) - tmps := make([]rune, v2) - for i := 0; i < v2; i++ { - tmps[i] = randUTF8RuneNode(r) - } - return string(tmps) -} -func randUnrecognizedNode(r randyNode, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldNode(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldNode(dAtA []byte, r randyNode, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateNode(dAtA, uint64(key)) - v3 := r.Int63() - if r.Intn(2) == 0 { - v3 *= -1 - } - dAtA = encodeVarintPopulateNode(dAtA, uint64(v3)) - case 1: - dAtA = encodeVarintPopulateNode(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateNode(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateNode(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateNode(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateNode(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *NodeData) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovNode(uint64(l)) - } - if m.WebsocketPort != 0 { - n += 1 + sovNode(uint64(m.WebsocketPort)) - } - if m.JsonRpcPort != 0 { - n += 1 + sovNode(uint64(m.JsonRpcPort)) - } - if m.ProtocolVersion != 0 { - n += 1 + sovNode(uint64(m.ProtocolVersion)) - } - l = len(m.TlsWebsocketDomain) - if l > 0 { - n += 1 + l + sovNode(uint64(l)) - } - if m.TlsWebsocketPort != 0 { - n += 1 + sovNode(uint64(m.TlsWebsocketPort)) - } - l = len(m.TlsJsonRpcDomain) - if l > 0 { - n += 1 + l + sovNode(uint64(l)) - } - if m.TlsJsonRpcPort != 0 { - n += 1 + sovNode(uint64(m.TlsJsonRpcPort)) - } - return n -} - -func sovNode(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozNode(x uint64) (n int) { - return sovNode(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *NodeData) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NodeData{`, - `PublicKey:` + fmt.Sprintf("%v", this.PublicKey) + `,`, - `WebsocketPort:` + fmt.Sprintf("%v", this.WebsocketPort) + `,`, - `JsonRpcPort:` + fmt.Sprintf("%v", this.JsonRpcPort) + `,`, - `ProtocolVersion:` + fmt.Sprintf("%v", this.ProtocolVersion) + `,`, - `TlsWebsocketDomain:` + fmt.Sprintf("%v", this.TlsWebsocketDomain) + `,`, - `TlsWebsocketPort:` + fmt.Sprintf("%v", this.TlsWebsocketPort) + `,`, - `TlsJsonRpcDomain:` + fmt.Sprintf("%v", this.TlsJsonRpcDomain) + `,`, - `TlsJsonRpcPort:` + fmt.Sprintf("%v", this.TlsJsonRpcPort) + `,`, - `}`, - }, "") - return s -} -func valueToStringNode(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *NodeData) 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 ErrIntOverflowNode - } - 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: NodeData: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NodeData: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNode - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field WebsocketPort", wireType) - } - m.WebsocketPort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.WebsocketPort |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field JsonRpcPort", wireType) - } - m.JsonRpcPort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.JsonRpcPort |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ProtocolVersion", wireType) - } - m.ProtocolVersion = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ProtocolVersion |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TlsWebsocketDomain", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - 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 ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TlsWebsocketDomain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TlsWebsocketPort", wireType) - } - m.TlsWebsocketPort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TlsWebsocketPort |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TlsJsonRpcDomain", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - 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 ErrInvalidLengthNode - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TlsJsonRpcDomain = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 8: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TlsJsonRpcPort", wireType) - } - m.TlsJsonRpcPort = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNode - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TlsJsonRpcPort |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNode(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNode - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipNode(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, ErrIntOverflowNode - } - 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, ErrIntOverflowNode - } - 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, ErrIntOverflowNode - } - 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, ErrInvalidLengthNode - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNode - } - 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 := skipNode(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 ( - ErrInvalidLengthNode = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNode = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("pb/node.proto", fileDescriptor_node_50427c037d11104f) } -var fileDescriptor_node_50427c037d11104f = []byte{ - // 420 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xcd, 0x6e, 0xd3, 0x40, - 0x14, 0x85, 0x3d, 0x2e, 0x94, 0x66, 0xa8, 0x8b, 0x3b, 0x74, 0x61, 0x21, 0x31, 0x8a, 0x2a, 0x21, - 0xa5, 0x88, 0x36, 0x48, 0x6c, 0xd9, 0x14, 0x9c, 0x82, 0x41, 0x32, 0x95, 0x6d, 0x11, 0x21, 0x21, - 0x8d, 0x6c, 0x67, 0x08, 0x26, 0x8e, 0xc7, 0xb2, 0x27, 0xa0, 0xec, 0x78, 0x04, 0x1e, 0x83, 0x47, - 0xe0, 0x11, 0x58, 0x66, 0x19, 0x76, 0x78, 0xb2, 0x61, 0x99, 0x25, 0x4b, 0xe4, 0xeb, 0xfc, 0x90, - 0x9d, 0xef, 0xb9, 0xdf, 0xfd, 0xe6, 0xc8, 0xd8, 0xc8, 0xa3, 0x6e, 0x26, 0x06, 0xfc, 0x22, 0x2f, - 0x84, 0x14, 0x44, 0xcf, 0xa3, 0x7b, 0xe7, 0xc3, 0x44, 0x7e, 0x9c, 0x44, 0x17, 0xb1, 0x18, 0x77, - 0x87, 0x62, 0x28, 0xba, 0xb0, 0x8a, 0x26, 0x1f, 0x60, 0x82, 0x01, 0xbe, 0x9a, 0x93, 0xd3, 0x5f, - 0x3a, 0x3e, 0x70, 0xc5, 0x80, 0xdb, 0xa1, 0x0c, 0xc9, 0x7d, 0x8c, 0xf3, 0x49, 0x94, 0x26, 0x31, - 0x1b, 0xf1, 0xa9, 0x85, 0xda, 0xa8, 0x73, 0xe8, 0xb5, 0x9a, 0xe4, 0x35, 0x9f, 0x92, 0x07, 0xf8, - 0xe8, 0x0b, 0x8f, 0x4a, 0x11, 0x8f, 0xb8, 0x64, 0xb9, 0x28, 0xa4, 0xa5, 0xb7, 0x51, 0xc7, 0xf0, - 0x8c, 0x4d, 0x7a, 0x2d, 0x0a, 0x49, 0x4e, 0xb1, 0xf1, 0xa9, 0x14, 0x19, 0x2b, 0xf2, 0xb8, 0xa1, - 0xf6, 0x80, 0xba, 0x5d, 0x87, 0x5e, 0x1e, 0x03, 0x73, 0x86, 0x4d, 0x78, 0x3f, 0x16, 0x29, 0xfb, - 0xcc, 0x8b, 0x32, 0x11, 0x99, 0x75, 0x03, 0xb0, 0x3b, 0xeb, 0xfc, 0x6d, 0x13, 0x93, 0xc7, 0xf8, - 0x44, 0xa6, 0x25, 0xdb, 0xbe, 0x3c, 0x10, 0xe3, 0x30, 0xc9, 0xac, 0x9b, 0x6d, 0xd4, 0x69, 0x79, - 0x44, 0xa6, 0x65, 0x7f, 0xbd, 0xb2, 0x61, 0x43, 0x1e, 0x61, 0xb2, 0x7b, 0x01, 0x2d, 0xf6, 0x41, - 0x6f, 0xfe, 0xcf, 0x43, 0x95, 0x73, 0x7c, 0xb7, 0xa6, 0x37, 0x95, 0x57, 0xfa, 0x5b, 0xa0, 0xaf, - 0xf1, 0x57, 0x4d, 0xef, 0x95, 0xfc, 0x0c, 0x1f, 0xef, 0xe0, 0xe0, 0x3e, 0x00, 0xf7, 0xd1, 0x16, - 0xae, 0xcd, 0x0f, 0xdf, 0xe3, 0x96, 0x3f, 0xcd, 0x62, 0x5f, 0x86, 0x92, 0x93, 0x13, 0x6c, 0xf6, - 0x2f, 0x9d, 0x80, 0x5d, 0xbd, 0xf1, 0x98, 0xff, 0xce, 0x7d, 0xee, 0xb8, 0x2f, 0x4c, 0x8d, 0x98, - 0xf8, 0xb0, 0x1e, 0x98, 0x1f, 0x5c, 0x7a, 0x41, 0xcf, 0x36, 0x11, 0x39, 0xc6, 0x06, 0x24, 0x57, - 0x8e, 0xeb, 0xf8, 0x2f, 0x7b, 0xb6, 0xa9, 0xd7, 0xa7, 0xd7, 0x3d, 0xcf, 0x77, 0xfc, 0x60, 0x9b, - 0xee, 0x3d, 0x7b, 0x3a, 0xab, 0xa8, 0x36, 0xaf, 0xa8, 0xb6, 0xac, 0x28, 0xfa, 0x5b, 0x51, 0xf4, - 0x55, 0x51, 0xf4, 0x5d, 0x51, 0xf4, 0x43, 0x51, 0xf4, 0x53, 0x51, 0x34, 0x53, 0x14, 0xfd, 0x56, - 0x14, 0xfd, 0x51, 0x54, 0x5b, 0x2a, 0x8a, 0xbe, 0x2d, 0xa8, 0x36, 0x5b, 0x50, 0x6d, 0xbe, 0xa0, - 0x5a, 0xb4, 0x0f, 0xbf, 0xf9, 0xc9, 0xbf, 0x00, 0x00, 0x00, 0xff, 0xff, 0x12, 0x3b, 0xf4, 0x58, - 0x42, 0x02, 0x00, 0x00, +func init() { proto.RegisterFile("pb/node.proto", fileDescriptor_node_c55aed2e3f1b2fcb) } + +var fileDescriptor_node_c55aed2e3f1b2fcb = []byte{ + // 318 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x54, 0x90, 0xdd, 0x4a, 0xf3, 0x30, + 0x1c, 0x87, 0xdf, 0x76, 0xaf, 0x73, 0xfb, 0xbb, 0xce, 0x2c, 0xee, 0xa0, 0x27, 0xc2, 0x18, 0x08, + 0x9b, 0xf8, 0x05, 0x5e, 0xc1, 0xb0, 0x9b, 0x56, 0xa1, 0x8e, 0xa4, 0x38, 0x04, 0x21, 0xb4, 0x5d, + 0x0e, 0xe6, 0x6a, 0x13, 0xda, 0xa8, 0xec, 0x52, 0xbd, 0x1b, 0xe9, 0xbf, 0xfb, 0x70, 0x87, 0x7d, + 0xf2, 0xe4, 0xe9, 0x8f, 0x80, 0xa3, 0xe3, 0xeb, 0x4c, 0xcd, 0xe5, 0x95, 0xce, 0x95, 0x51, 0xd4, + 0xd6, 0x71, 0xff, 0xc7, 0x86, 0x46, 0xa0, 0xe6, 0xd2, 0x8b, 0x4c, 0x44, 0x4f, 0x01, 0xf4, 0x67, + 0x9c, 0x2e, 0x12, 0xb1, 0x94, 0x2b, 0xd7, 0xea, 0x59, 0x83, 0x16, 0x6b, 0x56, 0xe4, 0x49, 0xae, + 0xe8, 0x19, 0xb4, 0xbf, 0x65, 0x5c, 0xa8, 0x64, 0x29, 0x8d, 0xd0, 0x2a, 0x37, 0xae, 0xdd, 0xb3, + 0x06, 0x0e, 0x73, 0xb6, 0x74, 0xaa, 0x72, 0x43, 0xfb, 0xe0, 0xbc, 0x17, 0x2a, 0x13, 0xb9, 0x4e, + 0x2a, 0xab, 0x86, 0xd6, 0x51, 0x09, 0x99, 0x4e, 0xd0, 0x19, 0x02, 0xc1, 0x0d, 0x89, 0x4a, 0xc5, + 0x97, 0xcc, 0x8b, 0x85, 0xca, 0xdc, 0xff, 0xa8, 0x1d, 0x6f, 0xf8, 0x4b, 0x85, 0xe9, 0x0d, 0x74, + 0x4d, 0x5a, 0x88, 0xdd, 0x9f, 0xe7, 0xea, 0x23, 0x5a, 0x64, 0xee, 0x41, 0xcf, 0x1a, 0x34, 0x19, + 0x35, 0x69, 0x31, 0xdb, 0x1c, 0x79, 0x78, 0x42, 0x2f, 0x80, 0xee, 0xdf, 0xc0, 0x15, 0x75, 0xcc, + 0x93, 0xbf, 0x3e, 0x4e, 0xb9, 0x84, 0x93, 0xd2, 0xde, 0x4e, 0x5e, 0xe7, 0x0f, 0x31, 0x5f, 0xea, + 0x8f, 0xd5, 0xee, 0x75, 0x7c, 0x08, 0x9d, 0x3d, 0x1d, 0xdb, 0x0d, 0x6c, 0xb7, 0x77, 0x72, 0x59, + 0x3e, 0x7f, 0x83, 0x26, 0x5f, 0x65, 0x09, 0x37, 0x91, 0x91, 0xb4, 0x0b, 0x64, 0x36, 0xf2, 0x43, + 0x31, 0x79, 0x66, 0x82, 0xbf, 0x06, 0x77, 0x7e, 0x70, 0x4f, 0xfe, 0x51, 0x02, 0xad, 0xf2, 0x43, + 0xf0, 0x70, 0xc4, 0xc2, 0xb1, 0x47, 0x2c, 0xda, 0x01, 0x07, 0xc9, 0xc4, 0x0f, 0x7c, 0xfe, 0x30, + 0xf6, 0x88, 0x5d, 0x5e, 0x9d, 0x8e, 0x19, 0xf7, 0x79, 0xb8, 0xa3, 0xb5, 0xb8, 0x8e, 0x0f, 0x75, + 0xfb, 0x1b, 0x00, 0x00, 0xff, 0xff, 0x37, 0x3b, 0x5a, 0x28, 0xd5, 0x01, 0x00, 0x00, } diff --git a/pb/node.proto b/pb/node.proto index 07c7d07b6..f36271390 100644 --- a/pb/node.proto +++ b/pb/node.proto @@ -2,19 +2,6 @@ syntax = "proto3"; package pb; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.gostring_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option (gogoproto.testgen_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.populate_all) = true; - enum SyncState { WAIT_FOR_SYNCING = 0; SYNC_STARTED = 1; diff --git a/pb/nodemessage.pb.go b/pb/nodemessage.pb.go index 5b2c59036..d1672cd21 100644 --- a/pb/nodemessage.pb.go +++ b/pb/nodemessage.pb.go @@ -1,21 +1,11 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: pb/nodemessage.proto package pb -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strconv "strconv" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -26,31 +16,31 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type MessageType int32 const ( - MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE MessageType = 0 - VOTE MessageType = 1 - I_HAVE_BLOCK_PROPOSAL MessageType = 2 - REQUEST_BLOCK_PROPOSAL MessageType = 3 - REQUEST_BLOCK_PROPOSAL_REPLY MessageType = 4 - GET_CONSENSUS_STATE MessageType = 5 - GET_CONSENSUS_STATE_REPLY MessageType = 6 - GET_BLOCK_HEADERS MessageType = 7 - GET_BLOCK_HEADERS_REPLY MessageType = 8 - GET_BLOCKS MessageType = 9 - GET_BLOCKS_REPLY MessageType = 10 - RELAY MessageType = 11 - TRANSACTIONS MessageType = 12 - BACKTRACK_SIGNATURE_CHAIN MessageType = 13 - REQUEST_PROPOSAL_TRANSACTIONS MessageType = 14 - REQUEST_PROPOSAL_TRANSACTIONS_REPLY MessageType = 15 - I_HAVE_SIGNATURE_CHAIN_TRANSACTION MessageType = 16 - REQUEST_SIGNATURE_CHAIN_TRANSACTION MessageType = 17 - REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY MessageType = 18 - PIN_SIGNATURE_CHAIN MessageType = 19 + MessageType_MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE MessageType = 0 + MessageType_VOTE MessageType = 1 + MessageType_I_HAVE_BLOCK_PROPOSAL MessageType = 2 + MessageType_REQUEST_BLOCK_PROPOSAL MessageType = 3 + MessageType_REQUEST_BLOCK_PROPOSAL_REPLY MessageType = 4 + MessageType_GET_CONSENSUS_STATE MessageType = 5 + MessageType_GET_CONSENSUS_STATE_REPLY MessageType = 6 + MessageType_GET_BLOCK_HEADERS MessageType = 7 + MessageType_GET_BLOCK_HEADERS_REPLY MessageType = 8 + MessageType_GET_BLOCKS MessageType = 9 + MessageType_GET_BLOCKS_REPLY MessageType = 10 + MessageType_RELAY MessageType = 11 + MessageType_TRANSACTIONS MessageType = 12 + MessageType_BACKTRACK_SIGNATURE_CHAIN MessageType = 13 + MessageType_REQUEST_PROPOSAL_TRANSACTIONS MessageType = 14 + MessageType_REQUEST_PROPOSAL_TRANSACTIONS_REPLY MessageType = 15 + MessageType_I_HAVE_SIGNATURE_CHAIN_TRANSACTION MessageType = 16 + MessageType_REQUEST_SIGNATURE_CHAIN_TRANSACTION MessageType = 17 + MessageType_REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY MessageType = 18 + MessageType_PIN_SIGNATURE_CHAIN MessageType = 19 ) var MessageType_name = map[int32]string{ @@ -98,8 +88,11 @@ var MessageType_value = map[string]int32{ "PIN_SIGNATURE_CHAIN": 19, } +func (x MessageType) String() string { + return proto.EnumName(MessageType_name, int32(x)) +} func (MessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{0} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{0} } // Message type that can be signed message @@ -107,7 +100,7 @@ func (MessageType) EnumDescriptor() ([]byte, []int) { type AllowedSignedMessageType int32 const ( - ALLOW_SIGNED_PLACEHOLDER_DO_NOT_USE AllowedSignedMessageType = 0 + AllowedSignedMessageType_ALLOW_SIGNED_PLACEHOLDER_DO_NOT_USE AllowedSignedMessageType = 0 ) var AllowedSignedMessageType_name = map[int32]string{ @@ -117,8 +110,11 @@ var AllowedSignedMessageType_value = map[string]int32{ "ALLOW_SIGNED_PLACEHOLDER_DO_NOT_USE": 0, } +func (x AllowedSignedMessageType) String() string { + return proto.EnumName(AllowedSignedMessageType_name, int32(x)) +} func (AllowedSignedMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{1} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{1} } // Message type that can be unsigned message @@ -126,26 +122,26 @@ func (AllowedSignedMessageType) EnumDescriptor() ([]byte, []int) { type AllowedUnsignedMessageType int32 const ( - ALLOW_UNSIGNED_PLACEHOLDER_DO_NOT_USE AllowedUnsignedMessageType = 0 - ALLOW_UNSIGNED_VOTE AllowedUnsignedMessageType = 1 - ALLOW_UNSIGNED_I_HAVE_BLOCK_PROPOSAL AllowedUnsignedMessageType = 2 - ALLOW_UNSIGNED_REQUEST_BLOCK_PROPOSAL AllowedUnsignedMessageType = 3 - ALLOW_UNSIGNED_REQUEST_BLOCK_REPLY AllowedUnsignedMessageType = 4 - ALLOW_UNSIGNED_GET_CONSENSUS_STATE AllowedUnsignedMessageType = 5 - ALLOW_UNSIGNED_GET_CONSENSUS_STATE_REPLY AllowedUnsignedMessageType = 6 - ALLOW_UNSIGNED_GET_BLOCK_HEADERS AllowedUnsignedMessageType = 7 - ALLOW_UNSIGNED_GET_BLOCK_HEADERS_REPLY AllowedUnsignedMessageType = 8 - ALLOW_UNSIGNED_GET_BLOCKS AllowedUnsignedMessageType = 9 - ALLOW_UNSIGNED_GET_BLOCKS_REPLY AllowedUnsignedMessageType = 10 - ALLOW_UNSIGNED_RELAY AllowedUnsignedMessageType = 11 - ALLOW_UNSIGNED_TRANSACTIONS AllowedUnsignedMessageType = 12 - ALLOW_UNSIGNED_BACKTRACK_SIGNATURE_CHAIN AllowedUnsignedMessageType = 13 - ALLOW_UNSIGNED_REQUEST_PROPOSAL_TRANSACTIONS AllowedUnsignedMessageType = 14 - ALLOW_UNSIGNED_REQUEST_PROPOSAL_TRANSACTIONS_REPLY AllowedUnsignedMessageType = 15 - ALLOW_UNSIGNED_I_HAVE_SIGNATURE_CHAIN_TRANSACTION AllowedUnsignedMessageType = 16 - ALLOW_UNSIGNED_REQUEST_SIGNATURE_CHAIN_TRANSACTION AllowedUnsignedMessageType = 17 - ALLOW_UNSIGNED_REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY AllowedUnsignedMessageType = 18 - ALLOW_UNSIGNED_PIN_SIGNATURE_CHAIN AllowedUnsignedMessageType = 19 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_PLACEHOLDER_DO_NOT_USE AllowedUnsignedMessageType = 0 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_VOTE AllowedUnsignedMessageType = 1 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_I_HAVE_BLOCK_PROPOSAL AllowedUnsignedMessageType = 2 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_REQUEST_BLOCK_PROPOSAL AllowedUnsignedMessageType = 3 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_REQUEST_BLOCK_REPLY AllowedUnsignedMessageType = 4 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_GET_CONSENSUS_STATE AllowedUnsignedMessageType = 5 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_GET_CONSENSUS_STATE_REPLY AllowedUnsignedMessageType = 6 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_GET_BLOCK_HEADERS AllowedUnsignedMessageType = 7 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_GET_BLOCK_HEADERS_REPLY AllowedUnsignedMessageType = 8 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_GET_BLOCKS AllowedUnsignedMessageType = 9 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_GET_BLOCKS_REPLY AllowedUnsignedMessageType = 10 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_RELAY AllowedUnsignedMessageType = 11 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_TRANSACTIONS AllowedUnsignedMessageType = 12 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_BACKTRACK_SIGNATURE_CHAIN AllowedUnsignedMessageType = 13 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_REQUEST_PROPOSAL_TRANSACTIONS AllowedUnsignedMessageType = 14 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_REQUEST_PROPOSAL_TRANSACTIONS_REPLY AllowedUnsignedMessageType = 15 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_I_HAVE_SIGNATURE_CHAIN_TRANSACTION AllowedUnsignedMessageType = 16 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_REQUEST_SIGNATURE_CHAIN_TRANSACTION AllowedUnsignedMessageType = 17 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY AllowedUnsignedMessageType = 18 + AllowedUnsignedMessageType_ALLOW_UNSIGNED_PIN_SIGNATURE_CHAIN AllowedUnsignedMessageType = 19 ) var AllowedUnsignedMessageType_name = map[int32]string{ @@ -193,8 +189,11 @@ var AllowedUnsignedMessageType_value = map[string]int32{ "ALLOW_UNSIGNED_PIN_SIGNATURE_CHAIN": 19, } +func (x AllowedUnsignedMessageType) String() string { + return proto.EnumName(AllowedUnsignedMessageType_name, int32(x)) +} func (AllowedUnsignedMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{2} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{2} } // Message type that can be sent as direct message @@ -202,24 +201,24 @@ func (AllowedUnsignedMessageType) EnumDescriptor() ([]byte, []int) { type AllowedDirectMessageType int32 const ( - ALLOW_DIRECT_PLACEHOLDER_DO_NOT_USE AllowedDirectMessageType = 0 - ALLOW_DIRECT_VOTE AllowedDirectMessageType = 1 - ALLOW_DIRECT_I_HAVE_BLOCK_PROPOSAL AllowedDirectMessageType = 2 - ALLOW_DIRECT_REQUEST_BLOCK_PROPOSAL AllowedDirectMessageType = 3 - ALLOW_DIRECT_REQUEST_BLOCK_REPLY AllowedDirectMessageType = 4 - ALLOW_DIRECT_GET_CONSENSUS_STATE AllowedDirectMessageType = 5 - ALLOW_DIRECT_GET_CONSENSUS_STATE_REPLY AllowedDirectMessageType = 6 - ALLOW_DIRECT_GET_BLOCK_HEADERS AllowedDirectMessageType = 7 - ALLOW_DIRECT_GET_BLOCK_HEADERS_REPLY AllowedDirectMessageType = 8 - ALLOW_DIRECT_GET_BLOCKS AllowedDirectMessageType = 9 - ALLOW_DIRECT_GET_BLOCKS_REPLY AllowedDirectMessageType = 10 - ALLOW_DIRECT_BACKTRACK_SIGNATURE_CHAIN AllowedDirectMessageType = 13 - ALLOW_DIRECT_REQUEST_PROPOSAL_TRANSACTIONS AllowedDirectMessageType = 14 - ALLOW_DIRECT_REQUEST_PROPOSAL_TRANSACTIONS_REPLY AllowedDirectMessageType = 15 - ALLOW_DIRECT_I_HAVE_SIGNATURE_CHAIN_TRANSACTION AllowedDirectMessageType = 16 - ALLOW_DIRECT_REQUEST_SIGNATURE_CHAIN_TRANSACTION AllowedDirectMessageType = 17 - ALLOW_DIRECT_REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY AllowedDirectMessageType = 18 - ALLOW_DIRECT_PIN_SIGNATURE_CHAIN AllowedDirectMessageType = 19 + AllowedDirectMessageType_ALLOW_DIRECT_PLACEHOLDER_DO_NOT_USE AllowedDirectMessageType = 0 + AllowedDirectMessageType_ALLOW_DIRECT_VOTE AllowedDirectMessageType = 1 + AllowedDirectMessageType_ALLOW_DIRECT_I_HAVE_BLOCK_PROPOSAL AllowedDirectMessageType = 2 + AllowedDirectMessageType_ALLOW_DIRECT_REQUEST_BLOCK_PROPOSAL AllowedDirectMessageType = 3 + AllowedDirectMessageType_ALLOW_DIRECT_REQUEST_BLOCK_REPLY AllowedDirectMessageType = 4 + AllowedDirectMessageType_ALLOW_DIRECT_GET_CONSENSUS_STATE AllowedDirectMessageType = 5 + AllowedDirectMessageType_ALLOW_DIRECT_GET_CONSENSUS_STATE_REPLY AllowedDirectMessageType = 6 + AllowedDirectMessageType_ALLOW_DIRECT_GET_BLOCK_HEADERS AllowedDirectMessageType = 7 + AllowedDirectMessageType_ALLOW_DIRECT_GET_BLOCK_HEADERS_REPLY AllowedDirectMessageType = 8 + AllowedDirectMessageType_ALLOW_DIRECT_GET_BLOCKS AllowedDirectMessageType = 9 + AllowedDirectMessageType_ALLOW_DIRECT_GET_BLOCKS_REPLY AllowedDirectMessageType = 10 + AllowedDirectMessageType_ALLOW_DIRECT_BACKTRACK_SIGNATURE_CHAIN AllowedDirectMessageType = 13 + AllowedDirectMessageType_ALLOW_DIRECT_REQUEST_PROPOSAL_TRANSACTIONS AllowedDirectMessageType = 14 + AllowedDirectMessageType_ALLOW_DIRECT_REQUEST_PROPOSAL_TRANSACTIONS_REPLY AllowedDirectMessageType = 15 + AllowedDirectMessageType_ALLOW_DIRECT_I_HAVE_SIGNATURE_CHAIN_TRANSACTION AllowedDirectMessageType = 16 + AllowedDirectMessageType_ALLOW_DIRECT_REQUEST_SIGNATURE_CHAIN_TRANSACTION AllowedDirectMessageType = 17 + AllowedDirectMessageType_ALLOW_DIRECT_REQUEST_SIGNATURE_CHAIN_TRANSACTION_REPLY AllowedDirectMessageType = 18 + AllowedDirectMessageType_ALLOW_DIRECT_PIN_SIGNATURE_CHAIN AllowedDirectMessageType = 19 ) var AllowedDirectMessageType_name = map[int32]string{ @@ -263,8 +262,11 @@ var AllowedDirectMessageType_value = map[string]int32{ "ALLOW_DIRECT_PIN_SIGNATURE_CHAIN": 19, } +func (x AllowedDirectMessageType) String() string { + return proto.EnumName(AllowedDirectMessageType_name, int32(x)) +} func (AllowedDirectMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{3} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{3} } // Message type that can be sent as relay message @@ -272,8 +274,8 @@ func (AllowedDirectMessageType) EnumDescriptor() ([]byte, []int) { type AllowedRelayMessageType int32 const ( - ALLOW_RELAY_PLACEHOLDER_DO_NOT_USE AllowedRelayMessageType = 0 - ALLOW_RELAY_RELAY AllowedRelayMessageType = 11 + AllowedRelayMessageType_ALLOW_RELAY_PLACEHOLDER_DO_NOT_USE AllowedRelayMessageType = 0 + AllowedRelayMessageType_ALLOW_RELAY_RELAY AllowedRelayMessageType = 11 ) var AllowedRelayMessageType_name = map[int32]string{ @@ -285,8 +287,11 @@ var AllowedRelayMessageType_value = map[string]int32{ "ALLOW_RELAY_RELAY": 11, } +func (x AllowedRelayMessageType) String() string { + return proto.EnumName(AllowedRelayMessageType_name, int32(x)) +} func (AllowedRelayMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{4} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{4} } // Message type that can be sent as broadcast_push message @@ -294,8 +299,8 @@ func (AllowedRelayMessageType) EnumDescriptor() ([]byte, []int) { type AllowedBroadcastPushMessageType int32 const ( - ALLOW_BROADCAST_PUSH_PLACEHOLDER_DO_NOT_USE AllowedBroadcastPushMessageType = 0 - ALLOW_BROADCAST_PUSH_TRANSACTIONS AllowedBroadcastPushMessageType = 12 + AllowedBroadcastPushMessageType_ALLOW_BROADCAST_PUSH_PLACEHOLDER_DO_NOT_USE AllowedBroadcastPushMessageType = 0 + AllowedBroadcastPushMessageType_ALLOW_BROADCAST_PUSH_TRANSACTIONS AllowedBroadcastPushMessageType = 12 ) var AllowedBroadcastPushMessageType_name = map[int32]string{ @@ -307,8 +312,11 @@ var AllowedBroadcastPushMessageType_value = map[string]int32{ "ALLOW_BROADCAST_PUSH_TRANSACTIONS": 12, } +func (x AllowedBroadcastPushMessageType) String() string { + return proto.EnumName(AllowedBroadcastPushMessageType_name, int32(x)) +} func (AllowedBroadcastPushMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{5} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{5} } // Message type that can be sent as broadcast_pull message @@ -316,7 +324,7 @@ func (AllowedBroadcastPushMessageType) EnumDescriptor() ([]byte, []int) { type AllowedBroadcastPullMessageType int32 const ( - ALLOW_BROADCAST_PULL_PLACEHOLDER_DO_NOT_USE AllowedBroadcastPullMessageType = 0 + AllowedBroadcastPullMessageType_ALLOW_BROADCAST_PULL_PLACEHOLDER_DO_NOT_USE AllowedBroadcastPullMessageType = 0 ) var AllowedBroadcastPullMessageType_name = map[int32]string{ @@ -326,8 +334,11 @@ var AllowedBroadcastPullMessageType_value = map[string]int32{ "ALLOW_BROADCAST_PULL_PLACEHOLDER_DO_NOT_USE": 0, } +func (x AllowedBroadcastPullMessageType) String() string { + return proto.EnumName(AllowedBroadcastPullMessageType_name, int32(x)) +} func (AllowedBroadcastPullMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{6} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{6} } // Message type that can be sent as broadcast_tree message @@ -335,8 +346,8 @@ func (AllowedBroadcastPullMessageType) EnumDescriptor() ([]byte, []int) { type AllowedBroadcastTreeMessageType int32 const ( - ALLOW_BROADCAST_TREE_PLACEHOLDER_DO_NOT_USE AllowedBroadcastTreeMessageType = 0 - ALLOW_BROADCAST_TREE_TRANSACTIONS AllowedBroadcastTreeMessageType = 12 + AllowedBroadcastTreeMessageType_ALLOW_BROADCAST_TREE_PLACEHOLDER_DO_NOT_USE AllowedBroadcastTreeMessageType = 0 + AllowedBroadcastTreeMessageType_ALLOW_BROADCAST_TREE_TRANSACTIONS AllowedBroadcastTreeMessageType = 12 ) var AllowedBroadcastTreeMessageType_name = map[int32]string{ @@ -348,16 +359,19 @@ var AllowedBroadcastTreeMessageType_value = map[string]int32{ "ALLOW_BROADCAST_TREE_TRANSACTIONS": 12, } +func (x AllowedBroadcastTreeMessageType) String() string { + return proto.EnumName(AllowedBroadcastTreeMessageType_name, int32(x)) +} func (AllowedBroadcastTreeMessageType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{7} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{7} } type RequestTransactionType int32 const ( - REQUEST_FULL_TRANSACTION RequestTransactionType = 0 - REQUEST_TRANSACTION_HASH RequestTransactionType = 1 - REQUEST_TRANSACTION_SHORT_HASH RequestTransactionType = 2 + RequestTransactionType_REQUEST_FULL_TRANSACTION RequestTransactionType = 0 + RequestTransactionType_REQUEST_TRANSACTION_HASH RequestTransactionType = 1 + RequestTransactionType_REQUEST_TRANSACTION_SHORT_HASH RequestTransactionType = 2 ) var RequestTransactionType_name = map[int32]string{ @@ -371,40 +385,38 @@ var RequestTransactionType_value = map[string]int32{ "REQUEST_TRANSACTION_SHORT_HASH": 2, } +func (x RequestTransactionType) String() string { + return proto.EnumName(RequestTransactionType_name, int32(x)) +} func (RequestTransactionType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{8} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{8} } type UnsignedMessage struct { - MessageType MessageType `protobuf:"varint,1,opt,name=message_type,json=messageType,proto3,enum=pb.MessageType" json:"message_type,omitempty"` - Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + MessageType MessageType `protobuf:"varint,1,opt,name=message_type,json=messageType,proto3,enum=pb.MessageType" json:"message_type,omitempty"` + Message []byte `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *UnsignedMessage) Reset() { *m = UnsignedMessage{} } -func (*UnsignedMessage) ProtoMessage() {} +func (m *UnsignedMessage) Reset() { *m = UnsignedMessage{} } +func (m *UnsignedMessage) String() string { return proto.CompactTextString(m) } +func (*UnsignedMessage) ProtoMessage() {} func (*UnsignedMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{0} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{0} } func (m *UnsignedMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_UnsignedMessage.Unmarshal(m, b) } func (m *UnsignedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnsignedMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_UnsignedMessage.Marshal(b, m, deterministic) } func (dst *UnsignedMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_UnsignedMessage.Merge(dst, src) } func (m *UnsignedMessage) XXX_Size() int { - return m.Size() + return xxx_messageInfo_UnsignedMessage.Size(m) } func (m *UnsignedMessage) XXX_DiscardUnknown() { xxx_messageInfo_UnsignedMessage.DiscardUnknown(m) @@ -416,7 +428,7 @@ func (m *UnsignedMessage) GetMessageType() MessageType { if m != nil { return m.MessageType } - return MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE + return MessageType_MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE } func (m *UnsignedMessage) GetMessage() []byte { @@ -427,35 +439,30 @@ func (m *UnsignedMessage) GetMessage() []byte { } type SignedMessage struct { - Message []byte `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` - Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + Message []byte `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"` + Signature []byte `protobuf:"bytes,2,opt,name=signature,proto3" json:"signature,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SignedMessage) Reset() { *m = SignedMessage{} } -func (*SignedMessage) ProtoMessage() {} +func (m *SignedMessage) Reset() { *m = SignedMessage{} } +func (m *SignedMessage) String() string { return proto.CompactTextString(m) } +func (*SignedMessage) ProtoMessage() {} func (*SignedMessage) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{1} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{1} } func (m *SignedMessage) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_SignedMessage.Unmarshal(m, b) } func (m *SignedMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SignedMessage.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_SignedMessage.Marshal(b, m, deterministic) } func (dst *SignedMessage) XXX_Merge(src proto.Message) { xxx_messageInfo_SignedMessage.Merge(dst, src) } func (m *SignedMessage) XXX_Size() int { - return m.Size() + return xxx_messageInfo_SignedMessage.Size(m) } func (m *SignedMessage) XXX_DiscardUnknown() { xxx_messageInfo_SignedMessage.DiscardUnknown(m) @@ -478,35 +485,30 @@ func (m *SignedMessage) GetSignature() []byte { } type Vote struct { - Height uint32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Height uint32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Vote) Reset() { *m = Vote{} } -func (*Vote) ProtoMessage() {} +func (m *Vote) Reset() { *m = Vote{} } +func (m *Vote) String() string { return proto.CompactTextString(m) } +func (*Vote) ProtoMessage() {} func (*Vote) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{2} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{2} } func (m *Vote) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Vote.Unmarshal(m, b) } func (m *Vote) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Vote.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Vote.Marshal(b, m, deterministic) } func (dst *Vote) XXX_Merge(src proto.Message) { xxx_messageInfo_Vote.Merge(dst, src) } func (m *Vote) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Vote.Size(m) } func (m *Vote) XXX_DiscardUnknown() { xxx_messageInfo_Vote.DiscardUnknown(m) @@ -529,35 +531,30 @@ func (m *Vote) GetBlockHash() []byte { } type IHaveBlockProposal struct { - Height uint32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Height uint32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + BlockHash []byte `protobuf:"bytes,2,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *IHaveBlockProposal) Reset() { *m = IHaveBlockProposal{} } -func (*IHaveBlockProposal) ProtoMessage() {} +func (m *IHaveBlockProposal) Reset() { *m = IHaveBlockProposal{} } +func (m *IHaveBlockProposal) String() string { return proto.CompactTextString(m) } +func (*IHaveBlockProposal) ProtoMessage() {} func (*IHaveBlockProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{3} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{3} } func (m *IHaveBlockProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_IHaveBlockProposal.Unmarshal(m, b) } func (m *IHaveBlockProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IHaveBlockProposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_IHaveBlockProposal.Marshal(b, m, deterministic) } func (dst *IHaveBlockProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_IHaveBlockProposal.Merge(dst, src) } func (m *IHaveBlockProposal) XXX_Size() int { - return m.Size() + return xxx_messageInfo_IHaveBlockProposal.Size(m) } func (m *IHaveBlockProposal) XXX_DiscardUnknown() { xxx_messageInfo_IHaveBlockProposal.DiscardUnknown(m) @@ -580,37 +577,32 @@ func (m *IHaveBlockProposal) GetBlockHash() []byte { } type RequestBlockProposal struct { - BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - Type RequestTransactionType `protobuf:"varint,2,opt,name=type,proto3,enum=pb.RequestTransactionType" json:"type,omitempty"` - ShortHashSalt []byte `protobuf:"bytes,3,opt,name=short_hash_salt,json=shortHashSalt,proto3" json:"short_hash_salt,omitempty"` - ShortHashSize uint32 `protobuf:"varint,4,opt,name=short_hash_size,json=shortHashSize,proto3" json:"short_hash_size,omitempty"` -} - -func (m *RequestBlockProposal) Reset() { *m = RequestBlockProposal{} } -func (*RequestBlockProposal) ProtoMessage() {} + BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Type RequestTransactionType `protobuf:"varint,2,opt,name=type,proto3,enum=pb.RequestTransactionType" json:"type,omitempty"` + ShortHashSalt []byte `protobuf:"bytes,3,opt,name=short_hash_salt,json=shortHashSalt,proto3" json:"short_hash_salt,omitempty"` + ShortHashSize uint32 `protobuf:"varint,4,opt,name=short_hash_size,json=shortHashSize,proto3" json:"short_hash_size,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestBlockProposal) Reset() { *m = RequestBlockProposal{} } +func (m *RequestBlockProposal) String() string { return proto.CompactTextString(m) } +func (*RequestBlockProposal) ProtoMessage() {} func (*RequestBlockProposal) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{4} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{4} } func (m *RequestBlockProposal) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RequestBlockProposal.Unmarshal(m, b) } func (m *RequestBlockProposal) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestBlockProposal.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RequestBlockProposal.Marshal(b, m, deterministic) } func (dst *RequestBlockProposal) XXX_Merge(src proto.Message) { xxx_messageInfo_RequestBlockProposal.Merge(dst, src) } func (m *RequestBlockProposal) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RequestBlockProposal.Size(m) } func (m *RequestBlockProposal) XXX_DiscardUnknown() { xxx_messageInfo_RequestBlockProposal.DiscardUnknown(m) @@ -629,7 +621,7 @@ func (m *RequestBlockProposal) GetType() RequestTransactionType { if m != nil { return m.Type } - return REQUEST_FULL_TRANSACTION + return RequestTransactionType_REQUEST_FULL_TRANSACTION } func (m *RequestBlockProposal) GetShortHashSalt() []byte { @@ -647,35 +639,30 @@ func (m *RequestBlockProposal) GetShortHashSize() uint32 { } type RequestBlockProposalReply struct { - Block *Block `protobuf:"bytes,1,opt,name=block" json:"block,omitempty"` - TransactionsHash [][]byte `protobuf:"bytes,2,rep,name=transactions_hash,json=transactionsHash" json:"transactions_hash,omitempty"` + Block *Block `protobuf:"bytes,1,opt,name=block,proto3" json:"block,omitempty"` + TransactionsHash [][]byte `protobuf:"bytes,2,rep,name=transactions_hash,json=transactionsHash,proto3" json:"transactions_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RequestBlockProposalReply) Reset() { *m = RequestBlockProposalReply{} } -func (*RequestBlockProposalReply) ProtoMessage() {} +func (m *RequestBlockProposalReply) Reset() { *m = RequestBlockProposalReply{} } +func (m *RequestBlockProposalReply) String() string { return proto.CompactTextString(m) } +func (*RequestBlockProposalReply) ProtoMessage() {} func (*RequestBlockProposalReply) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{5} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{5} } func (m *RequestBlockProposalReply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RequestBlockProposalReply.Unmarshal(m, b) } func (m *RequestBlockProposalReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestBlockProposalReply.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RequestBlockProposalReply.Marshal(b, m, deterministic) } func (dst *RequestBlockProposalReply) XXX_Merge(src proto.Message) { xxx_messageInfo_RequestBlockProposalReply.Merge(dst, src) } func (m *RequestBlockProposalReply) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RequestBlockProposalReply.Size(m) } func (m *RequestBlockProposalReply) XXX_DiscardUnknown() { xxx_messageInfo_RequestBlockProposalReply.DiscardUnknown(m) @@ -698,38 +685,33 @@ func (m *RequestBlockProposalReply) GetTransactionsHash() [][]byte { } type RequestProposalTransactions struct { - BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - Type RequestTransactionType `protobuf:"varint,2,opt,name=type,proto3,enum=pb.RequestTransactionType" json:"type,omitempty"` - ShortHashSalt []byte `protobuf:"bytes,3,opt,name=short_hash_salt,json=shortHashSalt,proto3" json:"short_hash_salt,omitempty"` - ShortHashSize uint32 `protobuf:"varint,4,opt,name=short_hash_size,json=shortHashSize,proto3" json:"short_hash_size,omitempty"` - TransactionsHash [][]byte `protobuf:"bytes,5,rep,name=transactions_hash,json=transactionsHash" json:"transactions_hash,omitempty"` -} - -func (m *RequestProposalTransactions) Reset() { *m = RequestProposalTransactions{} } -func (*RequestProposalTransactions) ProtoMessage() {} + BlockHash []byte `protobuf:"bytes,1,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + Type RequestTransactionType `protobuf:"varint,2,opt,name=type,proto3,enum=pb.RequestTransactionType" json:"type,omitempty"` + ShortHashSalt []byte `protobuf:"bytes,3,opt,name=short_hash_salt,json=shortHashSalt,proto3" json:"short_hash_salt,omitempty"` + ShortHashSize uint32 `protobuf:"varint,4,opt,name=short_hash_size,json=shortHashSize,proto3" json:"short_hash_size,omitempty"` + TransactionsHash [][]byte `protobuf:"bytes,5,rep,name=transactions_hash,json=transactionsHash,proto3" json:"transactions_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *RequestProposalTransactions) Reset() { *m = RequestProposalTransactions{} } +func (m *RequestProposalTransactions) String() string { return proto.CompactTextString(m) } +func (*RequestProposalTransactions) ProtoMessage() {} func (*RequestProposalTransactions) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{6} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{6} } func (m *RequestProposalTransactions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RequestProposalTransactions.Unmarshal(m, b) } func (m *RequestProposalTransactions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestProposalTransactions.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RequestProposalTransactions.Marshal(b, m, deterministic) } func (dst *RequestProposalTransactions) XXX_Merge(src proto.Message) { xxx_messageInfo_RequestProposalTransactions.Merge(dst, src) } func (m *RequestProposalTransactions) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RequestProposalTransactions.Size(m) } func (m *RequestProposalTransactions) XXX_DiscardUnknown() { xxx_messageInfo_RequestProposalTransactions.DiscardUnknown(m) @@ -748,7 +730,7 @@ func (m *RequestProposalTransactions) GetType() RequestTransactionType { if m != nil { return m.Type } - return REQUEST_FULL_TRANSACTION + return RequestTransactionType_REQUEST_FULL_TRANSACTION } func (m *RequestProposalTransactions) GetShortHashSalt() []byte { @@ -773,34 +755,29 @@ func (m *RequestProposalTransactions) GetTransactionsHash() [][]byte { } type RequestProposalTransactionsReply struct { - Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions" json:"transactions,omitempty"` + Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RequestProposalTransactionsReply) Reset() { *m = RequestProposalTransactionsReply{} } -func (*RequestProposalTransactionsReply) ProtoMessage() {} +func (m *RequestProposalTransactionsReply) Reset() { *m = RequestProposalTransactionsReply{} } +func (m *RequestProposalTransactionsReply) String() string { return proto.CompactTextString(m) } +func (*RequestProposalTransactionsReply) ProtoMessage() {} func (*RequestProposalTransactionsReply) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{7} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{7} } func (m *RequestProposalTransactionsReply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RequestProposalTransactionsReply.Unmarshal(m, b) } func (m *RequestProposalTransactionsReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestProposalTransactionsReply.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RequestProposalTransactionsReply.Marshal(b, m, deterministic) } func (dst *RequestProposalTransactionsReply) XXX_Merge(src proto.Message) { xxx_messageInfo_RequestProposalTransactionsReply.Merge(dst, src) } func (m *RequestProposalTransactionsReply) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RequestProposalTransactionsReply.Size(m) } func (m *RequestProposalTransactionsReply) XXX_DiscardUnknown() { xxx_messageInfo_RequestProposalTransactionsReply.DiscardUnknown(m) @@ -816,33 +793,28 @@ func (m *RequestProposalTransactionsReply) GetTransactions() []*Transaction { } type GetConsensusState struct { + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GetConsensusState) Reset() { *m = GetConsensusState{} } -func (*GetConsensusState) ProtoMessage() {} +func (m *GetConsensusState) Reset() { *m = GetConsensusState{} } +func (m *GetConsensusState) String() string { return proto.CompactTextString(m) } +func (*GetConsensusState) ProtoMessage() {} func (*GetConsensusState) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{8} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{8} } func (m *GetConsensusState) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetConsensusState.Unmarshal(m, b) } func (m *GetConsensusState) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetConsensusState.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetConsensusState.Marshal(b, m, deterministic) } func (dst *GetConsensusState) XXX_Merge(src proto.Message) { xxx_messageInfo_GetConsensusState.Merge(dst, src) } func (m *GetConsensusState) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetConsensusState.Size(m) } func (m *GetConsensusState) XXX_DiscardUnknown() { xxx_messageInfo_GetConsensusState.DiscardUnknown(m) @@ -851,38 +823,33 @@ func (m *GetConsensusState) XXX_DiscardUnknown() { var xxx_messageInfo_GetConsensusState proto.InternalMessageInfo type GetConsensusStateReply struct { - LedgerBlockHash []byte `protobuf:"bytes,2,opt,name=ledger_block_hash,json=ledgerBlockHash,proto3" json:"ledger_block_hash,omitempty"` - LedgerHeight uint32 `protobuf:"varint,1,opt,name=ledger_height,json=ledgerHeight,proto3" json:"ledger_height,omitempty"` - ConsensusHeight uint32 `protobuf:"varint,3,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height,omitempty"` - MinVerifiableHeight uint32 `protobuf:"varint,5,opt,name=min_verifiable_height,json=minVerifiableHeight,proto3" json:"min_verifiable_height,omitempty"` - SyncState SyncState `protobuf:"varint,4,opt,name=sync_state,json=syncState,proto3,enum=pb.SyncState" json:"sync_state,omitempty"` -} - -func (m *GetConsensusStateReply) Reset() { *m = GetConsensusStateReply{} } -func (*GetConsensusStateReply) ProtoMessage() {} + LedgerBlockHash []byte `protobuf:"bytes,2,opt,name=ledger_block_hash,json=ledgerBlockHash,proto3" json:"ledger_block_hash,omitempty"` + LedgerHeight uint32 `protobuf:"varint,1,opt,name=ledger_height,json=ledgerHeight,proto3" json:"ledger_height,omitempty"` + ConsensusHeight uint32 `protobuf:"varint,3,opt,name=consensus_height,json=consensusHeight,proto3" json:"consensus_height,omitempty"` + MinVerifiableHeight uint32 `protobuf:"varint,5,opt,name=min_verifiable_height,json=minVerifiableHeight,proto3" json:"min_verifiable_height,omitempty"` + SyncState SyncState `protobuf:"varint,4,opt,name=sync_state,json=syncState,proto3,enum=pb.SyncState" json:"sync_state,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *GetConsensusStateReply) Reset() { *m = GetConsensusStateReply{} } +func (m *GetConsensusStateReply) String() string { return proto.CompactTextString(m) } +func (*GetConsensusStateReply) ProtoMessage() {} func (*GetConsensusStateReply) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{9} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{9} } func (m *GetConsensusStateReply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetConsensusStateReply.Unmarshal(m, b) } func (m *GetConsensusStateReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetConsensusStateReply.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetConsensusStateReply.Marshal(b, m, deterministic) } func (dst *GetConsensusStateReply) XXX_Merge(src proto.Message) { xxx_messageInfo_GetConsensusStateReply.Merge(dst, src) } func (m *GetConsensusStateReply) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetConsensusStateReply.Size(m) } func (m *GetConsensusStateReply) XXX_DiscardUnknown() { xxx_messageInfo_GetConsensusStateReply.DiscardUnknown(m) @@ -922,39 +889,34 @@ func (m *GetConsensusStateReply) GetSyncState() SyncState { if m != nil { return m.SyncState } - return WAIT_FOR_SYNCING + return SyncState_WAIT_FOR_SYNCING } type GetBlockHeaders struct { - StartHeight uint32 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` - EndHeight uint32 `protobuf:"varint,2,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + StartHeight uint32 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + EndHeight uint32 `protobuf:"varint,2,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GetBlockHeaders) Reset() { *m = GetBlockHeaders{} } -func (*GetBlockHeaders) ProtoMessage() {} +func (m *GetBlockHeaders) Reset() { *m = GetBlockHeaders{} } +func (m *GetBlockHeaders) String() string { return proto.CompactTextString(m) } +func (*GetBlockHeaders) ProtoMessage() {} func (*GetBlockHeaders) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{10} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{10} } func (m *GetBlockHeaders) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetBlockHeaders.Unmarshal(m, b) } func (m *GetBlockHeaders) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetBlockHeaders.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetBlockHeaders.Marshal(b, m, deterministic) } func (dst *GetBlockHeaders) XXX_Merge(src proto.Message) { xxx_messageInfo_GetBlockHeaders.Merge(dst, src) } func (m *GetBlockHeaders) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetBlockHeaders.Size(m) } func (m *GetBlockHeaders) XXX_DiscardUnknown() { xxx_messageInfo_GetBlockHeaders.DiscardUnknown(m) @@ -977,34 +939,29 @@ func (m *GetBlockHeaders) GetEndHeight() uint32 { } type GetBlockHeadersReply struct { - BlockHeaders []*Header `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders" json:"block_headers,omitempty"` + BlockHeaders []*Header `protobuf:"bytes,1,rep,name=block_headers,json=blockHeaders,proto3" json:"block_headers,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GetBlockHeadersReply) Reset() { *m = GetBlockHeadersReply{} } -func (*GetBlockHeadersReply) ProtoMessage() {} +func (m *GetBlockHeadersReply) Reset() { *m = GetBlockHeadersReply{} } +func (m *GetBlockHeadersReply) String() string { return proto.CompactTextString(m) } +func (*GetBlockHeadersReply) ProtoMessage() {} func (*GetBlockHeadersReply) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{11} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{11} } func (m *GetBlockHeadersReply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetBlockHeadersReply.Unmarshal(m, b) } func (m *GetBlockHeadersReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetBlockHeadersReply.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetBlockHeadersReply.Marshal(b, m, deterministic) } func (dst *GetBlockHeadersReply) XXX_Merge(src proto.Message) { xxx_messageInfo_GetBlockHeadersReply.Merge(dst, src) } func (m *GetBlockHeadersReply) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetBlockHeadersReply.Size(m) } func (m *GetBlockHeadersReply) XXX_DiscardUnknown() { xxx_messageInfo_GetBlockHeadersReply.DiscardUnknown(m) @@ -1020,35 +977,30 @@ func (m *GetBlockHeadersReply) GetBlockHeaders() []*Header { } type GetBlocks struct { - StartHeight uint32 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` - EndHeight uint32 `protobuf:"varint,2,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + StartHeight uint32 `protobuf:"varint,1,opt,name=start_height,json=startHeight,proto3" json:"start_height,omitempty"` + EndHeight uint32 `protobuf:"varint,2,opt,name=end_height,json=endHeight,proto3" json:"end_height,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GetBlocks) Reset() { *m = GetBlocks{} } -func (*GetBlocks) ProtoMessage() {} +func (m *GetBlocks) Reset() { *m = GetBlocks{} } +func (m *GetBlocks) String() string { return proto.CompactTextString(m) } +func (*GetBlocks) ProtoMessage() {} func (*GetBlocks) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{12} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{12} } func (m *GetBlocks) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetBlocks.Unmarshal(m, b) } func (m *GetBlocks) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetBlocks.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetBlocks.Marshal(b, m, deterministic) } func (dst *GetBlocks) XXX_Merge(src proto.Message) { xxx_messageInfo_GetBlocks.Merge(dst, src) } func (m *GetBlocks) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetBlocks.Size(m) } func (m *GetBlocks) XXX_DiscardUnknown() { xxx_messageInfo_GetBlocks.DiscardUnknown(m) @@ -1071,34 +1023,29 @@ func (m *GetBlocks) GetEndHeight() uint32 { } type GetBlocksReply struct { - Blocks []*Block `protobuf:"bytes,1,rep,name=blocks" json:"blocks,omitempty"` + Blocks []*Block `protobuf:"bytes,1,rep,name=blocks,proto3" json:"blocks,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GetBlocksReply) Reset() { *m = GetBlocksReply{} } -func (*GetBlocksReply) ProtoMessage() {} +func (m *GetBlocksReply) Reset() { *m = GetBlocksReply{} } +func (m *GetBlocksReply) String() string { return proto.CompactTextString(m) } +func (*GetBlocksReply) ProtoMessage() {} func (*GetBlocksReply) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{13} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{13} } func (m *GetBlocksReply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GetBlocksReply.Unmarshal(m, b) } func (m *GetBlocksReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GetBlocksReply.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GetBlocksReply.Marshal(b, m, deterministic) } func (dst *GetBlocksReply) XXX_Merge(src proto.Message) { xxx_messageInfo_GetBlocksReply.Merge(dst, src) } func (m *GetBlocksReply) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GetBlocksReply.Size(m) } func (m *GetBlocksReply) XXX_DiscardUnknown() { xxx_messageInfo_GetBlocksReply.DiscardUnknown(m) @@ -1121,36 +1068,31 @@ type Relay struct { MaxHoldingSeconds uint32 `protobuf:"varint,5,opt,name=max_holding_seconds,json=maxHoldingSeconds,proto3" json:"max_holding_seconds,omitempty"` // It is important to use block hash instead of block height here to allow // node in syncing state to be able to sign the sigchain elem. - BlockHash []byte `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - LastHash []byte `protobuf:"bytes,8,opt,name=last_hash,json=lastHash,proto3" json:"last_hash,omitempty"` - SigChainLen uint32 `protobuf:"varint,9,opt,name=sig_chain_len,json=sigChainLen,proto3" json:"sig_chain_len,omitempty"` + BlockHash []byte `protobuf:"bytes,7,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + LastHash []byte `protobuf:"bytes,8,opt,name=last_hash,json=lastHash,proto3" json:"last_hash,omitempty"` + SigChainLen uint32 `protobuf:"varint,9,opt,name=sig_chain_len,json=sigChainLen,proto3" json:"sig_chain_len,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Relay) Reset() { *m = Relay{} } -func (*Relay) ProtoMessage() {} +func (m *Relay) Reset() { *m = Relay{} } +func (m *Relay) String() string { return proto.CompactTextString(m) } +func (*Relay) ProtoMessage() {} func (*Relay) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{14} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{14} } func (m *Relay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Relay.Unmarshal(m, b) } func (m *Relay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Relay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Relay.Marshal(b, m, deterministic) } func (dst *Relay) XXX_Merge(src proto.Message) { xxx_messageInfo_Relay.Merge(dst, src) } func (m *Relay) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Relay.Size(m) } func (m *Relay) XXX_DiscardUnknown() { xxx_messageInfo_Relay.DiscardUnknown(m) @@ -1215,34 +1157,29 @@ func (m *Relay) GetSigChainLen() uint32 { } type Transactions struct { - Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions" json:"transactions,omitempty"` + Transactions []*Transaction `protobuf:"bytes,1,rep,name=transactions,proto3" json:"transactions,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Transactions) Reset() { *m = Transactions{} } -func (*Transactions) ProtoMessage() {} +func (m *Transactions) Reset() { *m = Transactions{} } +func (m *Transactions) String() string { return proto.CompactTextString(m) } +func (*Transactions) ProtoMessage() {} func (*Transactions) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{15} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{15} } func (m *Transactions) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Transactions.Unmarshal(m, b) } func (m *Transactions) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Transactions.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Transactions.Marshal(b, m, deterministic) } func (dst *Transactions) XXX_Merge(src proto.Message) { xxx_messageInfo_Transactions.Merge(dst, src) } func (m *Transactions) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Transactions.Size(m) } func (m *Transactions) XXX_DiscardUnknown() { xxx_messageInfo_Transactions.DiscardUnknown(m) @@ -1258,35 +1195,30 @@ func (m *Transactions) GetTransactions() []*Transaction { } type BacktrackSignatureChain struct { - SigChainElems []*SigChainElem `protobuf:"bytes,1,rep,name=sig_chain_elems,json=sigChainElems" json:"sig_chain_elems,omitempty"` - Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + SigChainElems []*SigChainElem `protobuf:"bytes,1,rep,name=sig_chain_elems,json=sigChainElems,proto3" json:"sig_chain_elems,omitempty"` + Hash []byte `protobuf:"bytes,2,opt,name=hash,proto3" json:"hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *BacktrackSignatureChain) Reset() { *m = BacktrackSignatureChain{} } -func (*BacktrackSignatureChain) ProtoMessage() {} +func (m *BacktrackSignatureChain) Reset() { *m = BacktrackSignatureChain{} } +func (m *BacktrackSignatureChain) String() string { return proto.CompactTextString(m) } +func (*BacktrackSignatureChain) ProtoMessage() {} func (*BacktrackSignatureChain) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{16} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{16} } func (m *BacktrackSignatureChain) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_BacktrackSignatureChain.Unmarshal(m, b) } func (m *BacktrackSignatureChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_BacktrackSignatureChain.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_BacktrackSignatureChain.Marshal(b, m, deterministic) } func (dst *BacktrackSignatureChain) XXX_Merge(src proto.Message) { xxx_messageInfo_BacktrackSignatureChain.Merge(dst, src) } func (m *BacktrackSignatureChain) XXX_Size() int { - return m.Size() + return xxx_messageInfo_BacktrackSignatureChain.Size(m) } func (m *BacktrackSignatureChain) XXX_DiscardUnknown() { xxx_messageInfo_BacktrackSignatureChain.DiscardUnknown(m) @@ -1309,35 +1241,30 @@ func (m *BacktrackSignatureChain) GetHash() []byte { } type IHaveSignatureChainTransaction struct { - Height uint32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` - SignatureHash []byte `protobuf:"bytes,2,opt,name=signature_hash,json=signatureHash,proto3" json:"signature_hash,omitempty"` + Height uint32 `protobuf:"varint,1,opt,name=height,proto3" json:"height,omitempty"` + SignatureHash []byte `protobuf:"bytes,2,opt,name=signature_hash,json=signatureHash,proto3" json:"signature_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *IHaveSignatureChainTransaction) Reset() { *m = IHaveSignatureChainTransaction{} } -func (*IHaveSignatureChainTransaction) ProtoMessage() {} +func (m *IHaveSignatureChainTransaction) Reset() { *m = IHaveSignatureChainTransaction{} } +func (m *IHaveSignatureChainTransaction) String() string { return proto.CompactTextString(m) } +func (*IHaveSignatureChainTransaction) ProtoMessage() {} func (*IHaveSignatureChainTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{17} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{17} } func (m *IHaveSignatureChainTransaction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_IHaveSignatureChainTransaction.Unmarshal(m, b) } func (m *IHaveSignatureChainTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IHaveSignatureChainTransaction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_IHaveSignatureChainTransaction.Marshal(b, m, deterministic) } func (dst *IHaveSignatureChainTransaction) XXX_Merge(src proto.Message) { xxx_messageInfo_IHaveSignatureChainTransaction.Merge(dst, src) } func (m *IHaveSignatureChainTransaction) XXX_Size() int { - return m.Size() + return xxx_messageInfo_IHaveSignatureChainTransaction.Size(m) } func (m *IHaveSignatureChainTransaction) XXX_DiscardUnknown() { xxx_messageInfo_IHaveSignatureChainTransaction.DiscardUnknown(m) @@ -1360,34 +1287,29 @@ func (m *IHaveSignatureChainTransaction) GetSignatureHash() []byte { } type RequestSignatureChainTransaction struct { - SignatureHash []byte `protobuf:"bytes,1,opt,name=signature_hash,json=signatureHash,proto3" json:"signature_hash,omitempty"` + SignatureHash []byte `protobuf:"bytes,1,opt,name=signature_hash,json=signatureHash,proto3" json:"signature_hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RequestSignatureChainTransaction) Reset() { *m = RequestSignatureChainTransaction{} } -func (*RequestSignatureChainTransaction) ProtoMessage() {} +func (m *RequestSignatureChainTransaction) Reset() { *m = RequestSignatureChainTransaction{} } +func (m *RequestSignatureChainTransaction) String() string { return proto.CompactTextString(m) } +func (*RequestSignatureChainTransaction) ProtoMessage() {} func (*RequestSignatureChainTransaction) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{18} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{18} } func (m *RequestSignatureChainTransaction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RequestSignatureChainTransaction.Unmarshal(m, b) } func (m *RequestSignatureChainTransaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestSignatureChainTransaction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RequestSignatureChainTransaction.Marshal(b, m, deterministic) } func (dst *RequestSignatureChainTransaction) XXX_Merge(src proto.Message) { xxx_messageInfo_RequestSignatureChainTransaction.Merge(dst, src) } func (m *RequestSignatureChainTransaction) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RequestSignatureChainTransaction.Size(m) } func (m *RequestSignatureChainTransaction) XXX_DiscardUnknown() { xxx_messageInfo_RequestSignatureChainTransaction.DiscardUnknown(m) @@ -1403,34 +1325,29 @@ func (m *RequestSignatureChainTransaction) GetSignatureHash() []byte { } type RequestSignatureChainTransactionReply struct { - Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction" json:"transaction,omitempty"` + Transaction *Transaction `protobuf:"bytes,1,opt,name=transaction,proto3" json:"transaction,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RequestSignatureChainTransactionReply) Reset() { *m = RequestSignatureChainTransactionReply{} } -func (*RequestSignatureChainTransactionReply) ProtoMessage() {} +func (m *RequestSignatureChainTransactionReply) Reset() { *m = RequestSignatureChainTransactionReply{} } +func (m *RequestSignatureChainTransactionReply) String() string { return proto.CompactTextString(m) } +func (*RequestSignatureChainTransactionReply) ProtoMessage() {} func (*RequestSignatureChainTransactionReply) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{19} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{19} } func (m *RequestSignatureChainTransactionReply) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RequestSignatureChainTransactionReply.Unmarshal(m, b) } func (m *RequestSignatureChainTransactionReply) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RequestSignatureChainTransactionReply.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RequestSignatureChainTransactionReply.Marshal(b, m, deterministic) } func (dst *RequestSignatureChainTransactionReply) XXX_Merge(src proto.Message) { xxx_messageInfo_RequestSignatureChainTransactionReply.Merge(dst, src) } func (m *RequestSignatureChainTransactionReply) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RequestSignatureChainTransactionReply.Size(m) } func (m *RequestSignatureChainTransactionReply) XXX_DiscardUnknown() { xxx_messageInfo_RequestSignatureChainTransactionReply.DiscardUnknown(m) @@ -1446,34 +1363,29 @@ func (m *RequestSignatureChainTransactionReply) GetTransaction() *Transaction { } type PinSignatureChain struct { - Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *PinSignatureChain) Reset() { *m = PinSignatureChain{} } -func (*PinSignatureChain) ProtoMessage() {} +func (m *PinSignatureChain) Reset() { *m = PinSignatureChain{} } +func (m *PinSignatureChain) String() string { return proto.CompactTextString(m) } +func (*PinSignatureChain) ProtoMessage() {} func (*PinSignatureChain) Descriptor() ([]byte, []int) { - return fileDescriptor_nodemessage_36b58b92b5905ce8, []int{20} + return fileDescriptor_nodemessage_e8ada71a29f9f0b3, []int{20} } func (m *PinSignatureChain) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_PinSignatureChain.Unmarshal(m, b) } func (m *PinSignatureChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_PinSignatureChain.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_PinSignatureChain.Marshal(b, m, deterministic) } func (dst *PinSignatureChain) XXX_Merge(src proto.Message) { xxx_messageInfo_PinSignatureChain.Merge(dst, src) } func (m *PinSignatureChain) XXX_Size() int { - return m.Size() + return xxx_messageInfo_PinSignatureChain.Size(m) } func (m *PinSignatureChain) XXX_DiscardUnknown() { xxx_messageInfo_PinSignatureChain.DiscardUnknown(m) @@ -1520,5162 +1432,109 @@ func init() { proto.RegisterEnum("pb.AllowedBroadcastTreeMessageType", AllowedBroadcastTreeMessageType_name, AllowedBroadcastTreeMessageType_value) proto.RegisterEnum("pb.RequestTransactionType", RequestTransactionType_name, RequestTransactionType_value) } -func (x MessageType) String() string { - s, ok := MessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedSignedMessageType) String() string { - s, ok := AllowedSignedMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedUnsignedMessageType) String() string { - s, ok := AllowedUnsignedMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedDirectMessageType) String() string { - s, ok := AllowedDirectMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedRelayMessageType) String() string { - s, ok := AllowedRelayMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedBroadcastPushMessageType) String() string { - s, ok := AllowedBroadcastPushMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedBroadcastPullMessageType) String() string { - s, ok := AllowedBroadcastPullMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x AllowedBroadcastTreeMessageType) String() string { - s, ok := AllowedBroadcastTreeMessageType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (x RequestTransactionType) String() string { - s, ok := RequestTransactionType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *UnsignedMessage) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UnsignedMessage) - if !ok { - that2, ok := that.(UnsignedMessage) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.MessageType != that1.MessageType { - return false - } - if !bytes.Equal(this.Message, that1.Message) { - return false - } - return true -} -func (this *SignedMessage) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SignedMessage) - if !ok { - that2, ok := that.(SignedMessage) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Message, that1.Message) { - return false - } - if !bytes.Equal(this.Signature, that1.Signature) { - return false - } - return true -} -func (this *Vote) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Vote) - if !ok { - that2, ok := that.(Vote) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Height != that1.Height { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - return true -} -func (this *IHaveBlockProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*IHaveBlockProposal) - if !ok { - that2, ok := that.(IHaveBlockProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Height != that1.Height { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - return true -} -func (this *RequestBlockProposal) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RequestBlockProposal) - if !ok { - that2, ok := that.(RequestBlockProposal) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - if this.Type != that1.Type { - return false - } - if !bytes.Equal(this.ShortHashSalt, that1.ShortHashSalt) { - return false - } - if this.ShortHashSize != that1.ShortHashSize { - return false - } - return true -} -func (this *RequestBlockProposalReply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RequestBlockProposalReply) - if !ok { - that2, ok := that.(RequestBlockProposalReply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Block.Equal(that1.Block) { - return false - } - if len(this.TransactionsHash) != len(that1.TransactionsHash) { - return false - } - for i := range this.TransactionsHash { - if !bytes.Equal(this.TransactionsHash[i], that1.TransactionsHash[i]) { - return false - } - } - return true -} -func (this *RequestProposalTransactions) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RequestProposalTransactions) - if !ok { - that2, ok := that.(RequestProposalTransactions) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - if this.Type != that1.Type { - return false - } - if !bytes.Equal(this.ShortHashSalt, that1.ShortHashSalt) { - return false - } - if this.ShortHashSize != that1.ShortHashSize { - return false - } - if len(this.TransactionsHash) != len(that1.TransactionsHash) { - return false - } - for i := range this.TransactionsHash { - if !bytes.Equal(this.TransactionsHash[i], that1.TransactionsHash[i]) { - return false - } - } - return true -} -func (this *RequestProposalTransactionsReply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RequestProposalTransactionsReply) - if !ok { - that2, ok := that.(RequestProposalTransactionsReply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Transactions) != len(that1.Transactions) { - return false - } - for i := range this.Transactions { - if !this.Transactions[i].Equal(that1.Transactions[i]) { - return false - } - } - return true -} -func (this *GetConsensusState) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GetConsensusState) - if !ok { - that2, ok := that.(GetConsensusState) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - return true -} -func (this *GetConsensusStateReply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GetConsensusStateReply) - if !ok { - that2, ok := that.(GetConsensusStateReply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.LedgerBlockHash, that1.LedgerBlockHash) { - return false - } - if this.LedgerHeight != that1.LedgerHeight { - return false - } - if this.ConsensusHeight != that1.ConsensusHeight { - return false - } - if this.MinVerifiableHeight != that1.MinVerifiableHeight { - return false - } - if this.SyncState != that1.SyncState { - return false - } - return true -} -func (this *GetBlockHeaders) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GetBlockHeaders) - if !ok { - that2, ok := that.(GetBlockHeaders) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.StartHeight != that1.StartHeight { - return false - } - if this.EndHeight != that1.EndHeight { - return false - } - return true -} -func (this *GetBlockHeadersReply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GetBlockHeadersReply) - if !ok { - that2, ok := that.(GetBlockHeadersReply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.BlockHeaders) != len(that1.BlockHeaders) { - return false - } - for i := range this.BlockHeaders { - if !this.BlockHeaders[i].Equal(that1.BlockHeaders[i]) { - return false - } - } - return true -} -func (this *GetBlocks) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GetBlocks) - if !ok { - that2, ok := that.(GetBlocks) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.StartHeight != that1.StartHeight { - return false - } - if this.EndHeight != that1.EndHeight { - return false - } - return true -} -func (this *GetBlocksReply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GetBlocksReply) - if !ok { - that2, ok := that.(GetBlocksReply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Blocks) != len(that1.Blocks) { - return false - } - for i := range this.Blocks { - if !this.Blocks[i].Equal(that1.Blocks[i]) { - return false - } - } - return true -} -func (this *Relay) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Relay) - if !ok { - that2, ok := that.(Relay) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.SrcIdentifier != that1.SrcIdentifier { - return false - } - if !bytes.Equal(this.SrcPubkey, that1.SrcPubkey) { - return false - } - if !bytes.Equal(this.DestId, that1.DestId) { - return false - } - if !bytes.Equal(this.Payload, that1.Payload) { - return false - } - if this.MaxHoldingSeconds != that1.MaxHoldingSeconds { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - if !bytes.Equal(this.LastHash, that1.LastHash) { - return false - } - if this.SigChainLen != that1.SigChainLen { - return false - } - return true -} -func (this *Transactions) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Transactions) - if !ok { - that2, ok := that.(Transactions) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.Transactions) != len(that1.Transactions) { - return false - } - for i := range this.Transactions { - if !this.Transactions[i].Equal(that1.Transactions[i]) { - return false - } - } - return true -} -func (this *BacktrackSignatureChain) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*BacktrackSignatureChain) - if !ok { - that2, ok := that.(BacktrackSignatureChain) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if len(this.SigChainElems) != len(that1.SigChainElems) { - return false - } - for i := range this.SigChainElems { - if !this.SigChainElems[i].Equal(that1.SigChainElems[i]) { - return false - } - } - if !bytes.Equal(this.Hash, that1.Hash) { - return false - } - return true -} -func (this *IHaveSignatureChainTransaction) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*IHaveSignatureChainTransaction) - if !ok { - that2, ok := that.(IHaveSignatureChainTransaction) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Height != that1.Height { - return false - } - if !bytes.Equal(this.SignatureHash, that1.SignatureHash) { - return false - } - return true -} -func (this *RequestSignatureChainTransaction) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RequestSignatureChainTransaction) - if !ok { - that2, ok := that.(RequestSignatureChainTransaction) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.SignatureHash, that1.SignatureHash) { - return false - } - return true -} -func (this *RequestSignatureChainTransactionReply) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RequestSignatureChainTransactionReply) - if !ok { - that2, ok := that.(RequestSignatureChainTransactionReply) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Transaction.Equal(that1.Transaction) { - return false - } - return true -} -func (this *PinSignatureChain) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*PinSignatureChain) - if !ok { - that2, ok := that.(PinSignatureChain) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Hash, that1.Hash) { - return false - } - return true -} -func (this *UnsignedMessage) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.UnsignedMessage{") - s = append(s, "MessageType: "+fmt.Sprintf("%#v", this.MessageType)+",\n") - s = append(s, "Message: "+fmt.Sprintf("%#v", this.Message)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SignedMessage) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.SignedMessage{") - s = append(s, "Message: "+fmt.Sprintf("%#v", this.Message)+",\n") - s = append(s, "Signature: "+fmt.Sprintf("%#v", this.Signature)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Vote) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Vote{") - s = append(s, "Height: "+fmt.Sprintf("%#v", this.Height)+",\n") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *IHaveBlockProposal) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.IHaveBlockProposal{") - s = append(s, "Height: "+fmt.Sprintf("%#v", this.Height)+",\n") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RequestBlockProposal) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&pb.RequestBlockProposal{") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - s = append(s, "ShortHashSalt: "+fmt.Sprintf("%#v", this.ShortHashSalt)+",\n") - s = append(s, "ShortHashSize: "+fmt.Sprintf("%#v", this.ShortHashSize)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RequestBlockProposalReply) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.RequestBlockProposalReply{") - if this.Block != nil { - s = append(s, "Block: "+fmt.Sprintf("%#v", this.Block)+",\n") - } - s = append(s, "TransactionsHash: "+fmt.Sprintf("%#v", this.TransactionsHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RequestProposalTransactions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&pb.RequestProposalTransactions{") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - s = append(s, "ShortHashSalt: "+fmt.Sprintf("%#v", this.ShortHashSalt)+",\n") - s = append(s, "ShortHashSize: "+fmt.Sprintf("%#v", this.ShortHashSize)+",\n") - s = append(s, "TransactionsHash: "+fmt.Sprintf("%#v", this.TransactionsHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RequestProposalTransactionsReply) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.RequestProposalTransactionsReply{") - if this.Transactions != nil { - s = append(s, "Transactions: "+fmt.Sprintf("%#v", this.Transactions)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GetConsensusState) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 4) - s = append(s, "&pb.GetConsensusState{") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GetConsensusStateReply) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&pb.GetConsensusStateReply{") - s = append(s, "LedgerBlockHash: "+fmt.Sprintf("%#v", this.LedgerBlockHash)+",\n") - s = append(s, "LedgerHeight: "+fmt.Sprintf("%#v", this.LedgerHeight)+",\n") - s = append(s, "ConsensusHeight: "+fmt.Sprintf("%#v", this.ConsensusHeight)+",\n") - s = append(s, "MinVerifiableHeight: "+fmt.Sprintf("%#v", this.MinVerifiableHeight)+",\n") - s = append(s, "SyncState: "+fmt.Sprintf("%#v", this.SyncState)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GetBlockHeaders) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.GetBlockHeaders{") - s = append(s, "StartHeight: "+fmt.Sprintf("%#v", this.StartHeight)+",\n") - s = append(s, "EndHeight: "+fmt.Sprintf("%#v", this.EndHeight)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GetBlockHeadersReply) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.GetBlockHeadersReply{") - if this.BlockHeaders != nil { - s = append(s, "BlockHeaders: "+fmt.Sprintf("%#v", this.BlockHeaders)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GetBlocks) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.GetBlocks{") - s = append(s, "StartHeight: "+fmt.Sprintf("%#v", this.StartHeight)+",\n") - s = append(s, "EndHeight: "+fmt.Sprintf("%#v", this.EndHeight)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GetBlocksReply) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.GetBlocksReply{") - if this.Blocks != nil { - s = append(s, "Blocks: "+fmt.Sprintf("%#v", this.Blocks)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Relay) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 12) - s = append(s, "&pb.Relay{") - s = append(s, "SrcIdentifier: "+fmt.Sprintf("%#v", this.SrcIdentifier)+",\n") - s = append(s, "SrcPubkey: "+fmt.Sprintf("%#v", this.SrcPubkey)+",\n") - s = append(s, "DestId: "+fmt.Sprintf("%#v", this.DestId)+",\n") - s = append(s, "Payload: "+fmt.Sprintf("%#v", this.Payload)+",\n") - s = append(s, "MaxHoldingSeconds: "+fmt.Sprintf("%#v", this.MaxHoldingSeconds)+",\n") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "LastHash: "+fmt.Sprintf("%#v", this.LastHash)+",\n") - s = append(s, "SigChainLen: "+fmt.Sprintf("%#v", this.SigChainLen)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Transactions) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.Transactions{") - if this.Transactions != nil { - s = append(s, "Transactions: "+fmt.Sprintf("%#v", this.Transactions)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *BacktrackSignatureChain) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.BacktrackSignatureChain{") - if this.SigChainElems != nil { - s = append(s, "SigChainElems: "+fmt.Sprintf("%#v", this.SigChainElems)+",\n") - } - s = append(s, "Hash: "+fmt.Sprintf("%#v", this.Hash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *IHaveSignatureChainTransaction) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.IHaveSignatureChainTransaction{") - s = append(s, "Height: "+fmt.Sprintf("%#v", this.Height)+",\n") - s = append(s, "SignatureHash: "+fmt.Sprintf("%#v", this.SignatureHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RequestSignatureChainTransaction) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.RequestSignatureChainTransaction{") - s = append(s, "SignatureHash: "+fmt.Sprintf("%#v", this.SignatureHash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RequestSignatureChainTransactionReply) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.RequestSignatureChainTransactionReply{") - if this.Transaction != nil { - s = append(s, "Transaction: "+fmt.Sprintf("%#v", this.Transaction)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *PinSignatureChain) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 5) - s = append(s, "&pb.PinSignatureChain{") - s = append(s, "Hash: "+fmt.Sprintf("%#v", this.Hash)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringNodemessage(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *UnsignedMessage) 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 *UnsignedMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.MessageType != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.MessageType)) - } - if len(m.Message) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } - return i, nil -} - -func (m *SignedMessage) 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 *SignedMessage) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Message) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.Message))) - i += copy(dAtA[i:], m.Message) - } - if len(m.Signature) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - return i, nil -} - -func (m *Vote) 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 *Vote) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Height)) - } - if len(m.BlockHash) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - return i, nil -} - -func (m *IHaveBlockProposal) 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 *IHaveBlockProposal) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Height)) - } - if len(m.BlockHash) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - return i, nil -} - -func (m *RequestBlockProposal) 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 *RequestBlockProposal) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.BlockHash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - if m.Type != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Type)) - } - if len(m.ShortHashSalt) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.ShortHashSalt))) - i += copy(dAtA[i:], m.ShortHashSalt) - } - if m.ShortHashSize != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.ShortHashSize)) - } - return i, nil -} - -func (m *RequestBlockProposalReply) 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 *RequestBlockProposalReply) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Block != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Block.Size())) - n1, err := m.Block.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if len(m.TransactionsHash) > 0 { - for _, b := range m.TransactionsHash { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - return i, nil -} - -func (m *RequestProposalTransactions) 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 *RequestProposalTransactions) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.BlockHash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - if m.Type != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Type)) - } - if len(m.ShortHashSalt) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.ShortHashSalt))) - i += copy(dAtA[i:], m.ShortHashSalt) - } - if m.ShortHashSize != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.ShortHashSize)) - } - if len(m.TransactionsHash) > 0 { - for _, b := range m.TransactionsHash { - dAtA[i] = 0x2a - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(b))) - i += copy(dAtA[i:], b) - } - } - return i, nil -} - -func (m *RequestProposalTransactionsReply) 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 *RequestProposalTransactionsReply) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Transactions) > 0 { - for _, msg := range m.Transactions { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *GetConsensusState) 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 *GetConsensusState) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - return i, nil -} - -func (m *GetConsensusStateReply) 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 *GetConsensusStateReply) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.LedgerHeight != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.LedgerHeight)) - } - if len(m.LedgerBlockHash) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.LedgerBlockHash))) - i += copy(dAtA[i:], m.LedgerBlockHash) - } - if m.ConsensusHeight != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.ConsensusHeight)) - } - if m.SyncState != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.SyncState)) - } - if m.MinVerifiableHeight != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.MinVerifiableHeight)) - } - return i, nil -} - -func (m *GetBlockHeaders) 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 *GetBlockHeaders) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.StartHeight != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.StartHeight)) - } - if m.EndHeight != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.EndHeight)) - } - return i, nil -} - -func (m *GetBlockHeadersReply) 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 *GetBlockHeadersReply) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.BlockHeaders) > 0 { - for _, msg := range m.BlockHeaders { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *GetBlocks) 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 *GetBlocks) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.StartHeight != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.StartHeight)) - } - if m.EndHeight != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.EndHeight)) - } - return i, nil -} - -func (m *GetBlocksReply) 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 *GetBlocksReply) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Blocks) > 0 { - for _, msg := range m.Blocks { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *Relay) 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 *Relay) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.SrcIdentifier) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.SrcIdentifier))) - i += copy(dAtA[i:], m.SrcIdentifier) - } - if len(m.DestId) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.DestId))) - i += copy(dAtA[i:], m.DestId) - } - if len(m.Payload) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.Payload))) - i += copy(dAtA[i:], m.Payload) - } - if m.MaxHoldingSeconds != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.MaxHoldingSeconds)) - } - if len(m.SrcPubkey) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.SrcPubkey))) - i += copy(dAtA[i:], m.SrcPubkey) - } - if len(m.BlockHash) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - if len(m.LastHash) > 0 { - dAtA[i] = 0x42 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.LastHash))) - i += copy(dAtA[i:], m.LastHash) - } - if m.SigChainLen != 0 { - dAtA[i] = 0x48 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.SigChainLen)) - } - return i, nil -} - -func (m *Transactions) 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 *Transactions) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Transactions) > 0 { - for _, msg := range m.Transactions { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *BacktrackSignatureChain) 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 *BacktrackSignatureChain) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.SigChainElems) > 0 { - for _, msg := range m.SigChainElems { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - if len(m.Hash) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) - } - return i, nil -} - -func (m *IHaveSignatureChainTransaction) 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 *IHaveSignatureChainTransaction) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Height != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Height)) - } - if len(m.SignatureHash) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.SignatureHash))) - i += copy(dAtA[i:], m.SignatureHash) - } - return i, nil -} - -func (m *RequestSignatureChainTransaction) 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 *RequestSignatureChainTransaction) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.SignatureHash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.SignatureHash))) - i += copy(dAtA[i:], m.SignatureHash) - } - return i, nil -} - -func (m *RequestSignatureChainTransactionReply) 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 *RequestSignatureChainTransactionReply) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Transaction != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(m.Transaction.Size())) - n2, err := m.Transaction.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - return i, nil -} - -func (m *PinSignatureChain) 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 *PinSignatureChain) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Hash) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintNodemessage(dAtA, i, uint64(len(m.Hash))) - i += copy(dAtA[i:], m.Hash) - } - return i, nil -} - -func encodeVarintNodemessage(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 NewPopulatedUnsignedMessage(r randyNodemessage, easy bool) *UnsignedMessage { - this := &UnsignedMessage{} - this.MessageType = MessageType([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19}[r.Intn(20)]) - v1 := r.Intn(100) - this.Message = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Message[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedSignedMessage(r randyNodemessage, easy bool) *SignedMessage { - this := &SignedMessage{} - v2 := r.Intn(100) - this.Message = make([]byte, v2) - for i := 0; i < v2; i++ { - this.Message[i] = byte(r.Intn(256)) - } - v3 := r.Intn(100) - this.Signature = make([]byte, v3) - for i := 0; i < v3; i++ { - this.Signature[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedVote(r randyNodemessage, easy bool) *Vote { - this := &Vote{} - this.Height = uint32(r.Uint32()) - v4 := r.Intn(100) - this.BlockHash = make([]byte, v4) - for i := 0; i < v4; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedIHaveBlockProposal(r randyNodemessage, easy bool) *IHaveBlockProposal { - this := &IHaveBlockProposal{} - this.Height = uint32(r.Uint32()) - v5 := r.Intn(100) - this.BlockHash = make([]byte, v5) - for i := 0; i < v5; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRequestBlockProposal(r randyNodemessage, easy bool) *RequestBlockProposal { - this := &RequestBlockProposal{} - v6 := r.Intn(100) - this.BlockHash = make([]byte, v6) - for i := 0; i < v6; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - this.Type = RequestTransactionType([]int32{0, 1, 2}[r.Intn(3)]) - v7 := r.Intn(100) - this.ShortHashSalt = make([]byte, v7) - for i := 0; i < v7; i++ { - this.ShortHashSalt[i] = byte(r.Intn(256)) - } - this.ShortHashSize = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRequestBlockProposalReply(r randyNodemessage, easy bool) *RequestBlockProposalReply { - this := &RequestBlockProposalReply{} - if r.Intn(10) != 0 { - this.Block = NewPopulatedBlock(r, easy) - } - v8 := r.Intn(10) - this.TransactionsHash = make([][]byte, v8) - for i := 0; i < v8; i++ { - v9 := r.Intn(100) - this.TransactionsHash[i] = make([]byte, v9) - for j := 0; j < v9; j++ { - this.TransactionsHash[i][j] = byte(r.Intn(256)) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRequestProposalTransactions(r randyNodemessage, easy bool) *RequestProposalTransactions { - this := &RequestProposalTransactions{} - v10 := r.Intn(100) - this.BlockHash = make([]byte, v10) - for i := 0; i < v10; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - this.Type = RequestTransactionType([]int32{0, 1, 2}[r.Intn(3)]) - v11 := r.Intn(100) - this.ShortHashSalt = make([]byte, v11) - for i := 0; i < v11; i++ { - this.ShortHashSalt[i] = byte(r.Intn(256)) - } - this.ShortHashSize = uint32(r.Uint32()) - v12 := r.Intn(10) - this.TransactionsHash = make([][]byte, v12) - for i := 0; i < v12; i++ { - v13 := r.Intn(100) - this.TransactionsHash[i] = make([]byte, v13) - for j := 0; j < v13; j++ { - this.TransactionsHash[i][j] = byte(r.Intn(256)) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRequestProposalTransactionsReply(r randyNodemessage, easy bool) *RequestProposalTransactionsReply { - this := &RequestProposalTransactionsReply{} - if r.Intn(10) != 0 { - v14 := r.Intn(5) - this.Transactions = make([]*Transaction, v14) - for i := 0; i < v14; i++ { - this.Transactions[i] = NewPopulatedTransaction(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGetConsensusState(r randyNodemessage, easy bool) *GetConsensusState { - this := &GetConsensusState{} - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGetConsensusStateReply(r randyNodemessage, easy bool) *GetConsensusStateReply { - this := &GetConsensusStateReply{} - this.LedgerHeight = uint32(r.Uint32()) - v15 := r.Intn(100) - this.LedgerBlockHash = make([]byte, v15) - for i := 0; i < v15; i++ { - this.LedgerBlockHash[i] = byte(r.Intn(256)) - } - this.ConsensusHeight = uint32(r.Uint32()) - this.SyncState = SyncState([]int32{0, 1, 2, 3}[r.Intn(4)]) - this.MinVerifiableHeight = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGetBlockHeaders(r randyNodemessage, easy bool) *GetBlockHeaders { - this := &GetBlockHeaders{} - this.StartHeight = uint32(r.Uint32()) - this.EndHeight = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGetBlockHeadersReply(r randyNodemessage, easy bool) *GetBlockHeadersReply { - this := &GetBlockHeadersReply{} - if r.Intn(10) != 0 { - v16 := r.Intn(5) - this.BlockHeaders = make([]*Header, v16) - for i := 0; i < v16; i++ { - this.BlockHeaders[i] = NewPopulatedHeader(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGetBlocks(r randyNodemessage, easy bool) *GetBlocks { - this := &GetBlocks{} - this.StartHeight = uint32(r.Uint32()) - this.EndHeight = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGetBlocksReply(r randyNodemessage, easy bool) *GetBlocksReply { - this := &GetBlocksReply{} - if r.Intn(10) != 0 { - v17 := r.Intn(5) - this.Blocks = make([]*Block, v17) - for i := 0; i < v17; i++ { - this.Blocks[i] = NewPopulatedBlock(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRelay(r randyNodemessage, easy bool) *Relay { - this := &Relay{} - this.SrcIdentifier = string(randStringNodemessage(r)) - v18 := r.Intn(100) - this.DestId = make([]byte, v18) - for i := 0; i < v18; i++ { - this.DestId[i] = byte(r.Intn(256)) - } - v19 := r.Intn(100) - this.Payload = make([]byte, v19) - for i := 0; i < v19; i++ { - this.Payload[i] = byte(r.Intn(256)) - } - this.MaxHoldingSeconds = uint32(r.Uint32()) - v20 := r.Intn(100) - this.SrcPubkey = make([]byte, v20) - for i := 0; i < v20; i++ { - this.SrcPubkey[i] = byte(r.Intn(256)) - } - v21 := r.Intn(100) - this.BlockHash = make([]byte, v21) - for i := 0; i < v21; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - v22 := r.Intn(100) - this.LastHash = make([]byte, v22) - for i := 0; i < v22; i++ { - this.LastHash[i] = byte(r.Intn(256)) - } - this.SigChainLen = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedTransactions(r randyNodemessage, easy bool) *Transactions { - this := &Transactions{} - if r.Intn(10) != 0 { - v23 := r.Intn(5) - this.Transactions = make([]*Transaction, v23) - for i := 0; i < v23; i++ { - this.Transactions[i] = NewPopulatedTransaction(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedBacktrackSignatureChain(r randyNodemessage, easy bool) *BacktrackSignatureChain { - this := &BacktrackSignatureChain{} - if r.Intn(10) != 0 { - v24 := r.Intn(5) - this.SigChainElems = make([]*SigChainElem, v24) - for i := 0; i < v24; i++ { - this.SigChainElems[i] = NewPopulatedSigChainElem(r, easy) - } - } - v25 := r.Intn(100) - this.Hash = make([]byte, v25) - for i := 0; i < v25; i++ { - this.Hash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedIHaveSignatureChainTransaction(r randyNodemessage, easy bool) *IHaveSignatureChainTransaction { - this := &IHaveSignatureChainTransaction{} - this.Height = uint32(r.Uint32()) - v26 := r.Intn(100) - this.SignatureHash = make([]byte, v26) - for i := 0; i < v26; i++ { - this.SignatureHash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRequestSignatureChainTransaction(r randyNodemessage, easy bool) *RequestSignatureChainTransaction { - this := &RequestSignatureChainTransaction{} - v27 := r.Intn(100) - this.SignatureHash = make([]byte, v27) - for i := 0; i < v27; i++ { - this.SignatureHash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRequestSignatureChainTransactionReply(r randyNodemessage, easy bool) *RequestSignatureChainTransactionReply { - this := &RequestSignatureChainTransactionReply{} - if r.Intn(10) != 0 { - this.Transaction = NewPopulatedTransaction(r, easy) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedPinSignatureChain(r randyNodemessage, easy bool) *PinSignatureChain { - this := &PinSignatureChain{} - v28 := r.Intn(100) - this.Hash = make([]byte, v28) - for i := 0; i < v28; i++ { - this.Hash[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyNodemessage interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneNodemessage(r randyNodemessage) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringNodemessage(r randyNodemessage) string { - v29 := r.Intn(100) - tmps := make([]rune, v29) - for i := 0; i < v29; i++ { - tmps[i] = randUTF8RuneNodemessage(r) - } - return string(tmps) -} -func randUnrecognizedNodemessage(r randyNodemessage, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldNodemessage(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldNodemessage(dAtA []byte, r randyNodemessage, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateNodemessage(dAtA, uint64(key)) - v30 := r.Int63() - if r.Intn(2) == 0 { - v30 *= -1 - } - dAtA = encodeVarintPopulateNodemessage(dAtA, uint64(v30)) - case 1: - dAtA = encodeVarintPopulateNodemessage(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateNodemessage(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateNodemessage(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateNodemessage(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateNodemessage(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *UnsignedMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.MessageType != 0 { - n += 1 + sovNodemessage(uint64(m.MessageType)) - } - l = len(m.Message) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *SignedMessage) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Message) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *Vote) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovNodemessage(uint64(m.Height)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *IHaveBlockProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovNodemessage(uint64(m.Height)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *RequestBlockProposal) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.Type != 0 { - n += 1 + sovNodemessage(uint64(m.Type)) - } - l = len(m.ShortHashSalt) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.ShortHashSize != 0 { - n += 1 + sovNodemessage(uint64(m.ShortHashSize)) - } - return n -} - -func (m *RequestBlockProposalReply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Block != nil { - l = m.Block.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - if len(m.TransactionsHash) > 0 { - for _, b := range m.TransactionsHash { - l = len(b) - n += 1 + l + sovNodemessage(uint64(l)) - } - } - return n -} - -func (m *RequestProposalTransactions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.Type != 0 { - n += 1 + sovNodemessage(uint64(m.Type)) - } - l = len(m.ShortHashSalt) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.ShortHashSize != 0 { - n += 1 + sovNodemessage(uint64(m.ShortHashSize)) - } - if len(m.TransactionsHash) > 0 { - for _, b := range m.TransactionsHash { - l = len(b) - n += 1 + l + sovNodemessage(uint64(l)) - } - } - return n -} - -func (m *RequestProposalTransactionsReply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Transactions) > 0 { - for _, e := range m.Transactions { - l = e.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - } - return n -} - -func (m *GetConsensusState) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - return n -} - -func (m *GetConsensusStateReply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.LedgerHeight != 0 { - n += 1 + sovNodemessage(uint64(m.LedgerHeight)) - } - l = len(m.LedgerBlockHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.ConsensusHeight != 0 { - n += 1 + sovNodemessage(uint64(m.ConsensusHeight)) - } - if m.SyncState != 0 { - n += 1 + sovNodemessage(uint64(m.SyncState)) - } - if m.MinVerifiableHeight != 0 { - n += 1 + sovNodemessage(uint64(m.MinVerifiableHeight)) - } - return n -} - -func (m *GetBlockHeaders) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.StartHeight != 0 { - n += 1 + sovNodemessage(uint64(m.StartHeight)) - } - if m.EndHeight != 0 { - n += 1 + sovNodemessage(uint64(m.EndHeight)) - } - return n -} - -func (m *GetBlockHeadersReply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.BlockHeaders) > 0 { - for _, e := range m.BlockHeaders { - l = e.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - } - return n -} - -func (m *GetBlocks) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.StartHeight != 0 { - n += 1 + sovNodemessage(uint64(m.StartHeight)) - } - if m.EndHeight != 0 { - n += 1 + sovNodemessage(uint64(m.EndHeight)) - } - return n -} - -func (m *GetBlocksReply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Blocks) > 0 { - for _, e := range m.Blocks { - l = e.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - } - return n -} - -func (m *Relay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SrcIdentifier) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - l = len(m.DestId) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - l = len(m.Payload) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.MaxHoldingSeconds != 0 { - n += 1 + sovNodemessage(uint64(m.MaxHoldingSeconds)) - } - l = len(m.SrcPubkey) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - l = len(m.LastHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - if m.SigChainLen != 0 { - n += 1 + sovNodemessage(uint64(m.SigChainLen)) - } - return n -} - -func (m *Transactions) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.Transactions) > 0 { - for _, e := range m.Transactions { - l = e.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - } - return n -} - -func (m *BacktrackSignatureChain) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if len(m.SigChainElems) > 0 { - for _, e := range m.SigChainElems { - l = e.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - } - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *IHaveSignatureChainTransaction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Height != 0 { - n += 1 + sovNodemessage(uint64(m.Height)) - } - l = len(m.SignatureHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *RequestSignatureChainTransaction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SignatureHash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *RequestSignatureChainTransactionReply) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Transaction != nil { - l = m.Transaction.Size() - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func (m *PinSignatureChain) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Hash) - if l > 0 { - n += 1 + l + sovNodemessage(uint64(l)) - } - return n -} - -func sovNodemessage(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozNodemessage(x uint64) (n int) { - return sovNodemessage(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *UnsignedMessage) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&UnsignedMessage{`, - `MessageType:` + fmt.Sprintf("%v", this.MessageType) + `,`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `}`, - }, "") - return s -} -func (this *SignedMessage) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SignedMessage{`, - `Message:` + fmt.Sprintf("%v", this.Message) + `,`, - `Signature:` + fmt.Sprintf("%v", this.Signature) + `,`, - `}`, - }, "") - return s -} -func (this *Vote) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Vote{`, - `Height:` + fmt.Sprintf("%v", this.Height) + `,`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `}`, - }, "") - return s -} -func (this *IHaveBlockProposal) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IHaveBlockProposal{`, - `Height:` + fmt.Sprintf("%v", this.Height) + `,`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `}`, - }, "") - return s -} -func (this *RequestBlockProposal) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RequestBlockProposal{`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `ShortHashSalt:` + fmt.Sprintf("%v", this.ShortHashSalt) + `,`, - `ShortHashSize:` + fmt.Sprintf("%v", this.ShortHashSize) + `,`, - `}`, - }, "") - return s -} -func (this *RequestBlockProposalReply) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RequestBlockProposalReply{`, - `Block:` + strings.Replace(fmt.Sprintf("%v", this.Block), "Block", "Block", 1) + `,`, - `TransactionsHash:` + fmt.Sprintf("%v", this.TransactionsHash) + `,`, - `}`, - }, "") - return s -} -func (this *RequestProposalTransactions) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RequestProposalTransactions{`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `ShortHashSalt:` + fmt.Sprintf("%v", this.ShortHashSalt) + `,`, - `ShortHashSize:` + fmt.Sprintf("%v", this.ShortHashSize) + `,`, - `TransactionsHash:` + fmt.Sprintf("%v", this.TransactionsHash) + `,`, - `}`, - }, "") - return s -} -func (this *RequestProposalTransactionsReply) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RequestProposalTransactionsReply{`, - `Transactions:` + strings.Replace(fmt.Sprintf("%v", this.Transactions), "Transaction", "Transaction", 1) + `,`, - `}`, - }, "") - return s -} -func (this *GetConsensusState) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GetConsensusState{`, - `}`, - }, "") - return s -} -func (this *GetConsensusStateReply) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GetConsensusStateReply{`, - `LedgerHeight:` + fmt.Sprintf("%v", this.LedgerHeight) + `,`, - `LedgerBlockHash:` + fmt.Sprintf("%v", this.LedgerBlockHash) + `,`, - `ConsensusHeight:` + fmt.Sprintf("%v", this.ConsensusHeight) + `,`, - `SyncState:` + fmt.Sprintf("%v", this.SyncState) + `,`, - `MinVerifiableHeight:` + fmt.Sprintf("%v", this.MinVerifiableHeight) + `,`, - `}`, - }, "") - return s -} -func (this *GetBlockHeaders) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GetBlockHeaders{`, - `StartHeight:` + fmt.Sprintf("%v", this.StartHeight) + `,`, - `EndHeight:` + fmt.Sprintf("%v", this.EndHeight) + `,`, - `}`, - }, "") - return s -} -func (this *GetBlockHeadersReply) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GetBlockHeadersReply{`, - `BlockHeaders:` + strings.Replace(fmt.Sprintf("%v", this.BlockHeaders), "Header", "Header", 1) + `,`, - `}`, - }, "") - return s -} -func (this *GetBlocks) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GetBlocks{`, - `StartHeight:` + fmt.Sprintf("%v", this.StartHeight) + `,`, - `EndHeight:` + fmt.Sprintf("%v", this.EndHeight) + `,`, - `}`, - }, "") - return s -} -func (this *GetBlocksReply) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GetBlocksReply{`, - `Blocks:` + strings.Replace(fmt.Sprintf("%v", this.Blocks), "Block", "Block", 1) + `,`, - `}`, - }, "") - return s -} -func (this *Relay) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Relay{`, - `SrcIdentifier:` + fmt.Sprintf("%v", this.SrcIdentifier) + `,`, - `DestId:` + fmt.Sprintf("%v", this.DestId) + `,`, - `Payload:` + fmt.Sprintf("%v", this.Payload) + `,`, - `MaxHoldingSeconds:` + fmt.Sprintf("%v", this.MaxHoldingSeconds) + `,`, - `SrcPubkey:` + fmt.Sprintf("%v", this.SrcPubkey) + `,`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `LastHash:` + fmt.Sprintf("%v", this.LastHash) + `,`, - `SigChainLen:` + fmt.Sprintf("%v", this.SigChainLen) + `,`, - `}`, - }, "") - return s -} -func (this *Transactions) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Transactions{`, - `Transactions:` + strings.Replace(fmt.Sprintf("%v", this.Transactions), "Transaction", "Transaction", 1) + `,`, - `}`, - }, "") - return s -} -func (this *BacktrackSignatureChain) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&BacktrackSignatureChain{`, - `SigChainElems:` + strings.Replace(fmt.Sprintf("%v", this.SigChainElems), "SigChainElem", "SigChainElem", 1) + `,`, - `Hash:` + fmt.Sprintf("%v", this.Hash) + `,`, - `}`, - }, "") - return s -} -func (this *IHaveSignatureChainTransaction) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IHaveSignatureChainTransaction{`, - `Height:` + fmt.Sprintf("%v", this.Height) + `,`, - `SignatureHash:` + fmt.Sprintf("%v", this.SignatureHash) + `,`, - `}`, - }, "") - return s -} -func (this *RequestSignatureChainTransaction) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RequestSignatureChainTransaction{`, - `SignatureHash:` + fmt.Sprintf("%v", this.SignatureHash) + `,`, - `}`, - }, "") - return s -} -func (this *RequestSignatureChainTransactionReply) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RequestSignatureChainTransactionReply{`, - `Transaction:` + strings.Replace(fmt.Sprintf("%v", this.Transaction), "Transaction", "Transaction", 1) + `,`, - `}`, - }, "") - return s -} -func (this *PinSignatureChain) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&PinSignatureChain{`, - `Hash:` + fmt.Sprintf("%v", this.Hash) + `,`, - `}`, - }, "") - return s -} -func valueToStringNodemessage(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *UnsignedMessage) 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 ErrIntOverflowNodemessage - } - 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: UnsignedMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnsignedMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MessageType", wireType) - } - m.MessageType = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MessageType |= (MessageType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) - if m.Message == nil { - m.Message = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SignedMessage) 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 ErrIntOverflowNodemessage - } - 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: SignedMessage: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SignedMessage: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Message", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Message = append(m.Message[:0], dAtA[iNdEx:postIndex]...) - if m.Message == nil { - m.Message = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Vote) 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 ErrIntOverflowNodemessage - } - 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: Vote: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Vote: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IHaveBlockProposal) 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 ErrIntOverflowNodemessage - } - 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: IHaveBlockProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IHaveBlockProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestBlockProposal) 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 ErrIntOverflowNodemessage - } - 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: RequestBlockProposal: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestBlockProposal: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= (RequestTransactionType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShortHashSalt", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ShortHashSalt = append(m.ShortHashSalt[:0], dAtA[iNdEx:postIndex]...) - if m.ShortHashSalt == nil { - m.ShortHashSalt = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ShortHashSize", wireType) - } - m.ShortHashSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ShortHashSize |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestBlockProposalReply) 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 ErrIntOverflowNodemessage - } - 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: RequestBlockProposalReply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestBlockProposalReply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Block", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Block == nil { - m.Block = &Block{} - } - if err := m.Block.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionsHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransactionsHash = append(m.TransactionsHash, make([]byte, postIndex-iNdEx)) - copy(m.TransactionsHash[len(m.TransactionsHash)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestProposalTransactions) 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 ErrIntOverflowNodemessage - } - 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: RequestProposalTransactions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestProposalTransactions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= (RequestTransactionType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field ShortHashSalt", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.ShortHashSalt = append(m.ShortHashSalt[:0], dAtA[iNdEx:postIndex]...) - if m.ShortHashSalt == nil { - m.ShortHashSalt = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ShortHashSize", wireType) - } - m.ShortHashSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ShortHashSize |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field TransactionsHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.TransactionsHash = append(m.TransactionsHash, make([]byte, postIndex-iNdEx)) - copy(m.TransactionsHash[len(m.TransactionsHash)-1], dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestProposalTransactionsReply) 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 ErrIntOverflowNodemessage - } - 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: RequestProposalTransactionsReply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestProposalTransactionsReply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Transactions = append(m.Transactions, &Transaction{}) - if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetConsensusState) 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 ErrIntOverflowNodemessage - } - 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: GetConsensusState: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetConsensusState: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetConsensusStateReply) 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 ErrIntOverflowNodemessage - } - 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: GetConsensusStateReply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetConsensusStateReply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field LedgerHeight", wireType) - } - m.LedgerHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.LedgerHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LedgerBlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LedgerBlockHash = append(m.LedgerBlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.LedgerBlockHash == nil { - m.LedgerBlockHash = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field ConsensusHeight", wireType) - } - m.ConsensusHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.ConsensusHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SyncState", wireType) - } - m.SyncState = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SyncState |= (SyncState(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MinVerifiableHeight", wireType) - } - m.MinVerifiableHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MinVerifiableHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetBlockHeaders) 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 ErrIntOverflowNodemessage - } - 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: GetBlockHeaders: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetBlockHeaders: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) - } - m.StartHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndHeight", wireType) - } - m.EndHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetBlockHeadersReply) 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 ErrIntOverflowNodemessage - } - 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: GetBlockHeadersReply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetBlockHeadersReply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHeaders", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHeaders = append(m.BlockHeaders, &Header{}) - if err := m.BlockHeaders[len(m.BlockHeaders)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetBlocks) 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 ErrIntOverflowNodemessage - } - 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: GetBlocks: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetBlocks: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field StartHeight", wireType) - } - m.StartHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.StartHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field EndHeight", wireType) - } - m.EndHeight = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.EndHeight |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GetBlocksReply) 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 ErrIntOverflowNodemessage - } - 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: GetBlocksReply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GetBlocksReply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Blocks", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Blocks = append(m.Blocks, &Block{}) - if err := m.Blocks[len(m.Blocks)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Relay) 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 ErrIntOverflowNodemessage - } - 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: Relay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Relay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcIdentifier", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - 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 ErrInvalidLengthNodemessage - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcIdentifier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DestId = append(m.DestId[:0], dAtA[iNdEx:postIndex]...) - if m.DestId == nil { - m.DestId = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Payload = append(m.Payload[:0], dAtA[iNdEx:postIndex]...) - if m.Payload == nil { - m.Payload = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field MaxHoldingSeconds", wireType) - } - m.MaxHoldingSeconds = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.MaxHoldingSeconds |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcPubkey = append(m.SrcPubkey[:0], dAtA[iNdEx:postIndex]...) - if m.SrcPubkey == nil { - m.SrcPubkey = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field LastHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.LastHash = append(m.LastHash[:0], dAtA[iNdEx:postIndex]...) - if m.LastHash == nil { - m.LastHash = []byte{} - } - iNdEx = postIndex - case 9: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigChainLen", wireType) - } - m.SigChainLen = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigChainLen |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Transactions) 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 ErrIntOverflowNodemessage - } - 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: Transactions: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Transactions: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transactions", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Transactions = append(m.Transactions, &Transaction{}) - if err := m.Transactions[len(m.Transactions)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *BacktrackSignatureChain) 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 ErrIntOverflowNodemessage - } - 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: BacktrackSignatureChain: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: BacktrackSignatureChain: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SigChainElems", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SigChainElems = append(m.SigChainElems, &SigChainElem{}) - if err := m.SigChainElems[len(m.SigChainElems)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IHaveSignatureChainTransaction) 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 ErrIntOverflowNodemessage - } - 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: IHaveSignatureChainTransaction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IHaveSignatureChainTransaction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Height", wireType) - } - m.Height = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Height |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignatureHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignatureHash = append(m.SignatureHash[:0], dAtA[iNdEx:postIndex]...) - if m.SignatureHash == nil { - m.SignatureHash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestSignatureChainTransaction) 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 ErrIntOverflowNodemessage - } - 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: RequestSignatureChainTransaction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestSignatureChainTransaction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SignatureHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SignatureHash = append(m.SignatureHash[:0], dAtA[iNdEx:postIndex]...) - if m.SignatureHash == nil { - m.SignatureHash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RequestSignatureChainTransactionReply) 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 ErrIntOverflowNodemessage - } - 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: RequestSignatureChainTransactionReply: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RequestSignatureChainTransactionReply: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Transaction", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Transaction == nil { - m.Transaction = &Transaction{} - } - if err := m.Transaction.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *PinSignatureChain) 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 ErrIntOverflowNodemessage - } - 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: PinSignatureChain: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: PinSignatureChain: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Hash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowNodemessage - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthNodemessage - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Hash = append(m.Hash[:0], dAtA[iNdEx:postIndex]...) - if m.Hash == nil { - m.Hash = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipNodemessage(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthNodemessage - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipNodemessage(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, ErrIntOverflowNodemessage - } - 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, ErrIntOverflowNodemessage - } - 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, ErrIntOverflowNodemessage - } - 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, ErrInvalidLengthNodemessage - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowNodemessage - } - 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 := skipNodemessage(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 ( - ErrInvalidLengthNodemessage = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowNodemessage = fmt.Errorf("proto: integer overflow") -) -func init() { proto.RegisterFile("pb/nodemessage.proto", fileDescriptor_nodemessage_36b58b92b5905ce8) } - -var fileDescriptor_nodemessage_36b58b92b5905ce8 = []byte{ - // 1698 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xcd, 0x72, 0xdb, 0xd6, - 0x15, 0x16, 0xf4, 0x67, 0xf3, 0x88, 0x94, 0xc0, 0x2b, 0xd9, 0xa2, 0x25, 0x0b, 0x96, 0xe0, 0xd8, - 0x91, 0x19, 0x47, 0x4c, 0xe4, 0x36, 0x93, 0xe9, 0xa4, 0x0b, 0x90, 0x42, 0x45, 0x8e, 0x69, 0x92, - 0x05, 0x20, 0xa7, 0xee, 0x06, 0x03, 0x92, 0xd7, 0x24, 0xc6, 0x20, 0xc0, 0xe2, 0x42, 0xa9, 0x99, - 0x55, 0x1f, 0xc1, 0x8f, 0xd1, 0x17, 0xe8, 0x4c, 0x1f, 0xa1, 0x8b, 0x2e, 0xbc, 0xcc, 0xb2, 0xa6, - 0x37, 0xed, 0x2e, 0xdd, 0x74, 0xba, 0xec, 0xe0, 0xe2, 0x02, 0x02, 0x41, 0x80, 0xb2, 0x33, 0x5d, - 0x64, 0xc7, 0x7b, 0xce, 0x77, 0xbe, 0xf3, 0x83, 0xf3, 0x5d, 0x40, 0x82, 0x9d, 0x71, 0xb7, 0x62, - 0x3b, 0x7d, 0x3c, 0xc2, 0x84, 0x18, 0x03, 0x7c, 0x32, 0x76, 0x1d, 0xcf, 0x41, 0xcb, 0xe3, 0xee, - 0xde, 0xe7, 0x03, 0xd3, 0x1b, 0x5e, 0x76, 0x4f, 0x7a, 0xce, 0xa8, 0x32, 0x70, 0x06, 0x4e, 0x85, - 0xba, 0xba, 0x97, 0x2f, 0xe9, 0x89, 0x1e, 0xe8, 0xaf, 0x20, 0x64, 0xaf, 0xc0, 0x88, 0xd8, 0xb1, - 0x38, 0xee, 0x56, 0x88, 0x39, 0xe8, 0x0d, 0x0d, 0xd3, 0x66, 0xa6, 0xcd, 0x71, 0xb7, 0xd2, 0xb5, - 0x9c, 0xde, 0x2b, 0x76, 0xf6, 0x53, 0x7b, 0xae, 0x61, 0x13, 0xa3, 0xe7, 0x99, 0x0e, 0x43, 0x89, - 0x3a, 0x6c, 0x5d, 0xd8, 0xc4, 0x1c, 0xd8, 0xb8, 0xff, 0x2c, 0xa8, 0x09, 0x9d, 0x42, 0x9e, 0x95, - 0xa7, 0x7b, 0x93, 0x31, 0x2e, 0x71, 0x87, 0xdc, 0xf1, 0xe6, 0xe9, 0xd6, 0xc9, 0xb8, 0x7b, 0xc2, - 0x20, 0xda, 0x64, 0x8c, 0x95, 0x8d, 0xd1, 0xd5, 0x01, 0x95, 0xe0, 0x06, 0x3b, 0x96, 0x96, 0x0f, - 0xb9, 0xe3, 0xbc, 0x12, 0x1e, 0xc5, 0x73, 0x28, 0xa8, 0x33, 0xf4, 0x31, 0x28, 0x37, 0x03, 0x45, - 0x77, 0x21, 0xe7, 0x57, 0x62, 0x78, 0x97, 0x6e, 0x48, 0x73, 0x65, 0x10, 0x7f, 0x0d, 0xab, 0xcf, - 0x1d, 0x0f, 0xa3, 0xdb, 0xb0, 0x3e, 0xc4, 0xe6, 0x60, 0xe8, 0xd1, 0xf0, 0x82, 0xc2, 0x4e, 0xe8, - 0x00, 0x80, 0xb6, 0xab, 0x0f, 0x0d, 0x32, 0x0c, 0xc3, 0xa9, 0xa5, 0x6e, 0x90, 0xa1, 0xf8, 0x14, - 0x50, 0xa3, 0x6e, 0x7c, 0x87, 0xab, 0xbe, 0xa5, 0xe3, 0x3a, 0x63, 0x87, 0x18, 0xd6, 0x4f, 0x25, - 0xfb, 0x0b, 0x07, 0x3b, 0x0a, 0xfe, 0xc3, 0x25, 0x26, 0xde, 0x2c, 0xdf, 0x6c, 0x1c, 0x97, 0x88, - 0x43, 0x27, 0xb0, 0x4a, 0x47, 0xba, 0x4c, 0x47, 0xba, 0xe7, 0x8f, 0x94, 0xd1, 0x68, 0x57, 0x4f, - 0x86, 0x4e, 0x97, 0xe2, 0xd0, 0x43, 0xd8, 0x22, 0x43, 0xc7, 0xf5, 0x28, 0x9d, 0x4e, 0x0c, 0xcb, - 0x2b, 0xad, 0x50, 0xce, 0x02, 0x35, 0xfb, 0x9c, 0xaa, 0x61, 0x79, 0x49, 0x9c, 0xf9, 0x3d, 0x2e, - 0xad, 0xd2, 0x7e, 0x62, 0x38, 0xf3, 0x7b, 0x2c, 0x9a, 0x70, 0x27, 0xad, 0x6c, 0x05, 0x8f, 0xad, - 0x09, 0xba, 0x07, 0x6b, 0xb4, 0x52, 0x5a, 0xf6, 0xc6, 0x69, 0xce, 0xaf, 0x8e, 0xc2, 0x94, 0xc0, - 0x8e, 0x3e, 0x83, 0x62, 0x6c, 0x81, 0x48, 0x38, 0x9b, 0x95, 0xe3, 0xbc, 0xc2, 0xc7, 0x1d, 0x74, - 0x44, 0xff, 0xe2, 0x60, 0x9f, 0xe5, 0x0a, 0xd3, 0xc4, 0x7a, 0x24, 0x3f, 0xf3, 0x49, 0xa5, 0xf7, - 0xba, 0x96, 0xd1, 0xeb, 0xb7, 0x70, 0xb8, 0xa0, 0xd5, 0x60, 0xba, 0x4f, 0x20, 0x1f, 0x8f, 0x2b, - 0x71, 0x87, 0x2b, 0xc7, 0x1b, 0x81, 0xaa, 0x62, 0x60, 0x65, 0x06, 0x24, 0x6e, 0x43, 0xf1, 0x1c, - 0x7b, 0x35, 0xc7, 0x26, 0xd8, 0x26, 0x97, 0x44, 0xf5, 0x0c, 0x0f, 0x8b, 0xff, 0xe1, 0xe0, 0xf6, - 0x9c, 0x35, 0x48, 0x72, 0x1f, 0x0a, 0x16, 0xee, 0x0f, 0xb0, 0xab, 0xcf, 0x6c, 0x75, 0x3e, 0x30, - 0xd6, 0x83, 0xdd, 0x2e, 0x43, 0x91, 0x81, 0xe6, 0x56, 0x7c, 0x2b, 0x70, 0x54, 0xa3, 0xc7, 0xf0, - 0x08, 0xf8, 0x5e, 0x98, 0x27, 0xe4, 0x5c, 0xa1, 0x9c, 0x5b, 0x91, 0x9d, 0xd1, 0x3e, 0x06, 0x20, - 0x13, 0xbb, 0xa7, 0x13, 0xbf, 0x1c, 0x3a, 0xd4, 0xcd, 0xd3, 0x82, 0xdf, 0x9e, 0x3a, 0xb1, 0x7b, - 0x41, 0x8d, 0x39, 0x12, 0xfe, 0x44, 0xa7, 0x70, 0x6b, 0x64, 0xda, 0xfa, 0x77, 0xd8, 0x35, 0x5f, - 0x9a, 0x46, 0xd7, 0xc2, 0x21, 0xfb, 0x1a, 0x65, 0xdf, 0x1e, 0x99, 0xf6, 0xf3, 0xc8, 0x17, 0x64, - 0x10, 0x55, 0xd8, 0x3a, 0xc7, 0xc1, 0xe6, 0xd6, 0xb1, 0xd1, 0xc7, 0x2e, 0x41, 0x47, 0x90, 0x27, - 0x9e, 0xe1, 0x3f, 0xce, 0x78, 0xbf, 0x1b, 0xd4, 0x56, 0x8f, 0xa4, 0x8c, 0xed, 0x7e, 0x08, 0x58, - 0xa6, 0x80, 0x1c, 0xb6, 0xfb, 0x8c, 0xf4, 0x1c, 0x76, 0x12, 0xa4, 0xc1, 0x28, 0x2b, 0x50, 0x60, - 0xe3, 0x09, 0xac, 0xec, 0x81, 0x81, 0xdf, 0x51, 0x00, 0x54, 0xf2, 0xdd, 0x58, 0x94, 0xf8, 0x0c, - 0x72, 0x21, 0xd1, 0xff, 0xa3, 0xae, 0x27, 0xb0, 0x19, 0xd1, 0x05, 0x15, 0x1d, 0xc1, 0x3a, 0x4d, - 0x18, 0x96, 0x12, 0x13, 0x28, 0x73, 0x88, 0x6f, 0x96, 0x61, 0x4d, 0xc1, 0x96, 0x31, 0x41, 0x0f, - 0x60, 0x93, 0xb8, 0x3d, 0xdd, 0xec, 0x63, 0xdb, 0x33, 0x5f, 0x9a, 0xd8, 0xa5, 0x25, 0xe4, 0x94, - 0x02, 0x71, 0x7b, 0x8d, 0xc8, 0x88, 0x76, 0xe1, 0x46, 0x1f, 0x13, 0x4f, 0x37, 0xfb, 0x6c, 0x03, - 0xd6, 0xfd, 0x63, 0xa3, 0xef, 0xdf, 0xd2, 0x63, 0x63, 0x62, 0x39, 0x46, 0x9f, 0xe9, 0x28, 0x3c, - 0xa2, 0x13, 0xd8, 0x1e, 0x19, 0xaf, 0xf5, 0xa1, 0x63, 0xf5, 0x4d, 0x7b, 0xa0, 0x13, 0xdc, 0x73, - 0xec, 0x3e, 0x61, 0xcf, 0xad, 0x38, 0x32, 0x5e, 0xd7, 0x03, 0x8f, 0x1a, 0x38, 0xfc, 0x3e, 0xfd, - 0x4a, 0xc6, 0x97, 0xdd, 0x57, 0x78, 0x52, 0x5a, 0x67, 0xd7, 0xba, 0xdb, 0xeb, 0x50, 0x43, 0xe2, - 0x1e, 0xb8, 0x91, 0xbc, 0x07, 0xf6, 0x21, 0x67, 0x19, 0x24, 0x90, 0x6b, 0xe9, 0x26, 0xf5, 0xde, - 0xf4, 0x0d, 0xd4, 0x29, 0x42, 0x81, 0x98, 0x03, 0x9d, 0xbe, 0xf5, 0x74, 0x0b, 0xdb, 0xa5, 0x1c, - 0x1b, 0xb3, 0x39, 0xa8, 0xf9, 0xb6, 0x26, 0xb6, 0xc5, 0x1a, 0xe4, 0x67, 0xee, 0x9d, 0x9f, 0xa4, - 0xc3, 0x01, 0xec, 0x56, 0x8d, 0xde, 0x2b, 0xcf, 0x35, 0x7a, 0xaf, 0xd4, 0xf0, 0x8d, 0x44, 0x53, - 0xa0, 0xaf, 0x61, 0xeb, 0xaa, 0x06, 0x6c, 0xe1, 0x51, 0x48, 0xc9, 0xd3, 0xdd, 0x67, 0x95, 0xc8, - 0x16, 0x1e, 0x29, 0x05, 0x12, 0x3b, 0x11, 0x84, 0x60, 0x35, 0x26, 0x3d, 0xfa, 0x5b, 0xd4, 0x41, - 0xa0, 0x6f, 0xa9, 0xd9, 0x24, 0xb1, 0xc2, 0x32, 0xdf, 0x58, 0xfe, 0x03, 0x0f, 0x83, 0xe2, 0x92, - 0x2e, 0x44, 0x56, 0x7a, 0x55, 0x35, 0xa2, 0xab, 0x2a, 0x3b, 0xc5, 0x3c, 0x15, 0x97, 0x46, 0xf5, - 0x7b, 0x78, 0x70, 0x1d, 0x55, 0xb0, 0xb8, 0x5f, 0xc2, 0x46, 0x6c, 0x9a, 0xec, 0xf5, 0x32, 0x37, - 0xf1, 0x38, 0x46, 0xfc, 0x14, 0x8a, 0x1d, 0xd3, 0x4e, 0x8c, 0x3a, 0x1c, 0x18, 0x77, 0x35, 0xb0, - 0xf2, 0xdf, 0x57, 0x61, 0x23, 0xf6, 0x55, 0x82, 0x3e, 0x85, 0xfb, 0xcf, 0x64, 0x55, 0x95, 0xce, - 0x65, 0x5d, 0x7b, 0xd1, 0x91, 0xf5, 0x4e, 0x53, 0xaa, 0xc9, 0xf5, 0x76, 0xf3, 0x4c, 0x56, 0xf4, - 0xb3, 0xb6, 0xde, 0x6a, 0x6b, 0xfa, 0x85, 0x2a, 0xf3, 0x4b, 0xe8, 0x26, 0xac, 0x3e, 0x6f, 0x6b, - 0x32, 0xcf, 0xa1, 0x3b, 0x70, 0xab, 0xa1, 0xd7, 0xa5, 0xe7, 0xb2, 0x5e, 0x6d, 0xb6, 0x6b, 0x4f, - 0xf5, 0x8e, 0xd2, 0xee, 0xb4, 0x55, 0xa9, 0xc9, 0x2f, 0xa3, 0x3d, 0xb8, 0xad, 0xc8, 0xbf, 0xbd, - 0x90, 0x55, 0x2d, 0xe9, 0x5b, 0x41, 0x87, 0x70, 0x37, 0xdd, 0xa7, 0x2b, 0x72, 0xa7, 0xf9, 0x82, - 0x5f, 0x45, 0xbb, 0xb0, 0x7d, 0x2e, 0x6b, 0x7a, 0xad, 0xdd, 0x52, 0xe5, 0x96, 0x7a, 0xa1, 0xea, - 0xaa, 0x26, 0x69, 0x32, 0xbf, 0x86, 0x0e, 0xe0, 0x4e, 0x8a, 0x83, 0xc5, 0xad, 0xa3, 0x5b, 0x50, - 0xf4, 0xdd, 0x01, 0x6b, 0x5d, 0x96, 0xce, 0x64, 0x45, 0xe5, 0x6f, 0xa0, 0x7d, 0xd8, 0x9d, 0x33, - 0xb3, 0x98, 0x9b, 0x68, 0x13, 0x20, 0x72, 0xaa, 0x7c, 0x0e, 0xed, 0x00, 0x7f, 0x75, 0x66, 0x28, - 0x40, 0x39, 0x58, 0x53, 0xe4, 0xa6, 0xf4, 0x82, 0xdf, 0x40, 0x3c, 0xe4, 0x35, 0x45, 0x6a, 0xa9, - 0x52, 0x4d, 0x6b, 0xb4, 0x5b, 0x2a, 0x9f, 0xf7, 0xab, 0xaa, 0x4a, 0xb5, 0xa7, 0x9a, 0x22, 0xd5, - 0x9e, 0xea, 0x6a, 0xe3, 0xbc, 0x25, 0x69, 0x17, 0x8a, 0xac, 0xd7, 0xea, 0x52, 0xa3, 0xc5, 0x17, - 0xd0, 0x11, 0x1c, 0x84, 0xfd, 0x46, 0x9d, 0xce, 0x30, 0x6c, 0xfa, 0xc3, 0x5f, 0x08, 0x61, 0x75, - 0x6c, 0xa1, 0x87, 0x20, 0xb2, 0x91, 0x27, 0xf2, 0xc4, 0xe1, 0x3c, 0x1f, 0x27, 0x5c, 0x04, 0x2c, - 0xa2, 0xcf, 0xe1, 0xd1, 0x07, 0x00, 0x59, 0x7e, 0xe4, 0x3f, 0x99, 0x4e, 0xa3, 0x35, 0xd7, 0xe4, - 0x76, 0xb9, 0x06, 0x25, 0xc9, 0xb2, 0x9c, 0x3f, 0xe2, 0xfe, 0xcc, 0x47, 0x6b, 0xb8, 0x5a, 0x52, - 0xb3, 0xd9, 0xfe, 0x96, 0x86, 0xc9, 0x67, 0x99, 0xab, 0x55, 0xfe, 0xf7, 0x3a, 0xec, 0x31, 0x96, - 0xc4, 0xb7, 0x35, 0xe5, 0x79, 0x04, 0x0f, 0x02, 0x9e, 0x8b, 0xd6, 0x35, 0x4c, 0x7e, 0x9d, 0x09, - 0x28, 0xdb, 0xd9, 0x63, 0xf8, 0x24, 0xe1, 0xc8, 0x5a, 0xe1, 0xf9, 0x6c, 0x99, 0x1b, 0xfd, 0x10, - 0xc4, 0x85, 0xd0, 0x70, 0xaf, 0xe7, 0x71, 0xe9, 0x6b, 0xfe, 0x18, 0x8e, 0xaf, 0xc7, 0x45, 0x5b, - 0xff, 0x09, 0x1c, 0xa6, 0xa0, 0x93, 0x22, 0x28, 0xc3, 0xc3, 0xeb, 0x50, 0x91, 0x26, 0x0e, 0xe0, - 0x4e, 0x16, 0xd6, 0x97, 0xc8, 0x7d, 0xb8, 0x97, 0xe9, 0x8e, 0x14, 0x53, 0x82, 0x9d, 0xb9, 0x99, - 0x04, 0x02, 0xba, 0x07, 0xfb, 0x09, 0x4f, 0x42, 0x4f, 0xf3, 0xed, 0x2f, 0x92, 0xd7, 0x17, 0xf0, - 0x38, 0x63, 0xf8, 0x59, 0x6a, 0xfb, 0x0a, 0x4e, 0x3f, 0x26, 0x22, 0x12, 0xdf, 0x2f, 0xe1, 0xcb, - 0xf4, 0xdd, 0x59, 0xac, 0xc5, 0xec, 0x74, 0x8b, 0xa5, 0xf9, 0x0d, 0x7c, 0xfd, 0xf1, 0x71, 0x91, - 0x52, 0xe7, 0x77, 0x2d, 0x5d, 0xb8, 0x6f, 0xd6, 0x23, 0xe5, 0x9e, 0x99, 0x2e, 0xee, 0x79, 0xa9, - 0xca, 0x3d, 0x6b, 0x28, 0x72, 0x4d, 0xcb, 0xd6, 0xdb, 0x2d, 0x28, 0xce, 0x00, 0x99, 0xda, 0xa2, - 0x22, 0x98, 0x39, 0x4b, 0x6b, 0xc9, 0x3c, 0x99, 0x4a, 0x8b, 0x76, 0x3d, 0x15, 0x18, 0xea, 0x2c, - 0x89, 0x4a, 0x57, 0x59, 0xa4, 0x88, 0x6c, 0x54, 0xa4, 0x31, 0x11, 0x84, 0x39, 0x6c, 0x52, 0x61, - 0xd1, 0xd5, 0x92, 0x85, 0x89, 0xf4, 0xb5, 0x0f, 0xbb, 0xe9, 0x48, 0x5f, 0x5d, 0x47, 0x70, 0x90, - 0xe1, 0x8c, 0xb4, 0x95, 0xac, 0x7c, 0x91, 0x3c, 0x4e, 0xa0, 0x9c, 0x3a, 0xb1, 0x2c, 0x71, 0xfc, - 0x02, 0xbe, 0xf8, 0x70, 0x7c, 0x24, 0x8d, 0x27, 0x50, 0x49, 0x7b, 0xd0, 0x8b, 0x85, 0x91, 0x95, - 0x6a, 0xb1, 0x2c, 0x7e, 0x05, 0x5f, 0x7d, 0x6c, 0x54, 0x24, 0x8a, 0xe4, 0x62, 0xa4, 0x4b, 0xe2, - 0x77, 0xb0, 0xcb, 0x14, 0x41, 0xff, 0x24, 0x88, 0x0b, 0x22, 0x5a, 0x68, 0x7a, 0x99, 0x7d, 0x80, - 0x1e, 0x02, 0x1c, 0xbb, 0xfa, 0xca, 0x13, 0xb8, 0xc7, 0x98, 0xab, 0xae, 0x63, 0xf4, 0x7b, 0x06, - 0xf1, 0x3a, 0x97, 0x64, 0x18, 0xcf, 0x50, 0x81, 0xcf, 0x82, 0xc8, 0xaa, 0xd2, 0x96, 0xce, 0x6a, - 0x92, 0x3f, 0xfa, 0x0b, 0xb5, 0x9e, 0x9d, 0xea, 0x01, 0x1c, 0xa5, 0x06, 0xcc, 0x5e, 0xaa, 0x65, - 0x25, 0x2d, 0xb5, 0x65, 0x5d, 0x9b, 0xba, 0xd9, 0xcc, 0x7e, 0x5f, 0xa7, 0xb4, 0xa3, 0xb9, 0x18, - 0x5f, 0xc3, 0xa9, 0x29, 0xb2, 0xfc, 0x51, 0xed, 0xd0, 0x80, 0x44, 0x3b, 0xaf, 0xe1, 0x76, 0xfa, - 0xbf, 0x35, 0xd0, 0x5d, 0x28, 0x85, 0x2b, 0xf1, 0x1b, 0xbf, 0xfa, 0xf8, 0xf6, 0x2c, 0xc5, 0xbd, - 0xf1, 0x05, 0xa9, 0x4b, 0x6a, 0x9d, 0xe7, 0x7c, 0x99, 0xa7, 0x79, 0xd5, 0x7a, 0x5b, 0xd1, 0x02, - 0xcc, 0x72, 0xf5, 0x9b, 0xb7, 0xef, 0x84, 0xa5, 0x1f, 0xde, 0x09, 0x4b, 0x3f, 0xbe, 0x13, 0xb8, - 0xff, 0xbe, 0x13, 0xb8, 0x3f, 0x4d, 0x05, 0xee, 0xcf, 0x53, 0x81, 0xfb, 0xeb, 0x54, 0xe0, 0xfe, - 0x36, 0x15, 0xb8, 0xb7, 0x53, 0x81, 0xfb, 0xc7, 0x54, 0xe0, 0xfe, 0x39, 0x15, 0x96, 0x7e, 0x9c, - 0x0a, 0xdc, 0x9b, 0xf7, 0xc2, 0xd2, 0xdb, 0xf7, 0xc2, 0xd2, 0x0f, 0xef, 0x85, 0xa5, 0xee, 0x3a, - 0xfd, 0xef, 0xe1, 0x93, 0xff, 0x05, 0x00, 0x00, 0xff, 0xff, 0x99, 0xab, 0x3d, 0x2d, 0xd0, 0x14, - 0x00, 0x00, +func init() { proto.RegisterFile("pb/nodemessage.proto", fileDescriptor_nodemessage_e8ada71a29f9f0b3) } + +var fileDescriptor_nodemessage_e8ada71a29f9f0b3 = []byte{ + // 1588 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xcc, 0x58, 0xdd, 0x52, 0xdb, 0xd6, + 0x16, 0x8e, 0xf9, 0x31, 0x78, 0x61, 0x63, 0x79, 0xf3, 0x67, 0x20, 0x04, 0x50, 0x02, 0x21, 0x4e, + 0x0e, 0x24, 0x70, 0x4e, 0x26, 0x73, 0xa6, 0xbd, 0x10, 0x46, 0xc5, 0x1e, 0x1c, 0xdb, 0x95, 0x04, + 0x69, 0x7a, 0xa3, 0x91, 0xed, 0x1d, 0x5b, 0x83, 0x2c, 0xb9, 0xda, 0x22, 0x8d, 0xf3, 0x14, 0x79, + 0x99, 0xbe, 0x45, 0x5f, 0xa4, 0x97, 0xbd, 0xe9, 0x75, 0x47, 0x5b, 0x5b, 0x42, 0x96, 0x25, 0x13, + 0x32, 0xbd, 0xe8, 0x1d, 0x7b, 0xad, 0x6f, 0x7d, 0xeb, 0x47, 0xeb, 0xdb, 0x12, 0x86, 0xe5, 0x41, + 0xeb, 0xc8, 0xb4, 0x3a, 0xb8, 0x8f, 0x09, 0xd1, 0xba, 0xf8, 0x70, 0x60, 0x5b, 0x8e, 0x85, 0xa6, + 0x06, 0xad, 0x8d, 0x1c, 0xf3, 0x78, 0xa6, 0x8d, 0xc2, 0xa0, 0x75, 0x44, 0xf4, 0x6e, 0xbb, 0xa7, + 0xe9, 0x26, 0x33, 0x2d, 0x0e, 0x5a, 0x47, 0x2d, 0xc3, 0x6a, 0x5f, 0xb3, 0xb3, 0xcb, 0xe5, 0xd8, + 0x9a, 0x49, 0xb4, 0xb6, 0xa3, 0x5b, 0x0c, 0xc5, 0xab, 0x90, 0xbf, 0x34, 0x89, 0xde, 0x35, 0x71, + 0xe7, 0xad, 0x97, 0x04, 0x1d, 0x43, 0x96, 0xe5, 0x53, 0x9d, 0xe1, 0x00, 0x17, 0x53, 0x3b, 0xa9, + 0x83, 0xc5, 0xe3, 0xfc, 0xe1, 0xa0, 0x75, 0xc8, 0x20, 0xca, 0x70, 0x80, 0xa5, 0x85, 0xfe, 0xed, + 0x01, 0x15, 0x61, 0x8e, 0x1d, 0x8b, 0x53, 0x3b, 0xa9, 0x83, 0xac, 0xe4, 0x1f, 0xf9, 0x73, 0xc8, + 0xc9, 0x23, 0xf4, 0x21, 0x68, 0x6a, 0x04, 0x8a, 0x1e, 0x42, 0xc6, 0xad, 0x44, 0x73, 0x6e, 0x6c, + 0x9f, 0xe6, 0xd6, 0xc0, 0x7f, 0x0f, 0x33, 0x57, 0x96, 0x83, 0xd1, 0x2a, 0xa4, 0x7b, 0x58, 0xef, + 0xf6, 0x1c, 0x1a, 0x9e, 0x93, 0xd8, 0x09, 0x6d, 0x01, 0xd0, 0x76, 0xd5, 0x9e, 0x46, 0x7a, 0x7e, + 0x38, 0xb5, 0x54, 0x34, 0xd2, 0xe3, 0x2f, 0x00, 0x55, 0x2b, 0xda, 0x47, 0x7c, 0xea, 0x5a, 0x9a, + 0xb6, 0x35, 0xb0, 0x88, 0x66, 0x7c, 0x2b, 0xd9, 0x6f, 0x29, 0x58, 0x96, 0xf0, 0x2f, 0x37, 0x98, + 0x38, 0xa3, 0x7c, 0xa3, 0x71, 0xa9, 0x48, 0x1c, 0x3a, 0x84, 0x19, 0x3a, 0xd2, 0x29, 0x3a, 0xd2, + 0x0d, 0x77, 0xa4, 0x8c, 0x46, 0xb9, 0x7d, 0x32, 0x74, 0xba, 0x14, 0x87, 0xf6, 0x21, 0x4f, 0x7a, + 0x96, 0xed, 0x50, 0x3a, 0x95, 0x68, 0x86, 0x53, 0x9c, 0xa6, 0x9c, 0x39, 0x6a, 0x76, 0x39, 0x65, + 0xcd, 0x70, 0xa2, 0x38, 0xfd, 0x33, 0x2e, 0xce, 0xd0, 0x7e, 0x42, 0x38, 0xfd, 0x33, 0xe6, 0x75, + 0x58, 0x8f, 0x2b, 0x5b, 0xc2, 0x03, 0x63, 0x88, 0xb6, 0x61, 0x96, 0x56, 0x4a, 0xcb, 0x5e, 0x38, + 0xce, 0xb8, 0xd5, 0x51, 0x98, 0xe4, 0xd9, 0xd1, 0x73, 0x28, 0x84, 0x16, 0x88, 0xf8, 0xb3, 0x99, + 0x3e, 0xc8, 0x4a, 0x5c, 0xd8, 0x41, 0x47, 0xf4, 0x47, 0x0a, 0x36, 0x59, 0x2e, 0x3f, 0x4d, 0xa8, + 0x47, 0xf2, 0x2f, 0x9f, 0x54, 0x7c, 0xaf, 0xb3, 0x09, 0xbd, 0xbe, 0x83, 0x9d, 0x09, 0xad, 0x7a, + 0xd3, 0x3d, 0x81, 0x6c, 0x38, 0xae, 0x98, 0xda, 0x99, 0x3e, 0x58, 0xf0, 0x54, 0x15, 0x02, 0x4b, + 0x23, 0x20, 0x7e, 0x09, 0x0a, 0xe7, 0xd8, 0x29, 0x5b, 0x26, 0xc1, 0x26, 0xb9, 0x21, 0xb2, 0xa3, + 0x39, 0x98, 0xff, 0x2b, 0x05, 0xab, 0x63, 0x56, 0x2f, 0x49, 0x09, 0x0a, 0x06, 0xee, 0x74, 0xb1, + 0xad, 0x8e, 0x6d, 0x6f, 0xde, 0x73, 0x9c, 0x06, 0x13, 0x7e, 0x0c, 0x39, 0x86, 0x1d, 0x51, 0x40, + 0xd6, 0x33, 0x56, 0x3c, 0x1d, 0x3c, 0x03, 0xae, 0xed, 0xe7, 0xf1, 0x71, 0xd3, 0x14, 0x97, 0x0f, + 0xec, 0x0c, 0x7a, 0x0c, 0x2b, 0x7d, 0xdd, 0x54, 0x3f, 0x62, 0x5b, 0xff, 0xa0, 0x6b, 0x2d, 0x03, + 0xfb, 0xf8, 0x59, 0x8a, 0x5f, 0xea, 0xeb, 0xe6, 0x55, 0xe0, 0x63, 0x31, 0x2f, 0x00, 0xc8, 0xd0, + 0x6c, 0xab, 0xc4, 0x6d, 0x81, 0x3e, 0x88, 0xc5, 0xe3, 0x9c, 0x3b, 0x12, 0x79, 0x68, 0xb6, 0xbd, + 0xbe, 0x32, 0xc4, 0xff, 0x93, 0x97, 0x21, 0x7f, 0x8e, 0xbd, 0xcd, 0xad, 0x60, 0xad, 0x83, 0x6d, + 0x82, 0x76, 0x21, 0x4b, 0x1c, 0xcd, 0x7d, 0x9c, 0xe1, 0x1e, 0x16, 0xa8, 0xad, 0x12, 0x48, 0x19, + 0x9b, 0x1d, 0x1f, 0x30, 0x45, 0x01, 0x19, 0x6c, 0x76, 0x3c, 0x37, 0x7f, 0x0e, 0xcb, 0x11, 0x52, + 0x6f, 0x94, 0x47, 0x90, 0x63, 0x33, 0xf4, 0xac, 0xec, 0x81, 0x81, 0x5b, 0x9d, 0x07, 0x94, 0xb2, + 0xad, 0x50, 0x14, 0xff, 0x16, 0x32, 0x3e, 0xd1, 0x3f, 0x51, 0xd7, 0x09, 0x2c, 0x06, 0x74, 0x5e, + 0x45, 0xbb, 0x90, 0xa6, 0x09, 0xfd, 0x52, 0x42, 0x02, 0x65, 0x0e, 0xfe, 0xcb, 0x14, 0xcc, 0x4a, + 0xd8, 0xd0, 0x86, 0x68, 0x0f, 0x16, 0x89, 0xdd, 0x56, 0xf5, 0x0e, 0x36, 0x1d, 0xfd, 0x83, 0x8e, + 0x6d, 0x5a, 0x42, 0x46, 0xca, 0x11, 0xbb, 0x5d, 0x0d, 0x8c, 0x6e, 0x11, 0x2e, 0x6c, 0x70, 0xd3, + 0xba, 0xc6, 0xc3, 0x62, 0x9a, 0xdd, 0xb9, 0x76, 0xbb, 0x49, 0x0d, 0x68, 0x0d, 0xe6, 0x3a, 0x98, + 0x38, 0xaa, 0xde, 0x61, 0x5b, 0x94, 0x76, 0x8f, 0xd5, 0x8e, 0x7b, 0x89, 0x0f, 0xb4, 0xa1, 0x61, + 0x69, 0x1d, 0x26, 0x33, 0xff, 0x88, 0x0e, 0x61, 0xa9, 0xaf, 0x7d, 0x52, 0x7b, 0x96, 0xd1, 0xd1, + 0xcd, 0xae, 0x4a, 0x70, 0xdb, 0x32, 0x3b, 0x84, 0x2d, 0x41, 0xa1, 0xaf, 0x7d, 0xaa, 0x78, 0x1e, + 0xd9, 0x73, 0x44, 0xee, 0x81, 0xb9, 0xe8, 0x3d, 0xb0, 0x09, 0x19, 0x43, 0x23, 0x9e, 0x5c, 0x8b, + 0xf3, 0xd4, 0x3b, 0xef, 0x1a, 0xa8, 0x93, 0x87, 0x1c, 0xd1, 0xbb, 0x2a, 0x7d, 0xeb, 0xa9, 0x06, + 0x36, 0x8b, 0x19, 0x36, 0x66, 0xbd, 0x5b, 0x76, 0x6d, 0x35, 0x6c, 0xf2, 0x65, 0xc8, 0x8e, 0xdc, + 0x3b, 0xdf, 0xa4, 0xc3, 0x2e, 0xac, 0x9d, 0x6a, 0xed, 0x6b, 0xc7, 0xd6, 0xda, 0xd7, 0xb2, 0xff, + 0x46, 0xa2, 0x29, 0xd0, 0x1b, 0xc8, 0xdf, 0xd6, 0x80, 0x0d, 0xdc, 0xf7, 0x29, 0x39, 0xba, 0xc7, + 0xac, 0x12, 0xd1, 0xc0, 0x7d, 0x29, 0x47, 0x42, 0x27, 0x82, 0x10, 0xcc, 0x84, 0xf4, 0x49, 0xff, + 0xe6, 0x55, 0x78, 0x44, 0xdf, 0x52, 0xa3, 0x49, 0x42, 0x85, 0x25, 0xbe, 0xb1, 0xdc, 0x07, 0xee, + 0x07, 0x85, 0x75, 0x9f, 0x0b, 0xac, 0xf4, 0xaa, 0xaa, 0x06, 0x57, 0x55, 0x72, 0x8a, 0x71, 0xaa, + 0x54, 0x1c, 0xd5, 0xcf, 0xb0, 0x77, 0x17, 0x95, 0xb7, 0xb8, 0xaf, 0x60, 0x21, 0x34, 0x4d, 0xf6, + 0x7a, 0x19, 0x9b, 0x78, 0x18, 0xc3, 0x3f, 0x85, 0x42, 0x53, 0x37, 0x23, 0xa3, 0xf6, 0x07, 0x96, + 0xba, 0x1d, 0x58, 0xe9, 0xf7, 0x19, 0x58, 0x08, 0x7d, 0x95, 0xa0, 0xa7, 0xf0, 0xf8, 0xad, 0x28, + 0xcb, 0xc2, 0xb9, 0xa8, 0x2a, 0xef, 0x9b, 0xa2, 0xda, 0xac, 0x09, 0x65, 0xb1, 0xd2, 0xa8, 0x9d, + 0x89, 0x92, 0x7a, 0xd6, 0x50, 0xeb, 0x0d, 0x45, 0xbd, 0x94, 0x45, 0xee, 0x01, 0x9a, 0x87, 0x99, + 0xab, 0x86, 0x22, 0x72, 0x29, 0xb4, 0x0e, 0x2b, 0x55, 0xb5, 0x22, 0x5c, 0x89, 0xea, 0x69, 0xad, + 0x51, 0xbe, 0x50, 0x9b, 0x52, 0xa3, 0xd9, 0x90, 0x85, 0x1a, 0x37, 0x85, 0x36, 0x60, 0x55, 0x12, + 0x7f, 0xbc, 0x14, 0x65, 0x25, 0xea, 0x9b, 0x46, 0x3b, 0xf0, 0x30, 0xde, 0xa7, 0x4a, 0x62, 0xb3, + 0xf6, 0x9e, 0x9b, 0x41, 0x6b, 0xb0, 0x74, 0x2e, 0x2a, 0x6a, 0xb9, 0x51, 0x97, 0xc5, 0xba, 0x7c, + 0x29, 0xab, 0xb2, 0x22, 0x28, 0x22, 0x37, 0x8b, 0xb6, 0x60, 0x3d, 0xc6, 0xc1, 0xe2, 0xd2, 0x68, + 0x05, 0x0a, 0xae, 0xdb, 0x63, 0xad, 0x88, 0xc2, 0x99, 0x28, 0xc9, 0xdc, 0x1c, 0xda, 0x84, 0xb5, + 0x31, 0x33, 0x8b, 0x99, 0x47, 0x8b, 0x00, 0x81, 0x53, 0xe6, 0x32, 0x68, 0x19, 0xb8, 0xdb, 0x33, + 0x43, 0x01, 0xca, 0xc0, 0xac, 0x24, 0xd6, 0x84, 0xf7, 0xdc, 0x02, 0xe2, 0x20, 0xab, 0x48, 0x42, + 0x5d, 0x16, 0xca, 0x4a, 0xb5, 0x51, 0x97, 0xb9, 0xac, 0x5b, 0xd5, 0xa9, 0x50, 0xbe, 0x50, 0x24, + 0xa1, 0x7c, 0xa1, 0xca, 0xd5, 0xf3, 0xba, 0xa0, 0x5c, 0x4a, 0xa2, 0x5a, 0xae, 0x08, 0xd5, 0x3a, + 0x97, 0x43, 0xbb, 0xb0, 0xe5, 0xf7, 0x1b, 0x74, 0x3a, 0xc2, 0xb0, 0xe8, 0x0e, 0x7f, 0x22, 0x84, + 0xd5, 0x91, 0x47, 0xfb, 0xc0, 0xb3, 0x91, 0x47, 0xf2, 0x84, 0xe1, 0x1c, 0x17, 0x26, 0x9c, 0x04, + 0x2c, 0xa0, 0xff, 0xc0, 0xb3, 0xaf, 0x00, 0xb2, 0xfc, 0xc8, 0x7d, 0x32, 0xcd, 0x6a, 0x7d, 0xac, + 0xc9, 0xa5, 0x52, 0x19, 0x8a, 0x82, 0x61, 0x58, 0xbf, 0xe2, 0xce, 0xc8, 0x47, 0xab, 0xbf, 0x5a, + 0x42, 0xad, 0xd6, 0x78, 0x47, 0xc3, 0xc4, 0xb3, 0xc4, 0xd5, 0x2a, 0xfd, 0x99, 0x86, 0x0d, 0xc6, + 0x12, 0xf9, 0xb6, 0xa6, 0x3c, 0xcf, 0x60, 0xcf, 0xe3, 0xb9, 0xac, 0xdf, 0xc1, 0xe4, 0xd6, 0x19, + 0x81, 0xb2, 0x9d, 0x3d, 0x80, 0x27, 0x11, 0x47, 0xd2, 0x0a, 0x8f, 0x67, 0x4b, 0xdc, 0xe8, 0x7d, + 0xe0, 0x27, 0x42, 0xfd, 0xbd, 0x1e, 0xc7, 0xc5, 0xaf, 0xf9, 0x0b, 0x38, 0xb8, 0x1b, 0x17, 0x6c, + 0xfd, 0x13, 0xd8, 0x89, 0x41, 0x47, 0x45, 0x50, 0x82, 0xfd, 0xbb, 0x50, 0x81, 0x26, 0xb6, 0x60, + 0x3d, 0x09, 0xeb, 0x4a, 0xe4, 0x31, 0x6c, 0x27, 0xba, 0x03, 0xc5, 0x14, 0x61, 0x79, 0x6c, 0x26, + 0x9e, 0x80, 0xb6, 0x61, 0x33, 0xe2, 0x89, 0xe8, 0x69, 0xbc, 0xfd, 0x49, 0xf2, 0x7a, 0x09, 0x2f, + 0x12, 0x86, 0x9f, 0xa4, 0xb6, 0xd7, 0x70, 0x7c, 0x9f, 0x88, 0x40, 0x7c, 0xff, 0x83, 0x57, 0xf1, + 0xbb, 0x33, 0x59, 0x8b, 0xc9, 0xe9, 0x26, 0x4b, 0xf3, 0x3b, 0x78, 0x73, 0xff, 0xb8, 0x40, 0xa9, + 0xe3, 0xbb, 0x16, 0x2f, 0xdc, 0x2f, 0xe9, 0x40, 0xb9, 0x67, 0xba, 0x8d, 0xdb, 0x4e, 0xac, 0x72, + 0xcf, 0xaa, 0x92, 0x58, 0x56, 0x92, 0xf5, 0xb6, 0x02, 0x85, 0x11, 0x20, 0x53, 0x5b, 0x50, 0x04, + 0x33, 0x27, 0x69, 0x2d, 0x9a, 0x27, 0x51, 0x69, 0xc1, 0xae, 0xc7, 0x02, 0x7d, 0x9d, 0x45, 0x51, + 0xf1, 0x2a, 0x0b, 0x14, 0x91, 0x8c, 0x0a, 0x34, 0xc6, 0xc3, 0xa3, 0x31, 0x6c, 0x54, 0x61, 0xc1, + 0xd5, 0x92, 0x84, 0x09, 0xf4, 0xb5, 0x09, 0x6b, 0xf1, 0x48, 0x57, 0x5d, 0xbb, 0xb0, 0x95, 0xe0, + 0x0c, 0xb4, 0x15, 0xad, 0x7c, 0x92, 0x3c, 0x0e, 0xa1, 0x14, 0x3b, 0xb1, 0x24, 0x71, 0xfc, 0x17, + 0x5e, 0x7e, 0x3d, 0x3e, 0x90, 0xc6, 0x09, 0x1c, 0xc5, 0x3d, 0xe8, 0xc9, 0xc2, 0x48, 0x4a, 0x35, + 0x59, 0x16, 0xff, 0x87, 0xd7, 0xf7, 0x8d, 0x0a, 0x44, 0x11, 0x5d, 0x8c, 0x78, 0x49, 0xfc, 0x04, + 0x6b, 0x4c, 0x11, 0xf4, 0x5f, 0x82, 0xb0, 0x20, 0x82, 0x85, 0xa6, 0x97, 0xd9, 0x57, 0xe8, 0xc1, + 0xc3, 0xb1, 0xab, 0xaf, 0x34, 0x84, 0x6d, 0xc6, 0x7c, 0x6a, 0x5b, 0x5a, 0xa7, 0xad, 0x11, 0xa7, + 0x79, 0x43, 0x7a, 0xe1, 0x0c, 0x47, 0xf0, 0xdc, 0x8b, 0x3c, 0x95, 0x1a, 0xc2, 0x59, 0x59, 0x70, + 0x47, 0x7f, 0x29, 0x57, 0x92, 0x53, 0xed, 0xc1, 0x6e, 0x6c, 0xc0, 0xe8, 0xa5, 0x5a, 0x92, 0xe2, + 0x52, 0x1b, 0xc6, 0x9d, 0xa9, 0x6b, 0xb5, 0xe4, 0xf7, 0x75, 0x4c, 0x3b, 0x8a, 0x8d, 0xf1, 0x1d, + 0x9c, 0x8a, 0x24, 0x8a, 0xf7, 0x6a, 0x87, 0x06, 0x44, 0xda, 0xf9, 0x04, 0xab, 0xf1, 0x3f, 0x6b, + 0xa0, 0x87, 0x50, 0xf4, 0x57, 0xe2, 0x07, 0xb7, 0xfa, 0xf0, 0xf6, 0x3c, 0x08, 0x7b, 0xc3, 0x0b, + 0x52, 0x11, 0xe4, 0x0a, 0x97, 0x72, 0x65, 0x1e, 0xe7, 0x95, 0x2b, 0x0d, 0x49, 0xf1, 0x30, 0x53, + 0xad, 0x34, 0xfd, 0xfd, 0xef, 0xe4, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0xe6, 0xb9, 0xf1, 0xf1, + 0x63, 0x14, 0x00, 0x00, } diff --git a/pb/nodemessage.proto b/pb/nodemessage.proto index 0cce611ad..3fb7ebe00 100644 --- a/pb/nodemessage.proto +++ b/pb/nodemessage.proto @@ -2,23 +2,11 @@ syntax = "proto3"; package pb; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; import "pb/node.proto"; import "pb/sigchain.proto"; import "pb/block.proto"; import "pb/transaction.proto"; -option (gogoproto.gostring_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option (gogoproto.testgen_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.populate_all) = true; - enum MessageType { MESSAGE_TYPE_PLACEHOLDER_DO_NOT_USE = 0; // Placeholder, do not use or change VOTE = 1; diff --git a/pb/nodemessagepb_test.go b/pb/nodemessagepb_test.go deleted file mode 100644 index f40b84397..000000000 --- a/pb/nodemessagepb_test.go +++ /dev/null @@ -1,3089 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb/nodemessage.proto - -package pb - -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import fmt "fmt" -import go_parser "go/parser" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestUnsignedMessageProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedMessage(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestUnsignedMessageMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedMessage(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSignedMessageProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSignedMessage(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SignedMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestSignedMessageMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSignedMessage(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SignedMessage{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestVoteProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedVote(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Vote{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestVoteMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedVote(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Vote{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIHaveBlockProposalProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveBlockProposal(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IHaveBlockProposal{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestIHaveBlockProposalMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveBlockProposal(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IHaveBlockProposal{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestBlockProposalProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposal(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestBlockProposal{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRequestBlockProposalMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposal(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestBlockProposal{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestBlockProposalReplyProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposalReply(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestBlockProposalReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRequestBlockProposalReplyMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposalReply(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestBlockProposalReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestProposalTransactionsProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactions(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestProposalTransactions{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRequestProposalTransactionsMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactions(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestProposalTransactions{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestProposalTransactionsReplyProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactionsReply(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestProposalTransactionsReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRequestProposalTransactionsReplyMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactionsReply(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestProposalTransactionsReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetConsensusStateProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusState(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetConsensusState{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGetConsensusStateMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusState(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetConsensusState{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetConsensusStateReplyProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusStateReply(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetConsensusStateReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGetConsensusStateReplyMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusStateReply(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetConsensusStateReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlockHeadersProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeaders(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlockHeaders{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGetBlockHeadersMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeaders(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlockHeaders{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlockHeadersReplyProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeadersReply(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlockHeadersReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGetBlockHeadersReplyMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeadersReply(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlockHeadersReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlocksProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocks(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlocks{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGetBlocksMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocks(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlocks{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlocksReplyProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocksReply(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlocksReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGetBlocksReplyMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocksReply(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlocksReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRelayProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRelay(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Relay{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRelayMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRelay(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Relay{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransactionsProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransactions(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Transactions{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestTransactionsMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransactions(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Transactions{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBacktrackSignatureChainProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBacktrackSignatureChain(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &BacktrackSignatureChain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestBacktrackSignatureChainMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBacktrackSignatureChain(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &BacktrackSignatureChain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIHaveSignatureChainTransactionProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveSignatureChainTransaction(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IHaveSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestIHaveSignatureChainTransactionMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveSignatureChainTransaction(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IHaveSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestSignatureChainTransactionProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransaction(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRequestSignatureChainTransactionMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransaction(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestSignatureChainTransactionReplyProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestSignatureChainTransactionReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRequestSignatureChainTransactionReplyMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestSignatureChainTransactionReply{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestPinSignatureChainProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPinSignatureChain(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &PinSignatureChain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestPinSignatureChainMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPinSignatureChain(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &PinSignatureChain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedMessageJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedMessage(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedMessage{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestSignedMessageJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSignedMessage(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SignedMessage{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestVoteJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedVote(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Vote{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestIHaveBlockProposalJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveBlockProposal(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IHaveBlockProposal{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRequestBlockProposalJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposal(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestBlockProposal{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRequestBlockProposalReplyJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposalReply(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestBlockProposalReply{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRequestProposalTransactionsJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactions(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestProposalTransactions{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRequestProposalTransactionsReplyJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactionsReply(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestProposalTransactionsReply{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGetConsensusStateJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusState(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetConsensusState{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGetConsensusStateReplyJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusStateReply(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetConsensusStateReply{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGetBlockHeadersJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeaders(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlockHeaders{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGetBlockHeadersReplyJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeadersReply(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlockHeadersReply{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGetBlocksJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocks(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlocks{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGetBlocksReplyJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocksReply(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GetBlocksReply{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRelayJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRelay(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Relay{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestTransactionsJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransactions(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Transactions{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestBacktrackSignatureChainJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBacktrackSignatureChain(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &BacktrackSignatureChain{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestIHaveSignatureChainTransactionJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveSignatureChainTransaction(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IHaveSignatureChainTransaction{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRequestSignatureChainTransactionJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransaction(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestSignatureChainTransaction{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRequestSignatureChainTransactionReplyJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RequestSignatureChainTransactionReply{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestPinSignatureChainJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPinSignatureChain(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &PinSignatureChain{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestUnsignedMessageProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &UnsignedMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedMessageProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &UnsignedMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSignedMessageProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSignedMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &SignedMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSignedMessageProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSignedMessage(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &SignedMessage{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestVoteProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedVote(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Vote{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestVoteProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedVote(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Vote{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIHaveBlockProposalProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveBlockProposal(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &IHaveBlockProposal{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIHaveBlockProposalProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveBlockProposal(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &IHaveBlockProposal{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestBlockProposalProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposal(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RequestBlockProposal{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestBlockProposalProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposal(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RequestBlockProposal{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestBlockProposalReplyProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposalReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RequestBlockProposalReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestBlockProposalReplyProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposalReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RequestBlockProposalReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestProposalTransactionsProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactions(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RequestProposalTransactions{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestProposalTransactionsProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactions(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RequestProposalTransactions{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestProposalTransactionsReplyProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactionsReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RequestProposalTransactionsReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestProposalTransactionsReplyProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactionsReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RequestProposalTransactionsReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetConsensusStateProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusState(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GetConsensusState{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetConsensusStateProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusState(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GetConsensusState{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetConsensusStateReplyProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusStateReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GetConsensusStateReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetConsensusStateReplyProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusStateReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GetConsensusStateReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlockHeadersProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeaders(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GetBlockHeaders{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlockHeadersProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeaders(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GetBlockHeaders{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlockHeadersReplyProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeadersReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GetBlockHeadersReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlockHeadersReplyProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeadersReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GetBlockHeadersReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlocksProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocks(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GetBlocks{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlocksProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocks(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GetBlocks{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlocksReplyProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocksReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GetBlocksReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGetBlocksReplyProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocksReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GetBlocksReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRelayProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRelay(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Relay{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRelayProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRelay(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Relay{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransactionsProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransactions(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Transactions{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransactionsProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransactions(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Transactions{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBacktrackSignatureChainProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBacktrackSignatureChain(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &BacktrackSignatureChain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestBacktrackSignatureChainProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBacktrackSignatureChain(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &BacktrackSignatureChain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIHaveSignatureChainTransactionProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveSignatureChainTransaction(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &IHaveSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIHaveSignatureChainTransactionProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveSignatureChainTransaction(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &IHaveSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestSignatureChainTransactionProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransaction(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RequestSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestSignatureChainTransactionProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransaction(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RequestSignatureChainTransaction{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestSignatureChainTransactionReplyProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RequestSignatureChainTransactionReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRequestSignatureChainTransactionReplyProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RequestSignatureChainTransactionReply{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestPinSignatureChainProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPinSignatureChain(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &PinSignatureChain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestPinSignatureChainProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPinSignatureChain(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &PinSignatureChain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedMessageGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsignedMessage(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestSignedMessageGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSignedMessage(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestVoteGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedVote(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestIHaveBlockProposalGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedIHaveBlockProposal(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRequestBlockProposalGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestBlockProposal(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRequestBlockProposalReplyGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestBlockProposalReply(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRequestProposalTransactionsGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestProposalTransactions(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRequestProposalTransactionsReplyGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestProposalTransactionsReply(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGetConsensusStateGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetConsensusState(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGetConsensusStateReplyGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetConsensusStateReply(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGetBlockHeadersGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlockHeaders(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGetBlockHeadersReplyGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlockHeadersReply(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGetBlocksGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlocks(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGetBlocksReplyGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlocksReply(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRelayGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRelay(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestTransactionsGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransactions(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestBacktrackSignatureChainGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedBacktrackSignatureChain(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestIHaveSignatureChainTransactionGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedIHaveSignatureChainTransaction(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRequestSignatureChainTransactionGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestSignatureChainTransaction(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRequestSignatureChainTransactionReplyGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestPinSignatureChainGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedPinSignatureChain(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestUnsignedMessageSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedMessage(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestSignedMessageSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSignedMessage(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestVoteSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedVote(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestIHaveBlockProposalSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveBlockProposal(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRequestBlockProposalSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposal(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRequestBlockProposalReplySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestBlockProposalReply(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRequestProposalTransactionsSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactions(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRequestProposalTransactionsReplySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestProposalTransactionsReply(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGetConsensusStateSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusState(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGetConsensusStateReplySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetConsensusStateReply(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGetBlockHeadersSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeaders(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGetBlockHeadersReplySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlockHeadersReply(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGetBlocksSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocks(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGetBlocksReplySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGetBlocksReply(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRelaySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRelay(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestTransactionsSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransactions(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestBacktrackSignatureChainSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedBacktrackSignatureChain(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestIHaveSignatureChainTransactionSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIHaveSignatureChainTransaction(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRequestSignatureChainTransactionSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransaction(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRequestSignatureChainTransactionReplySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestPinSignatureChainSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPinSignatureChain(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestUnsignedMessageStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsignedMessage(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestSignedMessageStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSignedMessage(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestVoteStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedVote(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestIHaveBlockProposalStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedIHaveBlockProposal(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRequestBlockProposalStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestBlockProposal(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRequestBlockProposalReplyStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestBlockProposalReply(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRequestProposalTransactionsStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestProposalTransactions(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRequestProposalTransactionsReplyStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestProposalTransactionsReply(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGetConsensusStateStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetConsensusState(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGetConsensusStateReplyStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetConsensusStateReply(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGetBlockHeadersStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlockHeaders(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGetBlockHeadersReplyStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlockHeadersReply(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGetBlocksStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlocks(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGetBlocksReplyStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGetBlocksReply(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRelayStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRelay(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestTransactionsStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransactions(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestBacktrackSignatureChainStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedBacktrackSignatureChain(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestIHaveSignatureChainTransactionStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedIHaveSignatureChainTransaction(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRequestSignatureChainTransactionStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestSignatureChainTransaction(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRequestSignatureChainTransactionReplyStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRequestSignatureChainTransactionReply(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestPinSignatureChainStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedPinSignatureChain(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/pb/nodepb_test.go b/pb/nodepb_test.go deleted file mode 100644 index 5b5beb265..000000000 --- a/pb/nodepb_test.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb/node.proto - -package pb - -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import fmt "fmt" -import go_parser "go/parser" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestNodeDataProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNodeData(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &NodeData{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestNodeDataMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNodeData(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &NodeData{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNodeDataJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNodeData(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &NodeData{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestNodeDataProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNodeData(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &NodeData{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNodeDataProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNodeData(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &NodeData{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNodeDataGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedNodeData(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestNodeDataSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNodeData(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestNodeDataStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedNodeData(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/pb/sigchain.pb.go b/pb/sigchain.pb.go index 1d0334468..8a2803ed4 100644 --- a/pb/sigchain.pb.go +++ b/pb/sigchain.pb.go @@ -1,21 +1,11 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: pb/sigchain.proto package pb -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strconv "strconv" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -26,13 +16,13 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type SigAlgo int32 const ( - SIGNATURE SigAlgo = 0 - HASH SigAlgo = 1 + SigAlgo_SIGNATURE SigAlgo = 0 + SigAlgo_HASH SigAlgo = 1 ) var SigAlgo_name = map[int32]string{ @@ -44,45 +34,43 @@ var SigAlgo_value = map[string]int32{ "HASH": 1, } +func (x SigAlgo) String() string { + return proto.EnumName(SigAlgo_name, int32(x)) +} func (SigAlgo) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_sigchain_d3760cf481b3653e, []int{0} + return fileDescriptor_sigchain_b37b4a10da0094fd, []int{0} } type SigChainElem struct { - Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` - NextPubkey []byte `protobuf:"bytes,2,opt,name=next_pubkey,json=nextPubkey,proto3" json:"next_pubkey,omitempty"` - Mining bool `protobuf:"varint,3,opt,name=mining,proto3" json:"mining,omitempty"` - Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` - SigAlgo SigAlgo `protobuf:"varint,5,opt,name=sig_algo,json=sigAlgo,proto3,enum=pb.SigAlgo" json:"sig_algo,omitempty"` - Vrf []byte `protobuf:"bytes,6,opt,name=vrf,proto3" json:"vrf,omitempty"` - Proof []byte `protobuf:"bytes,7,opt,name=proof,proto3" json:"proof,omitempty"` -} - -func (m *SigChainElem) Reset() { *m = SigChainElem{} } -func (*SigChainElem) ProtoMessage() {} + Id []byte `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"` + NextPubkey []byte `protobuf:"bytes,2,opt,name=next_pubkey,json=nextPubkey,proto3" json:"next_pubkey,omitempty"` + Mining bool `protobuf:"varint,3,opt,name=mining,proto3" json:"mining,omitempty"` + Signature []byte `protobuf:"bytes,4,opt,name=signature,proto3" json:"signature,omitempty"` + SigAlgo SigAlgo `protobuf:"varint,5,opt,name=sig_algo,json=sigAlgo,proto3,enum=pb.SigAlgo" json:"sig_algo,omitempty"` + Vrf []byte `protobuf:"bytes,6,opt,name=vrf,proto3" json:"vrf,omitempty"` + Proof []byte `protobuf:"bytes,7,opt,name=proof,proto3" json:"proof,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SigChainElem) Reset() { *m = SigChainElem{} } +func (m *SigChainElem) String() string { return proto.CompactTextString(m) } +func (*SigChainElem) ProtoMessage() {} func (*SigChainElem) Descriptor() ([]byte, []int) { - return fileDescriptor_sigchain_d3760cf481b3653e, []int{0} + return fileDescriptor_sigchain_b37b4a10da0094fd, []int{0} } func (m *SigChainElem) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_SigChainElem.Unmarshal(m, b) } func (m *SigChainElem) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SigChainElem.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_SigChainElem.Marshal(b, m, deterministic) } func (dst *SigChainElem) XXX_Merge(src proto.Message) { xxx_messageInfo_SigChainElem.Merge(dst, src) } func (m *SigChainElem) XXX_Size() int { - return m.Size() + return xxx_messageInfo_SigChainElem.Size(m) } func (m *SigChainElem) XXX_DiscardUnknown() { xxx_messageInfo_SigChainElem.DiscardUnknown(m) @@ -122,7 +110,7 @@ func (m *SigChainElem) GetSigAlgo() SigAlgo { if m != nil { return m.SigAlgo } - return SIGNATURE + return SigAlgo_SIGNATURE } func (m *SigChainElem) GetVrf() []byte { @@ -140,41 +128,36 @@ func (m *SigChainElem) GetProof() []byte { } type SigChain struct { - Nonce uint32 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` - DataSize uint32 `protobuf:"varint,2,opt,name=data_size,json=dataSize,proto3" json:"data_size,omitempty"` - BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` - SrcId []byte `protobuf:"bytes,4,opt,name=src_id,json=srcId,proto3" json:"src_id,omitempty"` - SrcPubkey []byte `protobuf:"bytes,5,opt,name=src_pubkey,json=srcPubkey,proto3" json:"src_pubkey,omitempty"` - DestId []byte `protobuf:"bytes,6,opt,name=dest_id,json=destId,proto3" json:"dest_id,omitempty"` - DestPubkey []byte `protobuf:"bytes,7,opt,name=dest_pubkey,json=destPubkey,proto3" json:"dest_pubkey,omitempty"` - Elems []*SigChainElem `protobuf:"bytes,8,rep,name=elems" json:"elems,omitempty"` -} - -func (m *SigChain) Reset() { *m = SigChain{} } -func (*SigChain) ProtoMessage() {} + Nonce uint32 `protobuf:"varint,1,opt,name=nonce,proto3" json:"nonce,omitempty"` + DataSize uint32 `protobuf:"varint,2,opt,name=data_size,json=dataSize,proto3" json:"data_size,omitempty"` + BlockHash []byte `protobuf:"bytes,3,opt,name=block_hash,json=blockHash,proto3" json:"block_hash,omitempty"` + SrcId []byte `protobuf:"bytes,4,opt,name=src_id,json=srcId,proto3" json:"src_id,omitempty"` + SrcPubkey []byte `protobuf:"bytes,5,opt,name=src_pubkey,json=srcPubkey,proto3" json:"src_pubkey,omitempty"` + DestId []byte `protobuf:"bytes,6,opt,name=dest_id,json=destId,proto3" json:"dest_id,omitempty"` + DestPubkey []byte `protobuf:"bytes,7,opt,name=dest_pubkey,json=destPubkey,proto3" json:"dest_pubkey,omitempty"` + Elems []*SigChainElem `protobuf:"bytes,8,rep,name=elems,proto3" json:"elems,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *SigChain) Reset() { *m = SigChain{} } +func (m *SigChain) String() string { return proto.CompactTextString(m) } +func (*SigChain) ProtoMessage() {} func (*SigChain) Descriptor() ([]byte, []int) { - return fileDescriptor_sigchain_d3760cf481b3653e, []int{1} + return fileDescriptor_sigchain_b37b4a10da0094fd, []int{1} } func (m *SigChain) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_SigChain.Unmarshal(m, b) } func (m *SigChain) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SigChain.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_SigChain.Marshal(b, m, deterministic) } func (dst *SigChain) XXX_Merge(src proto.Message) { xxx_messageInfo_SigChain.Merge(dst, src) } func (m *SigChain) XXX_Size() int { - return m.Size() + return xxx_messageInfo_SigChain.Size(m) } func (m *SigChain) XXX_DiscardUnknown() { xxx_messageInfo_SigChain.DiscardUnknown(m) @@ -243,1221 +226,32 @@ func init() { proto.RegisterType((*SigChain)(nil), "pb.SigChain") proto.RegisterEnum("pb.SigAlgo", SigAlgo_name, SigAlgo_value) } -func (x SigAlgo) String() string { - s, ok := SigAlgo_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *SigChainElem) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SigChainElem) - if !ok { - that2, ok := that.(SigChainElem) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Id, that1.Id) { - return false - } - if !bytes.Equal(this.NextPubkey, that1.NextPubkey) { - return false - } - if this.Mining != that1.Mining { - return false - } - if !bytes.Equal(this.Signature, that1.Signature) { - return false - } - if this.SigAlgo != that1.SigAlgo { - return false - } - if !bytes.Equal(this.Vrf, that1.Vrf) { - return false - } - if !bytes.Equal(this.Proof, that1.Proof) { - return false - } - return true -} -func (this *SigChain) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SigChain) - if !ok { - that2, ok := that.(SigChain) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Nonce != that1.Nonce { - return false - } - if this.DataSize != that1.DataSize { - return false - } - if !bytes.Equal(this.BlockHash, that1.BlockHash) { - return false - } - if !bytes.Equal(this.SrcId, that1.SrcId) { - return false - } - if !bytes.Equal(this.SrcPubkey, that1.SrcPubkey) { - return false - } - if !bytes.Equal(this.DestId, that1.DestId) { - return false - } - if !bytes.Equal(this.DestPubkey, that1.DestPubkey) { - return false - } - if len(this.Elems) != len(that1.Elems) { - return false - } - for i := range this.Elems { - if !this.Elems[i].Equal(that1.Elems[i]) { - return false - } - } - return true -} -func (this *SigChainElem) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 11) - s = append(s, "&pb.SigChainElem{") - s = append(s, "Id: "+fmt.Sprintf("%#v", this.Id)+",\n") - s = append(s, "NextPubkey: "+fmt.Sprintf("%#v", this.NextPubkey)+",\n") - s = append(s, "Mining: "+fmt.Sprintf("%#v", this.Mining)+",\n") - s = append(s, "Signature: "+fmt.Sprintf("%#v", this.Signature)+",\n") - s = append(s, "SigAlgo: "+fmt.Sprintf("%#v", this.SigAlgo)+",\n") - s = append(s, "Vrf: "+fmt.Sprintf("%#v", this.Vrf)+",\n") - s = append(s, "Proof: "+fmt.Sprintf("%#v", this.Proof)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SigChain) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 12) - s = append(s, "&pb.SigChain{") - s = append(s, "Nonce: "+fmt.Sprintf("%#v", this.Nonce)+",\n") - s = append(s, "DataSize: "+fmt.Sprintf("%#v", this.DataSize)+",\n") - s = append(s, "BlockHash: "+fmt.Sprintf("%#v", this.BlockHash)+",\n") - s = append(s, "SrcId: "+fmt.Sprintf("%#v", this.SrcId)+",\n") - s = append(s, "SrcPubkey: "+fmt.Sprintf("%#v", this.SrcPubkey)+",\n") - s = append(s, "DestId: "+fmt.Sprintf("%#v", this.DestId)+",\n") - s = append(s, "DestPubkey: "+fmt.Sprintf("%#v", this.DestPubkey)+",\n") - if this.Elems != nil { - s = append(s, "Elems: "+fmt.Sprintf("%#v", this.Elems)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringSigchain(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *SigChainElem) 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 *SigChainElem) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Id) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.Id))) - i += copy(dAtA[i:], m.Id) - } - if len(m.NextPubkey) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.NextPubkey))) - i += copy(dAtA[i:], m.NextPubkey) - } - if m.Mining { - dAtA[i] = 0x18 - i++ - if m.Mining { - dAtA[i] = 1 - } else { - dAtA[i] = 0 - } - i++ - } - if len(m.Signature) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.Signature))) - i += copy(dAtA[i:], m.Signature) - } - if m.SigAlgo != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(m.SigAlgo)) - } - if len(m.Vrf) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.Vrf))) - i += copy(dAtA[i:], m.Vrf) - } - if len(m.Proof) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.Proof))) - i += copy(dAtA[i:], m.Proof) - } - return i, nil -} - -func (m *SigChain) 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 *SigChain) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Nonce != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(m.Nonce)) - } - if m.DataSize != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(m.DataSize)) - } - if len(m.BlockHash) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.BlockHash))) - i += copy(dAtA[i:], m.BlockHash) - } - if len(m.SrcId) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.SrcId))) - i += copy(dAtA[i:], m.SrcId) - } - if len(m.SrcPubkey) > 0 { - dAtA[i] = 0x2a - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.SrcPubkey))) - i += copy(dAtA[i:], m.SrcPubkey) - } - if len(m.DestId) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.DestId))) - i += copy(dAtA[i:], m.DestId) - } - if len(m.DestPubkey) > 0 { - dAtA[i] = 0x3a - i++ - i = encodeVarintSigchain(dAtA, i, uint64(len(m.DestPubkey))) - i += copy(dAtA[i:], m.DestPubkey) - } - if len(m.Elems) > 0 { - for _, msg := range m.Elems { - dAtA[i] = 0x42 - i++ - i = encodeVarintSigchain(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func encodeVarintSigchain(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 NewPopulatedSigChainElem(r randySigchain, easy bool) *SigChainElem { - this := &SigChainElem{} - v1 := r.Intn(100) - this.Id = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Id[i] = byte(r.Intn(256)) - } - v2 := r.Intn(100) - this.NextPubkey = make([]byte, v2) - for i := 0; i < v2; i++ { - this.NextPubkey[i] = byte(r.Intn(256)) - } - this.Mining = bool(bool(r.Intn(2) == 0)) - v3 := r.Intn(100) - this.Signature = make([]byte, v3) - for i := 0; i < v3; i++ { - this.Signature[i] = byte(r.Intn(256)) - } - this.SigAlgo = SigAlgo([]int32{0, 1}[r.Intn(2)]) - v4 := r.Intn(100) - this.Vrf = make([]byte, v4) - for i := 0; i < v4; i++ { - this.Vrf[i] = byte(r.Intn(256)) - } - v5 := r.Intn(100) - this.Proof = make([]byte, v5) - for i := 0; i < v5; i++ { - this.Proof[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedSigChain(r randySigchain, easy bool) *SigChain { - this := &SigChain{} - this.Nonce = uint32(r.Uint32()) - this.DataSize = uint32(r.Uint32()) - v6 := r.Intn(100) - this.BlockHash = make([]byte, v6) - for i := 0; i < v6; i++ { - this.BlockHash[i] = byte(r.Intn(256)) - } - v7 := r.Intn(100) - this.SrcId = make([]byte, v7) - for i := 0; i < v7; i++ { - this.SrcId[i] = byte(r.Intn(256)) - } - v8 := r.Intn(100) - this.SrcPubkey = make([]byte, v8) - for i := 0; i < v8; i++ { - this.SrcPubkey[i] = byte(r.Intn(256)) - } - v9 := r.Intn(100) - this.DestId = make([]byte, v9) - for i := 0; i < v9; i++ { - this.DestId[i] = byte(r.Intn(256)) - } - v10 := r.Intn(100) - this.DestPubkey = make([]byte, v10) - for i := 0; i < v10; i++ { - this.DestPubkey[i] = byte(r.Intn(256)) - } - if r.Intn(10) != 0 { - v11 := r.Intn(5) - this.Elems = make([]*SigChainElem, v11) - for i := 0; i < v11; i++ { - this.Elems[i] = NewPopulatedSigChainElem(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randySigchain interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneSigchain(r randySigchain) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringSigchain(r randySigchain) string { - v12 := r.Intn(100) - tmps := make([]rune, v12) - for i := 0; i < v12; i++ { - tmps[i] = randUTF8RuneSigchain(r) - } - return string(tmps) -} -func randUnrecognizedSigchain(r randySigchain, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldSigchain(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldSigchain(dAtA []byte, r randySigchain, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateSigchain(dAtA, uint64(key)) - v13 := r.Int63() - if r.Intn(2) == 0 { - v13 *= -1 - } - dAtA = encodeVarintPopulateSigchain(dAtA, uint64(v13)) - case 1: - dAtA = encodeVarintPopulateSigchain(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateSigchain(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateSigchain(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateSigchain(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateSigchain(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *SigChainElem) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Id) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - l = len(m.NextPubkey) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - if m.Mining { - n += 2 - } - l = len(m.Signature) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - if m.SigAlgo != 0 { - n += 1 + sovSigchain(uint64(m.SigAlgo)) - } - l = len(m.Vrf) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - l = len(m.Proof) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - return n -} - -func (m *SigChain) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Nonce != 0 { - n += 1 + sovSigchain(uint64(m.Nonce)) - } - if m.DataSize != 0 { - n += 1 + sovSigchain(uint64(m.DataSize)) - } - l = len(m.BlockHash) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - l = len(m.SrcId) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - l = len(m.SrcPubkey) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - l = len(m.DestId) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - l = len(m.DestPubkey) - if l > 0 { - n += 1 + l + sovSigchain(uint64(l)) - } - if len(m.Elems) > 0 { - for _, e := range m.Elems { - l = e.Size() - n += 1 + l + sovSigchain(uint64(l)) - } - } - return n -} - -func sovSigchain(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozSigchain(x uint64) (n int) { - return sovSigchain(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *SigChainElem) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SigChainElem{`, - `Id:` + fmt.Sprintf("%v", this.Id) + `,`, - `NextPubkey:` + fmt.Sprintf("%v", this.NextPubkey) + `,`, - `Mining:` + fmt.Sprintf("%v", this.Mining) + `,`, - `Signature:` + fmt.Sprintf("%v", this.Signature) + `,`, - `SigAlgo:` + fmt.Sprintf("%v", this.SigAlgo) + `,`, - `Vrf:` + fmt.Sprintf("%v", this.Vrf) + `,`, - `Proof:` + fmt.Sprintf("%v", this.Proof) + `,`, - `}`, - }, "") - return s -} -func (this *SigChain) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SigChain{`, - `Nonce:` + fmt.Sprintf("%v", this.Nonce) + `,`, - `DataSize:` + fmt.Sprintf("%v", this.DataSize) + `,`, - `BlockHash:` + fmt.Sprintf("%v", this.BlockHash) + `,`, - `SrcId:` + fmt.Sprintf("%v", this.SrcId) + `,`, - `SrcPubkey:` + fmt.Sprintf("%v", this.SrcPubkey) + `,`, - `DestId:` + fmt.Sprintf("%v", this.DestId) + `,`, - `DestPubkey:` + fmt.Sprintf("%v", this.DestPubkey) + `,`, - `Elems:` + strings.Replace(fmt.Sprintf("%v", this.Elems), "SigChainElem", "SigChainElem", 1) + `,`, - `}`, - }, "") - return s -} -func valueToStringSigchain(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *SigChainElem) 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 ErrIntOverflowSigchain - } - 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: SigChainElem: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SigChainElem: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Id = append(m.Id[:0], dAtA[iNdEx:postIndex]...) - if m.Id == nil { - m.Id = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field NextPubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.NextPubkey = append(m.NextPubkey[:0], dAtA[iNdEx:postIndex]...) - if m.NextPubkey == nil { - m.NextPubkey = []byte{} - } - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Mining", wireType) - } - var v int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - v |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - m.Mining = bool(v != 0) - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Signature", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Signature = append(m.Signature[:0], dAtA[iNdEx:postIndex]...) - if m.Signature == nil { - m.Signature = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field SigAlgo", wireType) - } - m.SigAlgo = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.SigAlgo |= (SigAlgo(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Vrf", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Vrf = append(m.Vrf[:0], dAtA[iNdEx:postIndex]...) - if m.Vrf == nil { - m.Vrf = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Proof", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Proof = append(m.Proof[:0], dAtA[iNdEx:postIndex]...) - if m.Proof == nil { - m.Proof = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigchain(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSigchain - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SigChain) 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 ErrIntOverflowSigchain - } - 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: SigChain: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SigChain: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) - } - m.Nonce = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nonce |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field DataSize", wireType) - } - m.DataSize = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.DataSize |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field BlockHash", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.BlockHash = append(m.BlockHash[:0], dAtA[iNdEx:postIndex]...) - if m.BlockHash == nil { - m.BlockHash = []byte{} - } - iNdEx = postIndex - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcId = append(m.SrcId[:0], dAtA[iNdEx:postIndex]...) - if m.SrcId == nil { - m.SrcId = []byte{} - } - iNdEx = postIndex - case 5: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SrcPubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SrcPubkey = append(m.SrcPubkey[:0], dAtA[iNdEx:postIndex]...) - if m.SrcPubkey == nil { - m.SrcPubkey = []byte{} - } - iNdEx = postIndex - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestId", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DestId = append(m.DestId[:0], dAtA[iNdEx:postIndex]...) - if m.DestId == nil { - m.DestId = []byte{} - } - iNdEx = postIndex - case 7: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field DestPubkey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.DestPubkey = append(m.DestPubkey[:0], dAtA[iNdEx:postIndex]...) - if m.DestPubkey == nil { - m.DestPubkey = []byte{} - } - iNdEx = postIndex - case 8: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Elems", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowSigchain - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthSigchain - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Elems = append(m.Elems, &SigChainElem{}) - if err := m.Elems[len(m.Elems)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipSigchain(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthSigchain - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipSigchain(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, ErrIntOverflowSigchain - } - 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, ErrIntOverflowSigchain - } - 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, ErrIntOverflowSigchain - } - 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, ErrInvalidLengthSigchain - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowSigchain - } - 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 := skipSigchain(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 ( - ErrInvalidLengthSigchain = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowSigchain = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("pb/sigchain.proto", fileDescriptor_sigchain_d3760cf481b3653e) } -var fileDescriptor_sigchain_d3760cf481b3653e = []byte{ - // 459 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x92, 0xbb, 0x8e, 0xd3, 0x40, - 0x18, 0x85, 0x3d, 0xc9, 0xda, 0x71, 0xfe, 0x24, 0xab, 0x30, 0xe2, 0x62, 0x71, 0x19, 0xa2, 0x14, - 0xab, 0x08, 0x89, 0x44, 0x5a, 0x5a, 0x9a, 0x80, 0x56, 0x24, 0x0d, 0x42, 0x36, 0xd4, 0x96, 0x2f, - 0x93, 0xf1, 0x68, 0x1d, 0x8f, 0xe5, 0x71, 0x10, 0x6c, 0xc5, 0x23, 0xf0, 0x18, 0x3c, 0x02, 0x2f, - 0x80, 0x44, 0x99, 0x72, 0x4b, 0xe2, 0x34, 0x94, 0x5b, 0x50, 0x50, 0xa2, 0x19, 0x0f, 0xd0, 0xfd, - 0xe7, 0x1c, 0x1f, 0x4b, 0xdf, 0xb1, 0xe1, 0x56, 0x19, 0x2f, 0x24, 0x67, 0x49, 0x16, 0xf1, 0x62, - 0x5e, 0x56, 0xa2, 0x16, 0xb8, 0x53, 0xc6, 0xf7, 0x9f, 0x32, 0x5e, 0x67, 0xbb, 0x78, 0x9e, 0x88, - 0xed, 0x82, 0x09, 0x26, 0x16, 0x3a, 0x8a, 0x77, 0x1b, 0xad, 0xb4, 0xd0, 0x57, 0x5b, 0x99, 0x7e, - 0x43, 0x30, 0x0c, 0x38, 0x7b, 0xa9, 0xde, 0x72, 0x91, 0xd3, 0x2d, 0x3e, 0x85, 0x0e, 0x4f, 0x3d, - 0x34, 0x41, 0xb3, 0xa1, 0xdf, 0xe1, 0x29, 0x7e, 0x0c, 0x83, 0x82, 0x7e, 0xa8, 0xc3, 0x72, 0x17, - 0x5f, 0xd2, 0x8f, 0x5e, 0x47, 0x07, 0xa0, 0xac, 0x37, 0xda, 0xc1, 0x77, 0xc1, 0xd9, 0xf2, 0x82, - 0x17, 0xcc, 0xeb, 0x4e, 0xd0, 0xcc, 0xf5, 0x8d, 0xc2, 0x0f, 0xa1, 0x2f, 0x39, 0x2b, 0xa2, 0x7a, - 0x57, 0x51, 0xef, 0x44, 0xd7, 0xfe, 0x1b, 0xf8, 0x0c, 0x5c, 0xc9, 0x59, 0x18, 0xe5, 0x4c, 0x78, - 0xf6, 0x04, 0xcd, 0x4e, 0xcf, 0x07, 0xf3, 0x32, 0x9e, 0x07, 0x9c, 0x2d, 0x73, 0x26, 0xfc, 0x9e, - 0x6c, 0x0f, 0x3c, 0x86, 0xee, 0xfb, 0x6a, 0xe3, 0x39, 0xba, 0xaf, 0x4e, 0x7c, 0x1b, 0xec, 0xb2, - 0x12, 0x62, 0xe3, 0xf5, 0xb4, 0xd7, 0x8a, 0xe9, 0x2f, 0x04, 0xee, 0x5f, 0x0e, 0xf5, 0x48, 0x21, - 0x8a, 0x84, 0x6a, 0x8c, 0x91, 0xdf, 0x0a, 0xfc, 0x00, 0xfa, 0x69, 0x54, 0x47, 0xa1, 0xe4, 0x57, - 0x54, 0x73, 0x8c, 0x7c, 0x57, 0x19, 0x01, 0xbf, 0xa2, 0xf8, 0x11, 0x40, 0x9c, 0x8b, 0xe4, 0x32, - 0xcc, 0x22, 0x99, 0x69, 0x92, 0xa1, 0xdf, 0xd7, 0xce, 0x2a, 0x92, 0x19, 0xbe, 0x03, 0x8e, 0xac, - 0x92, 0x90, 0xa7, 0x86, 0xc4, 0x96, 0x55, 0xb2, 0x4e, 0x55, 0x4b, 0xd9, 0x66, 0x1b, 0xdb, 0x40, - 0x56, 0x89, 0x99, 0xe6, 0x1e, 0xf4, 0x52, 0x2a, 0x6b, 0x55, 0x6b, 0x01, 0x1c, 0x25, 0xd7, 0x7a, - 0x54, 0x1d, 0x98, 0x62, 0x4b, 0x02, 0xca, 0x32, 0xcd, 0x33, 0xb0, 0x69, 0x4e, 0xb7, 0xd2, 0x73, - 0x27, 0xdd, 0xd9, 0xe0, 0x7c, 0x6c, 0xb6, 0xf9, 0xf7, 0x99, 0xfc, 0x36, 0x7e, 0x32, 0x85, 0x9e, - 0x99, 0x0c, 0x8f, 0xa0, 0x1f, 0xac, 0x5f, 0xbd, 0x5e, 0xbe, 0x7d, 0xe7, 0x5f, 0x8c, 0x2d, 0xec, - 0xc2, 0xc9, 0x6a, 0x19, 0xac, 0xc6, 0xe8, 0xc5, 0xf3, 0xfd, 0x81, 0x58, 0xd7, 0x07, 0x62, 0xdd, - 0x1c, 0x08, 0xfa, 0x7d, 0x20, 0xe8, 0x53, 0x43, 0xd0, 0x97, 0x86, 0xa0, 0xaf, 0x0d, 0x41, 0xdf, - 0x1b, 0x82, 0xf6, 0x0d, 0x41, 0x3f, 0x1a, 0x82, 0x7e, 0x36, 0xc4, 0xba, 0x69, 0x08, 0xfa, 0x7c, - 0x24, 0xd6, 0xfe, 0x48, 0xac, 0xeb, 0x23, 0xb1, 0x62, 0x47, 0xff, 0x27, 0xcf, 0xfe, 0x04, 0x00, - 0x00, 0xff, 0xff, 0x16, 0xf1, 0x1d, 0x3e, 0x6f, 0x02, 0x00, 0x00, +func init() { proto.RegisterFile("pb/sigchain.proto", fileDescriptor_sigchain_b37b4a10da0094fd) } + +var fileDescriptor_sigchain_b37b4a10da0094fd = []byte{ + // 362 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0x44, 0x91, 0xcb, 0x6a, 0xe3, 0x30, + 0x14, 0x86, 0xc7, 0x4e, 0x7c, 0x3b, 0xb9, 0xe0, 0x11, 0x73, 0x11, 0xcc, 0x0c, 0x63, 0xb2, 0x08, + 0x66, 0x16, 0x19, 0x48, 0x9f, 0x20, 0x94, 0xd0, 0x64, 0x53, 0x8a, 0xdc, 0xae, 0x8d, 0x2f, 0x8a, + 0x2c, 0xe2, 0x58, 0xc6, 0x72, 0x4a, 0x9b, 0xf7, 0xeb, 0x1b, 0xf5, 0x01, 0x8a, 0x64, 0xb5, 0xdd, + 0xe9, 0x7c, 0x47, 0xff, 0xe2, 0xfb, 0x0f, 0x7c, 0x6d, 0xf3, 0xff, 0x92, 0xb3, 0xa2, 0xca, 0x78, + 0xb3, 0x6a, 0x3b, 0xd1, 0x0b, 0x64, 0xb7, 0xf9, 0xe2, 0xc5, 0x82, 0x69, 0xc2, 0xd9, 0xb5, 0xc2, + 0xdb, 0x9a, 0x9e, 0xd0, 0x1c, 0x6c, 0x5e, 0x62, 0x2b, 0xb2, 0xe2, 0x29, 0xb1, 0x79, 0x89, 0xfe, + 0xc2, 0xa4, 0xa1, 0x4f, 0x7d, 0xda, 0x9e, 0xf3, 0x23, 0x7d, 0xc6, 0xb6, 0x5e, 0x80, 0x42, 0x77, + 0x9a, 0xa0, 0x1f, 0xe0, 0x9e, 0x78, 0xc3, 0x1b, 0x86, 0x47, 0x91, 0x15, 0xfb, 0xc4, 0x4c, 0xe8, + 0x37, 0x04, 0x92, 0xb3, 0x26, 0xeb, 0xcf, 0x1d, 0xc5, 0x63, 0x1d, 0xfb, 0x04, 0x68, 0x09, 0xbe, + 0xe4, 0x2c, 0xcd, 0x6a, 0x26, 0xb0, 0x13, 0x59, 0xf1, 0x7c, 0x3d, 0x59, 0xb5, 0xf9, 0x2a, 0xe1, + 0x6c, 0x53, 0x33, 0x41, 0x3c, 0x39, 0x3c, 0x50, 0x08, 0xa3, 0xc7, 0xee, 0x80, 0x5d, 0x9d, 0x57, + 0x4f, 0xf4, 0x0d, 0x9c, 0xb6, 0x13, 0xe2, 0x80, 0x3d, 0xcd, 0x86, 0x61, 0xf1, 0x6a, 0x81, 0xff, + 0xee, 0xa1, 0xbe, 0x34, 0xa2, 0x29, 0xa8, 0xd6, 0x98, 0x91, 0x61, 0x40, 0xbf, 0x20, 0x28, 0xb3, + 0x3e, 0x4b, 0x25, 0xbf, 0x50, 0xed, 0x31, 0x23, 0xbe, 0x02, 0x09, 0xbf, 0x50, 0xf4, 0x07, 0x20, + 0xaf, 0x45, 0x71, 0x4c, 0xab, 0x4c, 0x56, 0xda, 0x64, 0x4a, 0x02, 0x4d, 0x76, 0x99, 0xac, 0xd0, + 0x77, 0x70, 0x65, 0x57, 0xa4, 0xbc, 0x34, 0x26, 0x8e, 0xec, 0x8a, 0x7d, 0xa9, 0x52, 0x0a, 0x9b, + 0x6e, 0x1c, 0x23, 0xd9, 0x15, 0xa6, 0x9a, 0x9f, 0xe0, 0x95, 0x54, 0xf6, 0x2a, 0x36, 0x08, 0xb8, + 0x6a, 0xdc, 0xeb, 0x52, 0xf5, 0xc2, 0x04, 0x07, 0x13, 0x50, 0xc8, 0x24, 0x97, 0xe0, 0xd0, 0x9a, + 0x9e, 0x24, 0xf6, 0xa3, 0x51, 0x3c, 0x59, 0x87, 0xa6, 0x9b, 0x8f, 0x33, 0x91, 0x61, 0xfd, 0x6f, + 0x01, 0x9e, 0xa9, 0x0c, 0xcd, 0x20, 0x48, 0xf6, 0x37, 0xb7, 0x9b, 0xfb, 0x07, 0xb2, 0x0d, 0xbf, + 0x20, 0x1f, 0xc6, 0xbb, 0x4d, 0xb2, 0x0b, 0xad, 0xdc, 0xd5, 0xd7, 0xbe, 0x7a, 0x0b, 0x00, 0x00, + 0xff, 0xff, 0x58, 0xa2, 0xb9, 0xbb, 0x02, 0x02, 0x00, 0x00, } diff --git a/pb/sigchain.proto b/pb/sigchain.proto index 0da7cde5e..10f88f521 100644 --- a/pb/sigchain.proto +++ b/pb/sigchain.proto @@ -2,19 +2,6 @@ syntax = "proto3"; package pb; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.gostring_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - // For tests -option (gogoproto.testgen_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.populate_all) = true; - enum SigAlgo { SIGNATURE = 0; HASH = 1; diff --git a/pb/sigchainpb_test.go b/pb/sigchainpb_test.go deleted file mode 100644 index 8859cff7a..000000000 --- a/pb/sigchainpb_test.go +++ /dev/null @@ -1,315 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb/sigchain.proto - -package pb - -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import fmt "fmt" -import go_parser "go/parser" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestSigChainElemProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainElem(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChainElem{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestSigChainElemMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainElem(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChainElem{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChain(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestSigChainMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChain(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChain{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainElemJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainElem(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChainElem{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestSigChainJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChain(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChain{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestSigChainElemProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainElem(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &SigChainElem{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainElemProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainElem(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &SigChainElem{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChain(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &SigChain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChain(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &SigChain{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainElemGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSigChainElem(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestSigChainGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSigChain(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestSigChainElemSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainElem(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestSigChainSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChain(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestSigChainElemStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSigChainElem(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestSigChainStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSigChain(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/pb/transaction.go b/pb/transaction.go index 53dad34dc..d59441925 100644 --- a/pb/transaction.go +++ b/pb/transaction.go @@ -5,6 +5,7 @@ import ( "fmt" "io" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/common/serialization" ) @@ -135,7 +136,7 @@ func (m *NanoPay) ToMap() map[string]interface{} { func (m *SigChainTxn) ToMap() map[string]interface{} { sc := &SigChain{} - if err := sc.Unmarshal(m.SigChain); err != nil { + if err := proto.Unmarshal(m.SigChain, sc); err != nil { return map[string]interface{}{} } return map[string]interface{}{ diff --git a/pb/transaction.pb.go b/pb/transaction.pb.go index 32733a56d..40a5d7fd8 100644 --- a/pb/transaction.pb.go +++ b/pb/transaction.pb.go @@ -1,21 +1,11 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. +// Code generated by protoc-gen-go. DO NOT EDIT. // source: pb/transaction.proto package pb -import proto "github.com/gogo/protobuf/proto" +import proto "github.com/golang/protobuf/proto" import fmt "fmt" import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -import strconv "strconv" - -import bytes "bytes" - -import strings "strings" -import reflect "reflect" - -import io "io" // Reference imports to suppress errors if they are not otherwise used. var _ = proto.Marshal @@ -26,22 +16,22 @@ var _ = math.Inf // 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 +const _ = proto.ProtoPackageIsVersion2 // please upgrade the proto package type PayloadType int32 const ( - COINBASE_TYPE PayloadType = 0 - TRANSFER_ASSET_TYPE PayloadType = 1 - SIG_CHAIN_TXN_TYPE PayloadType = 2 - REGISTER_NAME_TYPE PayloadType = 3 - TRANSFER_NAME_TYPE PayloadType = 4 - DELETE_NAME_TYPE PayloadType = 5 - SUBSCRIBE_TYPE PayloadType = 6 - UNSUBSCRIBE_TYPE PayloadType = 7 - GENERATE_ID_TYPE PayloadType = 8 - NANO_PAY_TYPE PayloadType = 9 - ISSUE_ASSET_TYPE PayloadType = 10 + PayloadType_COINBASE_TYPE PayloadType = 0 + PayloadType_TRANSFER_ASSET_TYPE PayloadType = 1 + PayloadType_SIG_CHAIN_TXN_TYPE PayloadType = 2 + PayloadType_REGISTER_NAME_TYPE PayloadType = 3 + PayloadType_TRANSFER_NAME_TYPE PayloadType = 4 + PayloadType_DELETE_NAME_TYPE PayloadType = 5 + PayloadType_SUBSCRIBE_TYPE PayloadType = 6 + PayloadType_UNSUBSCRIBE_TYPE PayloadType = 7 + PayloadType_GENERATE_ID_TYPE PayloadType = 8 + PayloadType_NANO_PAY_TYPE PayloadType = 9 + PayloadType_ISSUE_ASSET_TYPE PayloadType = 10 ) var PayloadType_name = map[int32]string{ @@ -71,42 +61,40 @@ var PayloadType_value = map[string]int32{ "ISSUE_ASSET_TYPE": 10, } +func (x PayloadType) String() string { + return proto.EnumName(PayloadType_name, int32(x)) +} func (PayloadType) EnumDescriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{0} + return fileDescriptor_transaction_dee487b0d08e39df, []int{0} } type UnsignedTx struct { - Payload *Payload `protobuf:"bytes,1,opt,name=payload" json:"payload,omitempty"` - Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` - Fee int64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"` - Attributes []byte `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` -} - -func (m *UnsignedTx) Reset() { *m = UnsignedTx{} } -func (*UnsignedTx) ProtoMessage() {} + Payload *Payload `protobuf:"bytes,1,opt,name=payload,proto3" json:"payload,omitempty"` + Nonce uint64 `protobuf:"varint,2,opt,name=nonce,proto3" json:"nonce,omitempty"` + Fee int64 `protobuf:"varint,3,opt,name=fee,proto3" json:"fee,omitempty"` + Attributes []byte `protobuf:"bytes,4,opt,name=attributes,proto3" json:"attributes,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *UnsignedTx) Reset() { *m = UnsignedTx{} } +func (m *UnsignedTx) String() string { return proto.CompactTextString(m) } +func (*UnsignedTx) ProtoMessage() {} func (*UnsignedTx) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{0} + return fileDescriptor_transaction_dee487b0d08e39df, []int{0} } func (m *UnsignedTx) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_UnsignedTx.Unmarshal(m, b) } func (m *UnsignedTx) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_UnsignedTx.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_UnsignedTx.Marshal(b, m, deterministic) } func (dst *UnsignedTx) XXX_Merge(src proto.Message) { xxx_messageInfo_UnsignedTx.Merge(dst, src) } func (m *UnsignedTx) XXX_Size() int { - return m.Size() + return xxx_messageInfo_UnsignedTx.Size(m) } func (m *UnsignedTx) XXX_DiscardUnknown() { xxx_messageInfo_UnsignedTx.DiscardUnknown(m) @@ -143,35 +131,30 @@ func (m *UnsignedTx) GetAttributes() []byte { } type Transaction struct { - UnsignedTx *UnsignedTx `protobuf:"bytes,1,opt,name=unsigned_tx,json=unsignedTx" json:"unsigned_tx,omitempty"` - Programs []*Program `protobuf:"bytes,2,rep,name=programs" json:"programs,omitempty"` + UnsignedTx *UnsignedTx `protobuf:"bytes,1,opt,name=unsigned_tx,json=unsignedTx,proto3" json:"unsigned_tx,omitempty"` + Programs []*Program `protobuf:"bytes,2,rep,name=programs,proto3" json:"programs,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Transaction) Reset() { *m = Transaction{} } -func (*Transaction) ProtoMessage() {} +func (m *Transaction) Reset() { *m = Transaction{} } +func (m *Transaction) String() string { return proto.CompactTextString(m) } +func (*Transaction) ProtoMessage() {} func (*Transaction) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{1} + return fileDescriptor_transaction_dee487b0d08e39df, []int{1} } func (m *Transaction) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Transaction.Unmarshal(m, b) } func (m *Transaction) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Transaction.Marshal(b, m, deterministic) } func (dst *Transaction) XXX_Merge(src proto.Message) { xxx_messageInfo_Transaction.Merge(dst, src) } func (m *Transaction) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Transaction.Size(m) } func (m *Transaction) XXX_DiscardUnknown() { xxx_messageInfo_Transaction.DiscardUnknown(m) @@ -194,35 +177,30 @@ func (m *Transaction) GetPrograms() []*Program { } type Program struct { - Code []byte `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` - Parameter []byte `protobuf:"bytes,2,opt,name=parameter,proto3" json:"parameter,omitempty"` + Code []byte `protobuf:"bytes,1,opt,name=code,proto3" json:"code,omitempty"` + Parameter []byte `protobuf:"bytes,2,opt,name=parameter,proto3" json:"parameter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Program) Reset() { *m = Program{} } -func (*Program) ProtoMessage() {} +func (m *Program) Reset() { *m = Program{} } +func (m *Program) String() string { return proto.CompactTextString(m) } +func (*Program) ProtoMessage() {} func (*Program) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{2} + return fileDescriptor_transaction_dee487b0d08e39df, []int{2} } func (m *Program) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Program.Unmarshal(m, b) } func (m *Program) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Program.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Program.Marshal(b, m, deterministic) } func (dst *Program) XXX_Merge(src proto.Message) { xxx_messageInfo_Program.Merge(dst, src) } func (m *Program) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Program.Size(m) } func (m *Program) XXX_DiscardUnknown() { xxx_messageInfo_Program.DiscardUnknown(m) @@ -245,35 +223,30 @@ func (m *Program) GetParameter() []byte { } type Payload struct { - Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PayloadType" json:"type,omitempty"` - Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + Type PayloadType `protobuf:"varint,1,opt,name=type,proto3,enum=pb.PayloadType" json:"type,omitempty"` + Data []byte `protobuf:"bytes,2,opt,name=data,proto3" json:"data,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Payload) Reset() { *m = Payload{} } -func (*Payload) ProtoMessage() {} +func (m *Payload) Reset() { *m = Payload{} } +func (m *Payload) String() string { return proto.CompactTextString(m) } +func (*Payload) ProtoMessage() {} func (*Payload) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{3} + return fileDescriptor_transaction_dee487b0d08e39df, []int{3} } func (m *Payload) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Payload.Unmarshal(m, b) } func (m *Payload) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Payload.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Payload.Marshal(b, m, deterministic) } func (dst *Payload) XXX_Merge(src proto.Message) { xxx_messageInfo_Payload.Merge(dst, src) } func (m *Payload) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Payload.Size(m) } func (m *Payload) XXX_DiscardUnknown() { xxx_messageInfo_Payload.DiscardUnknown(m) @@ -285,7 +258,7 @@ func (m *Payload) GetType() PayloadType { if m != nil { return m.Type } - return COINBASE_TYPE + return PayloadType_COINBASE_TYPE } func (m *Payload) GetData() []byte { @@ -296,36 +269,31 @@ func (m *Payload) GetData() []byte { } type Coinbase struct { - Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` + Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Coinbase) Reset() { *m = Coinbase{} } -func (*Coinbase) ProtoMessage() {} +func (m *Coinbase) Reset() { *m = Coinbase{} } +func (m *Coinbase) String() string { return proto.CompactTextString(m) } +func (*Coinbase) ProtoMessage() {} func (*Coinbase) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{4} + return fileDescriptor_transaction_dee487b0d08e39df, []int{4} } func (m *Coinbase) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Coinbase.Unmarshal(m, b) } func (m *Coinbase) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Coinbase.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Coinbase.Marshal(b, m, deterministic) } func (dst *Coinbase) XXX_Merge(src proto.Message) { xxx_messageInfo_Coinbase.Merge(dst, src) } func (m *Coinbase) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Coinbase.Size(m) } func (m *Coinbase) XXX_DiscardUnknown() { xxx_messageInfo_Coinbase.DiscardUnknown(m) @@ -355,35 +323,30 @@ func (m *Coinbase) GetAmount() int64 { } type SigChainTxn struct { - SigChain []byte `protobuf:"bytes,1,opt,name=sig_chain,json=sigChain,proto3" json:"sig_chain,omitempty"` - Submitter []byte `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` + SigChain []byte `protobuf:"bytes,1,opt,name=sig_chain,json=sigChain,proto3" json:"sig_chain,omitempty"` + Submitter []byte `protobuf:"bytes,2,opt,name=submitter,proto3" json:"submitter,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *SigChainTxn) Reset() { *m = SigChainTxn{} } -func (*SigChainTxn) ProtoMessage() {} +func (m *SigChainTxn) Reset() { *m = SigChainTxn{} } +func (m *SigChainTxn) String() string { return proto.CompactTextString(m) } +func (*SigChainTxn) ProtoMessage() {} func (*SigChainTxn) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{5} + return fileDescriptor_transaction_dee487b0d08e39df, []int{5} } func (m *SigChainTxn) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_SigChainTxn.Unmarshal(m, b) } func (m *SigChainTxn) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_SigChainTxn.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_SigChainTxn.Marshal(b, m, deterministic) } func (dst *SigChainTxn) XXX_Merge(src proto.Message) { xxx_messageInfo_SigChainTxn.Merge(dst, src) } func (m *SigChainTxn) XXX_Size() int { - return m.Size() + return xxx_messageInfo_SigChainTxn.Size(m) } func (m *SigChainTxn) XXX_DiscardUnknown() { xxx_messageInfo_SigChainTxn.DiscardUnknown(m) @@ -406,36 +369,31 @@ func (m *SigChainTxn) GetSubmitter() []byte { } type RegisterName struct { - Registrant []byte `protobuf:"bytes,1,opt,name=registrant,proto3" json:"registrant,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - RegistrationFee int64 `protobuf:"varint,3,opt,name=registration_fee,json=registrationFee,proto3" json:"registration_fee,omitempty"` + Registrant []byte `protobuf:"bytes,1,opt,name=registrant,proto3" json:"registrant,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + RegistrationFee int64 `protobuf:"varint,3,opt,name=registration_fee,json=registrationFee,proto3" json:"registration_fee,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *RegisterName) Reset() { *m = RegisterName{} } -func (*RegisterName) ProtoMessage() {} +func (m *RegisterName) Reset() { *m = RegisterName{} } +func (m *RegisterName) String() string { return proto.CompactTextString(m) } +func (*RegisterName) ProtoMessage() {} func (*RegisterName) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{6} + return fileDescriptor_transaction_dee487b0d08e39df, []int{6} } func (m *RegisterName) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_RegisterName.Unmarshal(m, b) } func (m *RegisterName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_RegisterName.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_RegisterName.Marshal(b, m, deterministic) } func (dst *RegisterName) XXX_Merge(src proto.Message) { xxx_messageInfo_RegisterName.Merge(dst, src) } func (m *RegisterName) XXX_Size() int { - return m.Size() + return xxx_messageInfo_RegisterName.Size(m) } func (m *RegisterName) XXX_DiscardUnknown() { xxx_messageInfo_RegisterName.DiscardUnknown(m) @@ -465,36 +423,31 @@ func (m *RegisterName) GetRegistrationFee() int64 { } type TransferName struct { - Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` - Registrant []byte `protobuf:"bytes,2,opt,name=registrant,proto3" json:"registrant,omitempty"` - Recipient []byte `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + Registrant []byte `protobuf:"bytes,2,opt,name=registrant,proto3" json:"registrant,omitempty"` + Recipient []byte `protobuf:"bytes,3,opt,name=recipient,proto3" json:"recipient,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *TransferName) Reset() { *m = TransferName{} } -func (*TransferName) ProtoMessage() {} +func (m *TransferName) Reset() { *m = TransferName{} } +func (m *TransferName) String() string { return proto.CompactTextString(m) } +func (*TransferName) ProtoMessage() {} func (*TransferName) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{7} + return fileDescriptor_transaction_dee487b0d08e39df, []int{7} } func (m *TransferName) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_TransferName.Unmarshal(m, b) } func (m *TransferName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TransferName.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_TransferName.Marshal(b, m, deterministic) } func (dst *TransferName) XXX_Merge(src proto.Message) { xxx_messageInfo_TransferName.Merge(dst, src) } func (m *TransferName) XXX_Size() int { - return m.Size() + return xxx_messageInfo_TransferName.Size(m) } func (m *TransferName) XXX_DiscardUnknown() { xxx_messageInfo_TransferName.DiscardUnknown(m) @@ -524,35 +477,30 @@ func (m *TransferName) GetRecipient() []byte { } type DeleteName struct { - Registrant []byte `protobuf:"bytes,1,opt,name=registrant,proto3" json:"registrant,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Registrant []byte `protobuf:"bytes,1,opt,name=registrant,proto3" json:"registrant,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *DeleteName) Reset() { *m = DeleteName{} } -func (*DeleteName) ProtoMessage() {} +func (m *DeleteName) Reset() { *m = DeleteName{} } +func (m *DeleteName) String() string { return proto.CompactTextString(m) } +func (*DeleteName) ProtoMessage() {} func (*DeleteName) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{8} + return fileDescriptor_transaction_dee487b0d08e39df, []int{8} } func (m *DeleteName) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_DeleteName.Unmarshal(m, b) } func (m *DeleteName) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_DeleteName.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_DeleteName.Marshal(b, m, deterministic) } func (dst *DeleteName) XXX_Merge(src proto.Message) { xxx_messageInfo_DeleteName.Merge(dst, src) } func (m *DeleteName) XXX_Size() int { - return m.Size() + return xxx_messageInfo_DeleteName.Size(m) } func (m *DeleteName) XXX_DiscardUnknown() { xxx_messageInfo_DeleteName.DiscardUnknown(m) @@ -575,39 +523,34 @@ func (m *DeleteName) GetName() string { } type Subscribe struct { - Subscriber []byte `protobuf:"bytes,1,opt,name=subscriber,proto3" json:"subscriber,omitempty"` - Identifier string `protobuf:"bytes,2,opt,name=identifier,proto3" json:"identifier,omitempty"` - Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` - Bucket uint32 `protobuf:"varint,4,opt,name=bucket,proto3" json:"bucket,omitempty"` // Deprecated: Do not use. - Duration uint32 `protobuf:"varint,5,opt,name=duration,proto3" json:"duration,omitempty"` - Meta string `protobuf:"bytes,6,opt,name=meta,proto3" json:"meta,omitempty"` -} - -func (m *Subscribe) Reset() { *m = Subscribe{} } -func (*Subscribe) ProtoMessage() {} + Subscriber []byte `protobuf:"bytes,1,opt,name=subscriber,proto3" json:"subscriber,omitempty"` + Identifier string `protobuf:"bytes,2,opt,name=identifier,proto3" json:"identifier,omitempty"` + Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` + Bucket uint32 `protobuf:"varint,4,opt,name=bucket,proto3" json:"bucket,omitempty"` // Deprecated: Do not use. + Duration uint32 `protobuf:"varint,5,opt,name=duration,proto3" json:"duration,omitempty"` + Meta string `protobuf:"bytes,6,opt,name=meta,proto3" json:"meta,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *Subscribe) Reset() { *m = Subscribe{} } +func (m *Subscribe) String() string { return proto.CompactTextString(m) } +func (*Subscribe) ProtoMessage() {} func (*Subscribe) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{9} + return fileDescriptor_transaction_dee487b0d08e39df, []int{9} } func (m *Subscribe) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Subscribe.Unmarshal(m, b) } func (m *Subscribe) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Subscribe.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Subscribe.Marshal(b, m, deterministic) } func (dst *Subscribe) XXX_Merge(src proto.Message) { xxx_messageInfo_Subscribe.Merge(dst, src) } func (m *Subscribe) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Subscribe.Size(m) } func (m *Subscribe) XXX_DiscardUnknown() { xxx_messageInfo_Subscribe.DiscardUnknown(m) @@ -659,36 +602,31 @@ func (m *Subscribe) GetMeta() string { } type Unsubscribe struct { - Subscriber []byte `protobuf:"bytes,1,opt,name=subscriber,proto3" json:"subscriber,omitempty"` - Identifier string `protobuf:"bytes,2,opt,name=identifier,proto3" json:"identifier,omitempty"` - Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` + Subscriber []byte `protobuf:"bytes,1,opt,name=subscriber,proto3" json:"subscriber,omitempty"` + Identifier string `protobuf:"bytes,2,opt,name=identifier,proto3" json:"identifier,omitempty"` + Topic string `protobuf:"bytes,3,opt,name=topic,proto3" json:"topic,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *Unsubscribe) Reset() { *m = Unsubscribe{} } -func (*Unsubscribe) ProtoMessage() {} +func (m *Unsubscribe) Reset() { *m = Unsubscribe{} } +func (m *Unsubscribe) String() string { return proto.CompactTextString(m) } +func (*Unsubscribe) ProtoMessage() {} func (*Unsubscribe) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{10} + return fileDescriptor_transaction_dee487b0d08e39df, []int{10} } func (m *Unsubscribe) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_Unsubscribe.Unmarshal(m, b) } func (m *Unsubscribe) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_Unsubscribe.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_Unsubscribe.Marshal(b, m, deterministic) } func (dst *Unsubscribe) XXX_Merge(src proto.Message) { xxx_messageInfo_Unsubscribe.Merge(dst, src) } func (m *Unsubscribe) XXX_Size() int { - return m.Size() + return xxx_messageInfo_Unsubscribe.Size(m) } func (m *Unsubscribe) XXX_DiscardUnknown() { xxx_messageInfo_Unsubscribe.DiscardUnknown(m) @@ -718,36 +656,31 @@ func (m *Unsubscribe) GetTopic() string { } type TransferAsset struct { - Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` + Amount int64 `protobuf:"varint,3,opt,name=amount,proto3" json:"amount,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *TransferAsset) Reset() { *m = TransferAsset{} } -func (*TransferAsset) ProtoMessage() {} +func (m *TransferAsset) Reset() { *m = TransferAsset{} } +func (m *TransferAsset) String() string { return proto.CompactTextString(m) } +func (*TransferAsset) ProtoMessage() {} func (*TransferAsset) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{11} + return fileDescriptor_transaction_dee487b0d08e39df, []int{11} } func (m *TransferAsset) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_TransferAsset.Unmarshal(m, b) } func (m *TransferAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_TransferAsset.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_TransferAsset.Marshal(b, m, deterministic) } func (dst *TransferAsset) XXX_Merge(src proto.Message) { xxx_messageInfo_TransferAsset.Merge(dst, src) } func (m *TransferAsset) XXX_Size() int { - return m.Size() + return xxx_messageInfo_TransferAsset.Size(m) } func (m *TransferAsset) XXX_DiscardUnknown() { xxx_messageInfo_TransferAsset.DiscardUnknown(m) @@ -777,35 +710,30 @@ func (m *TransferAsset) GetAmount() int64 { } type GenerateID struct { - PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` - RegistrationFee int64 `protobuf:"varint,2,opt,name=registration_fee,json=registrationFee,proto3" json:"registration_fee,omitempty"` + PublicKey []byte `protobuf:"bytes,1,opt,name=public_key,json=publicKey,proto3" json:"public_key,omitempty"` + RegistrationFee int64 `protobuf:"varint,2,opt,name=registration_fee,json=registrationFee,proto3" json:"registration_fee,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` } -func (m *GenerateID) Reset() { *m = GenerateID{} } -func (*GenerateID) ProtoMessage() {} +func (m *GenerateID) Reset() { *m = GenerateID{} } +func (m *GenerateID) String() string { return proto.CompactTextString(m) } +func (*GenerateID) ProtoMessage() {} func (*GenerateID) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{12} + return fileDescriptor_transaction_dee487b0d08e39df, []int{12} } func (m *GenerateID) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_GenerateID.Unmarshal(m, b) } func (m *GenerateID) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_GenerateID.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_GenerateID.Marshal(b, m, deterministic) } func (dst *GenerateID) XXX_Merge(src proto.Message) { xxx_messageInfo_GenerateID.Merge(dst, src) } func (m *GenerateID) XXX_Size() int { - return m.Size() + return xxx_messageInfo_GenerateID.Size(m) } func (m *GenerateID) XXX_DiscardUnknown() { xxx_messageInfo_GenerateID.DiscardUnknown(m) @@ -828,39 +756,34 @@ func (m *GenerateID) GetRegistrationFee() int64 { } type NanoPay struct { - Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` - Id uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` - Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` - TxnExpiration uint32 `protobuf:"varint,5,opt,name=txn_expiration,json=txnExpiration,proto3" json:"txn_expiration,omitempty"` - NanoPayExpiration uint32 `protobuf:"varint,6,opt,name=nano_pay_expiration,json=nanoPayExpiration,proto3" json:"nano_pay_expiration,omitempty"` -} - -func (m *NanoPay) Reset() { *m = NanoPay{} } -func (*NanoPay) ProtoMessage() {} + Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Recipient []byte `protobuf:"bytes,2,opt,name=recipient,proto3" json:"recipient,omitempty"` + Id uint64 `protobuf:"varint,3,opt,name=id,proto3" json:"id,omitempty"` + Amount int64 `protobuf:"varint,4,opt,name=amount,proto3" json:"amount,omitempty"` + TxnExpiration uint32 `protobuf:"varint,5,opt,name=txn_expiration,json=txnExpiration,proto3" json:"txn_expiration,omitempty"` + NanoPayExpiration uint32 `protobuf:"varint,6,opt,name=nano_pay_expiration,json=nanoPayExpiration,proto3" json:"nano_pay_expiration,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *NanoPay) Reset() { *m = NanoPay{} } +func (m *NanoPay) String() string { return proto.CompactTextString(m) } +func (*NanoPay) ProtoMessage() {} func (*NanoPay) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{13} + return fileDescriptor_transaction_dee487b0d08e39df, []int{13} } func (m *NanoPay) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_NanoPay.Unmarshal(m, b) } func (m *NanoPay) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_NanoPay.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_NanoPay.Marshal(b, m, deterministic) } func (dst *NanoPay) XXX_Merge(src proto.Message) { xxx_messageInfo_NanoPay.Merge(dst, src) } func (m *NanoPay) XXX_Size() int { - return m.Size() + return xxx_messageInfo_NanoPay.Size(m) } func (m *NanoPay) XXX_DiscardUnknown() { xxx_messageInfo_NanoPay.DiscardUnknown(m) @@ -911,38 +834,33 @@ func (m *NanoPay) GetNanoPayExpiration() uint32 { } type IssueAsset struct { - Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` - Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` - Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` - TotalSupply int64 `protobuf:"varint,4,opt,name=total_supply,json=totalSupply,proto3" json:"total_supply,omitempty"` - Precision uint32 `protobuf:"varint,5,opt,name=precision,proto3" json:"precision,omitempty"` -} - -func (m *IssueAsset) Reset() { *m = IssueAsset{} } -func (*IssueAsset) ProtoMessage() {} + Sender []byte `protobuf:"bytes,1,opt,name=sender,proto3" json:"sender,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + Symbol string `protobuf:"bytes,3,opt,name=symbol,proto3" json:"symbol,omitempty"` + TotalSupply int64 `protobuf:"varint,4,opt,name=total_supply,json=totalSupply,proto3" json:"total_supply,omitempty"` + Precision uint32 `protobuf:"varint,5,opt,name=precision,proto3" json:"precision,omitempty"` + XXX_NoUnkeyedLiteral struct{} `json:"-"` + XXX_unrecognized []byte `json:"-"` + XXX_sizecache int32 `json:"-"` +} + +func (m *IssueAsset) Reset() { *m = IssueAsset{} } +func (m *IssueAsset) String() string { return proto.CompactTextString(m) } +func (*IssueAsset) ProtoMessage() {} func (*IssueAsset) Descriptor() ([]byte, []int) { - return fileDescriptor_transaction_4e588bd5864b6478, []int{14} + return fileDescriptor_transaction_dee487b0d08e39df, []int{14} } func (m *IssueAsset) XXX_Unmarshal(b []byte) error { - return m.Unmarshal(b) + return xxx_messageInfo_IssueAsset.Unmarshal(m, b) } func (m *IssueAsset) XXX_Marshal(b []byte, deterministic bool) ([]byte, error) { - if deterministic { - return xxx_messageInfo_IssueAsset.Marshal(b, m, deterministic) - } else { - b = b[:cap(b)] - n, err := m.MarshalTo(b) - if err != nil { - return nil, err - } - return b[:n], nil - } + return xxx_messageInfo_IssueAsset.Marshal(b, m, deterministic) } func (dst *IssueAsset) XXX_Merge(src proto.Message) { xxx_messageInfo_IssueAsset.Merge(dst, src) } func (m *IssueAsset) XXX_Size() int { - return m.Size() + return xxx_messageInfo_IssueAsset.Size(m) } func (m *IssueAsset) XXX_DiscardUnknown() { xxx_messageInfo_IssueAsset.DiscardUnknown(m) @@ -1003,4302 +921,62 @@ func init() { proto.RegisterType((*IssueAsset)(nil), "pb.IssueAsset") proto.RegisterEnum("pb.PayloadType", PayloadType_name, PayloadType_value) } -func (x PayloadType) String() string { - s, ok := PayloadType_name[int32(x)] - if ok { - return s - } - return strconv.Itoa(int(x)) -} -func (this *UnsignedTx) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*UnsignedTx) - if !ok { - that2, ok := that.(UnsignedTx) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.Payload.Equal(that1.Payload) { - return false - } - if this.Nonce != that1.Nonce { - return false - } - if this.Fee != that1.Fee { - return false - } - if !bytes.Equal(this.Attributes, that1.Attributes) { - return false - } - return true -} -func (this *Transaction) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Transaction) - if !ok { - that2, ok := that.(Transaction) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !this.UnsignedTx.Equal(that1.UnsignedTx) { - return false - } - if len(this.Programs) != len(that1.Programs) { - return false - } - for i := range this.Programs { - if !this.Programs[i].Equal(that1.Programs[i]) { - return false - } - } - return true -} -func (this *Program) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Program) - if !ok { - that2, ok := that.(Program) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Code, that1.Code) { - return false - } - if !bytes.Equal(this.Parameter, that1.Parameter) { - return false - } - return true -} -func (this *Payload) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Payload) - if !ok { - that2, ok := that.(Payload) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Type != that1.Type { - return false - } - if !bytes.Equal(this.Data, that1.Data) { - return false - } - return true -} -func (this *Coinbase) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Coinbase) - if !ok { - that2, ok := that.(Coinbase) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Sender, that1.Sender) { - return false - } - if !bytes.Equal(this.Recipient, that1.Recipient) { - return false - } - if this.Amount != that1.Amount { - return false - } - return true -} -func (this *SigChainTxn) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*SigChainTxn) - if !ok { - that2, ok := that.(SigChainTxn) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.SigChain, that1.SigChain) { - return false - } - if !bytes.Equal(this.Submitter, that1.Submitter) { - return false - } - return true -} -func (this *RegisterName) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*RegisterName) - if !ok { - that2, ok := that.(RegisterName) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Registrant, that1.Registrant) { - return false - } - if this.Name != that1.Name { - return false - } - if this.RegistrationFee != that1.RegistrationFee { - return false - } - return true -} -func (this *TransferName) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*TransferName) - if !ok { - that2, ok := that.(TransferName) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if this.Name != that1.Name { - return false - } - if !bytes.Equal(this.Registrant, that1.Registrant) { - return false - } - if !bytes.Equal(this.Recipient, that1.Recipient) { - return false - } - return true -} -func (this *DeleteName) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*DeleteName) - if !ok { - that2, ok := that.(DeleteName) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Registrant, that1.Registrant) { - return false - } - if this.Name != that1.Name { - return false - } - return true -} -func (this *Subscribe) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Subscribe) - if !ok { - that2, ok := that.(Subscribe) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Subscriber, that1.Subscriber) { - return false - } - if this.Identifier != that1.Identifier { - return false - } - if this.Topic != that1.Topic { - return false - } - if this.Bucket != that1.Bucket { - return false - } - if this.Duration != that1.Duration { - return false - } - if this.Meta != that1.Meta { - return false - } - return true -} -func (this *Unsubscribe) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*Unsubscribe) - if !ok { - that2, ok := that.(Unsubscribe) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Subscriber, that1.Subscriber) { - return false - } - if this.Identifier != that1.Identifier { - return false - } - if this.Topic != that1.Topic { - return false - } - return true -} -func (this *TransferAsset) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*TransferAsset) - if !ok { - that2, ok := that.(TransferAsset) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Sender, that1.Sender) { - return false - } - if !bytes.Equal(this.Recipient, that1.Recipient) { - return false - } - if this.Amount != that1.Amount { - return false - } - return true -} -func (this *GenerateID) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*GenerateID) - if !ok { - that2, ok := that.(GenerateID) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.PublicKey, that1.PublicKey) { - return false - } - if this.RegistrationFee != that1.RegistrationFee { - return false - } - return true -} -func (this *NanoPay) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*NanoPay) - if !ok { - that2, ok := that.(NanoPay) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Sender, that1.Sender) { - return false - } - if !bytes.Equal(this.Recipient, that1.Recipient) { - return false - } - if this.Id != that1.Id { - return false - } - if this.Amount != that1.Amount { - return false - } - if this.TxnExpiration != that1.TxnExpiration { - return false - } - if this.NanoPayExpiration != that1.NanoPayExpiration { - return false - } - return true -} -func (this *IssueAsset) Equal(that interface{}) bool { - if that == nil { - return this == nil - } - - that1, ok := that.(*IssueAsset) - if !ok { - that2, ok := that.(IssueAsset) - if ok { - that1 = &that2 - } else { - return false - } - } - if that1 == nil { - return this == nil - } else if this == nil { - return false - } - if !bytes.Equal(this.Sender, that1.Sender) { - return false - } - if this.Name != that1.Name { - return false - } - if this.Symbol != that1.Symbol { - return false - } - if this.TotalSupply != that1.TotalSupply { - return false - } - if this.Precision != that1.Precision { - return false - } - return true -} -func (this *UnsignedTx) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 8) - s = append(s, "&pb.UnsignedTx{") - if this.Payload != nil { - s = append(s, "Payload: "+fmt.Sprintf("%#v", this.Payload)+",\n") - } - s = append(s, "Nonce: "+fmt.Sprintf("%#v", this.Nonce)+",\n") - s = append(s, "Fee: "+fmt.Sprintf("%#v", this.Fee)+",\n") - s = append(s, "Attributes: "+fmt.Sprintf("%#v", this.Attributes)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Transaction) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Transaction{") - if this.UnsignedTx != nil { - s = append(s, "UnsignedTx: "+fmt.Sprintf("%#v", this.UnsignedTx)+",\n") - } - if this.Programs != nil { - s = append(s, "Programs: "+fmt.Sprintf("%#v", this.Programs)+",\n") - } - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Program) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Program{") - s = append(s, "Code: "+fmt.Sprintf("%#v", this.Code)+",\n") - s = append(s, "Parameter: "+fmt.Sprintf("%#v", this.Parameter)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Payload) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.Payload{") - s = append(s, "Type: "+fmt.Sprintf("%#v", this.Type)+",\n") - s = append(s, "Data: "+fmt.Sprintf("%#v", this.Data)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Coinbase) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.Coinbase{") - s = append(s, "Sender: "+fmt.Sprintf("%#v", this.Sender)+",\n") - s = append(s, "Recipient: "+fmt.Sprintf("%#v", this.Recipient)+",\n") - s = append(s, "Amount: "+fmt.Sprintf("%#v", this.Amount)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *SigChainTxn) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.SigChainTxn{") - s = append(s, "SigChain: "+fmt.Sprintf("%#v", this.SigChain)+",\n") - s = append(s, "Submitter: "+fmt.Sprintf("%#v", this.Submitter)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *RegisterName) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.RegisterName{") - s = append(s, "Registrant: "+fmt.Sprintf("%#v", this.Registrant)+",\n") - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - s = append(s, "RegistrationFee: "+fmt.Sprintf("%#v", this.RegistrationFee)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *TransferName) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.TransferName{") - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - s = append(s, "Registrant: "+fmt.Sprintf("%#v", this.Registrant)+",\n") - s = append(s, "Recipient: "+fmt.Sprintf("%#v", this.Recipient)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *DeleteName) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.DeleteName{") - s = append(s, "Registrant: "+fmt.Sprintf("%#v", this.Registrant)+",\n") - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Subscribe) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&pb.Subscribe{") - s = append(s, "Subscriber: "+fmt.Sprintf("%#v", this.Subscriber)+",\n") - s = append(s, "Identifier: "+fmt.Sprintf("%#v", this.Identifier)+",\n") - s = append(s, "Topic: "+fmt.Sprintf("%#v", this.Topic)+",\n") - s = append(s, "Bucket: "+fmt.Sprintf("%#v", this.Bucket)+",\n") - s = append(s, "Duration: "+fmt.Sprintf("%#v", this.Duration)+",\n") - s = append(s, "Meta: "+fmt.Sprintf("%#v", this.Meta)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *Unsubscribe) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.Unsubscribe{") - s = append(s, "Subscriber: "+fmt.Sprintf("%#v", this.Subscriber)+",\n") - s = append(s, "Identifier: "+fmt.Sprintf("%#v", this.Identifier)+",\n") - s = append(s, "Topic: "+fmt.Sprintf("%#v", this.Topic)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *TransferAsset) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 7) - s = append(s, "&pb.TransferAsset{") - s = append(s, "Sender: "+fmt.Sprintf("%#v", this.Sender)+",\n") - s = append(s, "Recipient: "+fmt.Sprintf("%#v", this.Recipient)+",\n") - s = append(s, "Amount: "+fmt.Sprintf("%#v", this.Amount)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *GenerateID) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 6) - s = append(s, "&pb.GenerateID{") - s = append(s, "PublicKey: "+fmt.Sprintf("%#v", this.PublicKey)+",\n") - s = append(s, "RegistrationFee: "+fmt.Sprintf("%#v", this.RegistrationFee)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *NanoPay) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 10) - s = append(s, "&pb.NanoPay{") - s = append(s, "Sender: "+fmt.Sprintf("%#v", this.Sender)+",\n") - s = append(s, "Recipient: "+fmt.Sprintf("%#v", this.Recipient)+",\n") - s = append(s, "Id: "+fmt.Sprintf("%#v", this.Id)+",\n") - s = append(s, "Amount: "+fmt.Sprintf("%#v", this.Amount)+",\n") - s = append(s, "TxnExpiration: "+fmt.Sprintf("%#v", this.TxnExpiration)+",\n") - s = append(s, "NanoPayExpiration: "+fmt.Sprintf("%#v", this.NanoPayExpiration)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func (this *IssueAsset) GoString() string { - if this == nil { - return "nil" - } - s := make([]string, 0, 9) - s = append(s, "&pb.IssueAsset{") - s = append(s, "Sender: "+fmt.Sprintf("%#v", this.Sender)+",\n") - s = append(s, "Name: "+fmt.Sprintf("%#v", this.Name)+",\n") - s = append(s, "Symbol: "+fmt.Sprintf("%#v", this.Symbol)+",\n") - s = append(s, "TotalSupply: "+fmt.Sprintf("%#v", this.TotalSupply)+",\n") - s = append(s, "Precision: "+fmt.Sprintf("%#v", this.Precision)+",\n") - s = append(s, "}") - return strings.Join(s, "") -} -func valueToGoStringTransaction(v interface{}, typ string) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("func(v %v) *%v { return &v } ( %#v )", typ, typ, pv) -} -func (m *UnsignedTx) 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 *UnsignedTx) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Payload != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Payload.Size())) - n1, err := m.Payload.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n1 - } - if m.Nonce != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Nonce)) - } - if m.Fee != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Fee)) - } - if len(m.Attributes) > 0 { - dAtA[i] = 0x22 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Attributes))) - i += copy(dAtA[i:], m.Attributes) - } - return i, nil -} - -func (m *Transaction) 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 *Transaction) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.UnsignedTx != nil { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.UnsignedTx.Size())) - n2, err := m.UnsignedTx.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n2 - } - if len(m.Programs) > 0 { - for _, msg := range m.Programs { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(msg.Size())) - n, err := msg.MarshalTo(dAtA[i:]) - if err != nil { - return 0, err - } - i += n - } - } - return i, nil -} - -func (m *Program) 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 *Program) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Code) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Code))) - i += copy(dAtA[i:], m.Code) - } - if len(m.Parameter) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Parameter))) - i += copy(dAtA[i:], m.Parameter) - } - return i, nil -} - -func (m *Payload) 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 *Payload) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if m.Type != 0 { - dAtA[i] = 0x8 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Type)) - } - if len(m.Data) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Data))) - i += copy(dAtA[i:], m.Data) - } - return i, nil -} - -func (m *Coinbase) 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 *Coinbase) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Sender))) - i += copy(dAtA[i:], m.Sender) - } - if len(m.Recipient) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Recipient))) - i += copy(dAtA[i:], m.Recipient) - } - if m.Amount != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Amount)) - } - return i, nil -} - -func (m *SigChainTxn) 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 *SigChainTxn) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.SigChain) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.SigChain))) - i += copy(dAtA[i:], m.SigChain) - } - if len(m.Submitter) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Submitter))) - i += copy(dAtA[i:], m.Submitter) - } - return i, nil -} - -func (m *RegisterName) 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 *RegisterName) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Registrant) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Registrant))) - i += copy(dAtA[i:], m.Registrant) - } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if m.RegistrationFee != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.RegistrationFee)) - } - return i, nil -} - -func (m *TransferName) 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 *TransferName) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Name) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Registrant) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Registrant))) - i += copy(dAtA[i:], m.Registrant) - } - if len(m.Recipient) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Recipient))) - i += copy(dAtA[i:], m.Recipient) - } - return i, nil -} - -func (m *DeleteName) 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 *DeleteName) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Registrant) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Registrant))) - i += copy(dAtA[i:], m.Registrant) - } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - return i, nil -} - -func (m *Subscribe) 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 *Subscribe) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Subscriber) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Subscriber))) - i += copy(dAtA[i:], m.Subscriber) - } - if len(m.Identifier) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Identifier))) - i += copy(dAtA[i:], m.Identifier) - } - if len(m.Topic) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Topic))) - i += copy(dAtA[i:], m.Topic) - } - if m.Bucket != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Bucket)) - } - if m.Duration != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Duration)) - } - if len(m.Meta) > 0 { - dAtA[i] = 0x32 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Meta))) - i += copy(dAtA[i:], m.Meta) - } - return i, nil -} - -func (m *Unsubscribe) 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 *Unsubscribe) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Subscriber) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Subscriber))) - i += copy(dAtA[i:], m.Subscriber) - } - if len(m.Identifier) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Identifier))) - i += copy(dAtA[i:], m.Identifier) - } - if len(m.Topic) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Topic))) - i += copy(dAtA[i:], m.Topic) - } - return i, nil -} - -func (m *TransferAsset) 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 *TransferAsset) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Sender))) - i += copy(dAtA[i:], m.Sender) - } - if len(m.Recipient) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Recipient))) - i += copy(dAtA[i:], m.Recipient) - } - if m.Amount != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Amount)) - } - return i, nil -} - -func (m *GenerateID) 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 *GenerateID) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.PublicKey) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.PublicKey))) - i += copy(dAtA[i:], m.PublicKey) - } - if m.RegistrationFee != 0 { - dAtA[i] = 0x10 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.RegistrationFee)) - } - return i, nil -} - -func (m *NanoPay) 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 *NanoPay) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Sender))) - i += copy(dAtA[i:], m.Sender) - } - if len(m.Recipient) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Recipient))) - i += copy(dAtA[i:], m.Recipient) - } - if m.Id != 0 { - dAtA[i] = 0x18 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Id)) - } - if m.Amount != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Amount)) - } - if m.TxnExpiration != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.TxnExpiration)) - } - if m.NanoPayExpiration != 0 { - dAtA[i] = 0x30 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.NanoPayExpiration)) - } - return i, nil -} - -func (m *IssueAsset) 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 *IssueAsset) MarshalTo(dAtA []byte) (int, error) { - var i int - _ = i - var l int - _ = l - if len(m.Sender) > 0 { - dAtA[i] = 0xa - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Sender))) - i += copy(dAtA[i:], m.Sender) - } - if len(m.Name) > 0 { - dAtA[i] = 0x12 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Name))) - i += copy(dAtA[i:], m.Name) - } - if len(m.Symbol) > 0 { - dAtA[i] = 0x1a - i++ - i = encodeVarintTransaction(dAtA, i, uint64(len(m.Symbol))) - i += copy(dAtA[i:], m.Symbol) - } - if m.TotalSupply != 0 { - dAtA[i] = 0x20 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.TotalSupply)) - } - if m.Precision != 0 { - dAtA[i] = 0x28 - i++ - i = encodeVarintTransaction(dAtA, i, uint64(m.Precision)) - } - return i, nil -} - -func encodeVarintTransaction(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 NewPopulatedUnsignedTx(r randyTransaction, easy bool) *UnsignedTx { - this := &UnsignedTx{} - if r.Intn(10) != 0 { - this.Payload = NewPopulatedPayload(r, easy) - } - this.Nonce = uint64(uint64(r.Uint32())) - this.Fee = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Fee *= -1 - } - v1 := r.Intn(100) - this.Attributes = make([]byte, v1) - for i := 0; i < v1; i++ { - this.Attributes[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedTransaction(r randyTransaction, easy bool) *Transaction { - this := &Transaction{} - if r.Intn(10) != 0 { - this.UnsignedTx = NewPopulatedUnsignedTx(r, easy) - } - if r.Intn(10) != 0 { - v2 := r.Intn(5) - this.Programs = make([]*Program, v2) - for i := 0; i < v2; i++ { - this.Programs[i] = NewPopulatedProgram(r, easy) - } - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedProgram(r randyTransaction, easy bool) *Program { - this := &Program{} - v3 := r.Intn(100) - this.Code = make([]byte, v3) - for i := 0; i < v3; i++ { - this.Code[i] = byte(r.Intn(256)) - } - v4 := r.Intn(100) - this.Parameter = make([]byte, v4) - for i := 0; i < v4; i++ { - this.Parameter[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedPayload(r randyTransaction, easy bool) *Payload { - this := &Payload{} - this.Type = PayloadType([]int32{0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10}[r.Intn(11)]) - v5 := r.Intn(100) - this.Data = make([]byte, v5) - for i := 0; i < v5; i++ { - this.Data[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedCoinbase(r randyTransaction, easy bool) *Coinbase { - this := &Coinbase{} - v6 := r.Intn(100) - this.Sender = make([]byte, v6) - for i := 0; i < v6; i++ { - this.Sender[i] = byte(r.Intn(256)) - } - v7 := r.Intn(100) - this.Recipient = make([]byte, v7) - for i := 0; i < v7; i++ { - this.Recipient[i] = byte(r.Intn(256)) - } - this.Amount = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Amount *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedSigChainTxn(r randyTransaction, easy bool) *SigChainTxn { - this := &SigChainTxn{} - v8 := r.Intn(100) - this.SigChain = make([]byte, v8) - for i := 0; i < v8; i++ { - this.SigChain[i] = byte(r.Intn(256)) - } - v9 := r.Intn(100) - this.Submitter = make([]byte, v9) - for i := 0; i < v9; i++ { - this.Submitter[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedRegisterName(r randyTransaction, easy bool) *RegisterName { - this := &RegisterName{} - v10 := r.Intn(100) - this.Registrant = make([]byte, v10) - for i := 0; i < v10; i++ { - this.Registrant[i] = byte(r.Intn(256)) - } - this.Name = string(randStringTransaction(r)) - this.RegistrationFee = int64(r.Int63()) - if r.Intn(2) == 0 { - this.RegistrationFee *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedTransferName(r randyTransaction, easy bool) *TransferName { - this := &TransferName{} - this.Name = string(randStringTransaction(r)) - v11 := r.Intn(100) - this.Registrant = make([]byte, v11) - for i := 0; i < v11; i++ { - this.Registrant[i] = byte(r.Intn(256)) - } - v12 := r.Intn(100) - this.Recipient = make([]byte, v12) - for i := 0; i < v12; i++ { - this.Recipient[i] = byte(r.Intn(256)) - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedDeleteName(r randyTransaction, easy bool) *DeleteName { - this := &DeleteName{} - v13 := r.Intn(100) - this.Registrant = make([]byte, v13) - for i := 0; i < v13; i++ { - this.Registrant[i] = byte(r.Intn(256)) - } - this.Name = string(randStringTransaction(r)) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedSubscribe(r randyTransaction, easy bool) *Subscribe { - this := &Subscribe{} - v14 := r.Intn(100) - this.Subscriber = make([]byte, v14) - for i := 0; i < v14; i++ { - this.Subscriber[i] = byte(r.Intn(256)) - } - this.Identifier = string(randStringTransaction(r)) - this.Topic = string(randStringTransaction(r)) - this.Bucket = uint32(r.Uint32()) - this.Duration = uint32(r.Uint32()) - this.Meta = string(randStringTransaction(r)) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedUnsubscribe(r randyTransaction, easy bool) *Unsubscribe { - this := &Unsubscribe{} - v15 := r.Intn(100) - this.Subscriber = make([]byte, v15) - for i := 0; i < v15; i++ { - this.Subscriber[i] = byte(r.Intn(256)) - } - this.Identifier = string(randStringTransaction(r)) - this.Topic = string(randStringTransaction(r)) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedTransferAsset(r randyTransaction, easy bool) *TransferAsset { - this := &TransferAsset{} - v16 := r.Intn(100) - this.Sender = make([]byte, v16) - for i := 0; i < v16; i++ { - this.Sender[i] = byte(r.Intn(256)) - } - v17 := r.Intn(100) - this.Recipient = make([]byte, v17) - for i := 0; i < v17; i++ { - this.Recipient[i] = byte(r.Intn(256)) - } - this.Amount = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Amount *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedGenerateID(r randyTransaction, easy bool) *GenerateID { - this := &GenerateID{} - v18 := r.Intn(100) - this.PublicKey = make([]byte, v18) - for i := 0; i < v18; i++ { - this.PublicKey[i] = byte(r.Intn(256)) - } - this.RegistrationFee = int64(r.Int63()) - if r.Intn(2) == 0 { - this.RegistrationFee *= -1 - } - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedNanoPay(r randyTransaction, easy bool) *NanoPay { - this := &NanoPay{} - v19 := r.Intn(100) - this.Sender = make([]byte, v19) - for i := 0; i < v19; i++ { - this.Sender[i] = byte(r.Intn(256)) - } - v20 := r.Intn(100) - this.Recipient = make([]byte, v20) - for i := 0; i < v20; i++ { - this.Recipient[i] = byte(r.Intn(256)) - } - this.Id = uint64(uint64(r.Uint32())) - this.Amount = int64(r.Int63()) - if r.Intn(2) == 0 { - this.Amount *= -1 - } - this.TxnExpiration = uint32(r.Uint32()) - this.NanoPayExpiration = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -func NewPopulatedIssueAsset(r randyTransaction, easy bool) *IssueAsset { - this := &IssueAsset{} - v21 := r.Intn(100) - this.Sender = make([]byte, v21) - for i := 0; i < v21; i++ { - this.Sender[i] = byte(r.Intn(256)) - } - this.Name = string(randStringTransaction(r)) - this.Symbol = string(randStringTransaction(r)) - this.TotalSupply = int64(r.Int63()) - if r.Intn(2) == 0 { - this.TotalSupply *= -1 - } - this.Precision = uint32(r.Uint32()) - if !easy && r.Intn(10) != 0 { - } - return this -} - -type randyTransaction interface { - Float32() float32 - Float64() float64 - Int63() int64 - Int31() int32 - Uint32() uint32 - Intn(n int) int -} - -func randUTF8RuneTransaction(r randyTransaction) rune { - ru := r.Intn(62) - if ru < 10 { - return rune(ru + 48) - } else if ru < 36 { - return rune(ru + 55) - } - return rune(ru + 61) -} -func randStringTransaction(r randyTransaction) string { - v22 := r.Intn(100) - tmps := make([]rune, v22) - for i := 0; i < v22; i++ { - tmps[i] = randUTF8RuneTransaction(r) - } - return string(tmps) -} -func randUnrecognizedTransaction(r randyTransaction, maxFieldNumber int) (dAtA []byte) { - l := r.Intn(5) - for i := 0; i < l; i++ { - wire := r.Intn(4) - if wire == 3 { - wire = 5 - } - fieldNumber := maxFieldNumber + r.Intn(100) - dAtA = randFieldTransaction(dAtA, r, fieldNumber, wire) - } - return dAtA -} -func randFieldTransaction(dAtA []byte, r randyTransaction, fieldNumber int, wire int) []byte { - key := uint32(fieldNumber)<<3 | uint32(wire) - switch wire { - case 0: - dAtA = encodeVarintPopulateTransaction(dAtA, uint64(key)) - v23 := r.Int63() - if r.Intn(2) == 0 { - v23 *= -1 - } - dAtA = encodeVarintPopulateTransaction(dAtA, uint64(v23)) - case 1: - dAtA = encodeVarintPopulateTransaction(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - case 2: - dAtA = encodeVarintPopulateTransaction(dAtA, uint64(key)) - ll := r.Intn(100) - dAtA = encodeVarintPopulateTransaction(dAtA, uint64(ll)) - for j := 0; j < ll; j++ { - dAtA = append(dAtA, byte(r.Intn(256))) - } - default: - dAtA = encodeVarintPopulateTransaction(dAtA, uint64(key)) - dAtA = append(dAtA, byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256)), byte(r.Intn(256))) - } - return dAtA -} -func encodeVarintPopulateTransaction(dAtA []byte, v uint64) []byte { - for v >= 1<<7 { - dAtA = append(dAtA, uint8(uint64(v)&0x7f|0x80)) - v >>= 7 - } - dAtA = append(dAtA, uint8(v)) - return dAtA -} -func (m *UnsignedTx) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Payload != nil { - l = m.Payload.Size() - n += 1 + l + sovTransaction(uint64(l)) - } - if m.Nonce != 0 { - n += 1 + sovTransaction(uint64(m.Nonce)) - } - if m.Fee != 0 { - n += 1 + sovTransaction(uint64(m.Fee)) - } - l = len(m.Attributes) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *Transaction) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.UnsignedTx != nil { - l = m.UnsignedTx.Size() - n += 1 + l + sovTransaction(uint64(l)) - } - if len(m.Programs) > 0 { - for _, e := range m.Programs { - l = e.Size() - n += 1 + l + sovTransaction(uint64(l)) - } - } - return n -} - -func (m *Program) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Code) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Parameter) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *Payload) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - if m.Type != 0 { - n += 1 + sovTransaction(uint64(m.Type)) - } - l = len(m.Data) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *Coinbase) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.Amount != 0 { - n += 1 + sovTransaction(uint64(m.Amount)) - } - return n -} - -func (m *SigChainTxn) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.SigChain) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Submitter) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *RegisterName) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Registrant) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.RegistrationFee != 0 { - n += 1 + sovTransaction(uint64(m.RegistrationFee)) - } - return n -} - -func (m *TransferName) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Registrant) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *DeleteName) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Registrant) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *Subscribe) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Subscriber) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Identifier) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Topic) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.Bucket != 0 { - n += 1 + sovTransaction(uint64(m.Bucket)) - } - if m.Duration != 0 { - n += 1 + sovTransaction(uint64(m.Duration)) - } - l = len(m.Meta) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *Unsubscribe) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Subscriber) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Identifier) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Topic) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - return n -} - -func (m *TransferAsset) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.Amount != 0 { - n += 1 + sovTransaction(uint64(m.Amount)) - } - return n -} - -func (m *GenerateID) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.PublicKey) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.RegistrationFee != 0 { - n += 1 + sovTransaction(uint64(m.RegistrationFee)) - } - return n -} - -func (m *NanoPay) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Recipient) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.Id != 0 { - n += 1 + sovTransaction(uint64(m.Id)) - } - if m.Amount != 0 { - n += 1 + sovTransaction(uint64(m.Amount)) - } - if m.TxnExpiration != 0 { - n += 1 + sovTransaction(uint64(m.TxnExpiration)) - } - if m.NanoPayExpiration != 0 { - n += 1 + sovTransaction(uint64(m.NanoPayExpiration)) - } - return n -} - -func (m *IssueAsset) Size() (n int) { - if m == nil { - return 0 - } - var l int - _ = l - l = len(m.Sender) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Name) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - l = len(m.Symbol) - if l > 0 { - n += 1 + l + sovTransaction(uint64(l)) - } - if m.TotalSupply != 0 { - n += 1 + sovTransaction(uint64(m.TotalSupply)) - } - if m.Precision != 0 { - n += 1 + sovTransaction(uint64(m.Precision)) - } - return n -} - -func sovTransaction(x uint64) (n int) { - for { - n++ - x >>= 7 - if x == 0 { - break - } - } - return n -} -func sozTransaction(x uint64) (n int) { - return sovTransaction(uint64((x << 1) ^ uint64((int64(x) >> 63)))) -} -func (this *UnsignedTx) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&UnsignedTx{`, - `Payload:` + strings.Replace(fmt.Sprintf("%v", this.Payload), "Payload", "Payload", 1) + `,`, - `Nonce:` + fmt.Sprintf("%v", this.Nonce) + `,`, - `Fee:` + fmt.Sprintf("%v", this.Fee) + `,`, - `Attributes:` + fmt.Sprintf("%v", this.Attributes) + `,`, - `}`, - }, "") - return s -} -func (this *Transaction) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Transaction{`, - `UnsignedTx:` + strings.Replace(fmt.Sprintf("%v", this.UnsignedTx), "UnsignedTx", "UnsignedTx", 1) + `,`, - `Programs:` + strings.Replace(fmt.Sprintf("%v", this.Programs), "Program", "Program", 1) + `,`, - `}`, - }, "") - return s -} -func (this *Program) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Program{`, - `Code:` + fmt.Sprintf("%v", this.Code) + `,`, - `Parameter:` + fmt.Sprintf("%v", this.Parameter) + `,`, - `}`, - }, "") - return s -} -func (this *Payload) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Payload{`, - `Type:` + fmt.Sprintf("%v", this.Type) + `,`, - `Data:` + fmt.Sprintf("%v", this.Data) + `,`, - `}`, - }, "") - return s -} -func (this *Coinbase) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Coinbase{`, - `Sender:` + fmt.Sprintf("%v", this.Sender) + `,`, - `Recipient:` + fmt.Sprintf("%v", this.Recipient) + `,`, - `Amount:` + fmt.Sprintf("%v", this.Amount) + `,`, - `}`, - }, "") - return s -} -func (this *SigChainTxn) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&SigChainTxn{`, - `SigChain:` + fmt.Sprintf("%v", this.SigChain) + `,`, - `Submitter:` + fmt.Sprintf("%v", this.Submitter) + `,`, - `}`, - }, "") - return s -} -func (this *RegisterName) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&RegisterName{`, - `Registrant:` + fmt.Sprintf("%v", this.Registrant) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `RegistrationFee:` + fmt.Sprintf("%v", this.RegistrationFee) + `,`, - `}`, - }, "") - return s -} -func (this *TransferName) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TransferName{`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Registrant:` + fmt.Sprintf("%v", this.Registrant) + `,`, - `Recipient:` + fmt.Sprintf("%v", this.Recipient) + `,`, - `}`, - }, "") - return s -} -func (this *DeleteName) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&DeleteName{`, - `Registrant:` + fmt.Sprintf("%v", this.Registrant) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `}`, - }, "") - return s -} -func (this *Subscribe) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Subscribe{`, - `Subscriber:` + fmt.Sprintf("%v", this.Subscriber) + `,`, - `Identifier:` + fmt.Sprintf("%v", this.Identifier) + `,`, - `Topic:` + fmt.Sprintf("%v", this.Topic) + `,`, - `Bucket:` + fmt.Sprintf("%v", this.Bucket) + `,`, - `Duration:` + fmt.Sprintf("%v", this.Duration) + `,`, - `Meta:` + fmt.Sprintf("%v", this.Meta) + `,`, - `}`, - }, "") - return s -} -func (this *Unsubscribe) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&Unsubscribe{`, - `Subscriber:` + fmt.Sprintf("%v", this.Subscriber) + `,`, - `Identifier:` + fmt.Sprintf("%v", this.Identifier) + `,`, - `Topic:` + fmt.Sprintf("%v", this.Topic) + `,`, - `}`, - }, "") - return s -} -func (this *TransferAsset) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&TransferAsset{`, - `Sender:` + fmt.Sprintf("%v", this.Sender) + `,`, - `Recipient:` + fmt.Sprintf("%v", this.Recipient) + `,`, - `Amount:` + fmt.Sprintf("%v", this.Amount) + `,`, - `}`, - }, "") - return s -} -func (this *GenerateID) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&GenerateID{`, - `PublicKey:` + fmt.Sprintf("%v", this.PublicKey) + `,`, - `RegistrationFee:` + fmt.Sprintf("%v", this.RegistrationFee) + `,`, - `}`, - }, "") - return s -} -func (this *NanoPay) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&NanoPay{`, - `Sender:` + fmt.Sprintf("%v", this.Sender) + `,`, - `Recipient:` + fmt.Sprintf("%v", this.Recipient) + `,`, - `Id:` + fmt.Sprintf("%v", this.Id) + `,`, - `Amount:` + fmt.Sprintf("%v", this.Amount) + `,`, - `TxnExpiration:` + fmt.Sprintf("%v", this.TxnExpiration) + `,`, - `NanoPayExpiration:` + fmt.Sprintf("%v", this.NanoPayExpiration) + `,`, - `}`, - }, "") - return s -} -func (this *IssueAsset) String() string { - if this == nil { - return "nil" - } - s := strings.Join([]string{`&IssueAsset{`, - `Sender:` + fmt.Sprintf("%v", this.Sender) + `,`, - `Name:` + fmt.Sprintf("%v", this.Name) + `,`, - `Symbol:` + fmt.Sprintf("%v", this.Symbol) + `,`, - `TotalSupply:` + fmt.Sprintf("%v", this.TotalSupply) + `,`, - `Precision:` + fmt.Sprintf("%v", this.Precision) + `,`, - `}`, - }, "") - return s -} -func valueToStringTransaction(v interface{}) string { - rv := reflect.ValueOf(v) - if rv.IsNil() { - return "nil" - } - pv := reflect.Indirect(rv).Interface() - return fmt.Sprintf("*%v", pv) -} -func (m *UnsignedTx) 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 ErrIntOverflowTransaction - } - 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: UnsignedTx: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: UnsignedTx: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Payload", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.Payload == nil { - m.Payload = &Payload{} - } - if err := m.Payload.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Nonce", wireType) - } - m.Nonce = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Nonce |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Fee", wireType) - } - m.Fee = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Fee |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Attributes", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Attributes = append(m.Attributes[:0], dAtA[iNdEx:postIndex]...) - if m.Attributes == nil { - m.Attributes = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Transaction) 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 ErrIntOverflowTransaction - } - 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: Transaction: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Transaction: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field UnsignedTx", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - if m.UnsignedTx == nil { - m.UnsignedTx = &UnsignedTx{} - } - if err := m.UnsignedTx.Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Programs", wireType) - } - var msglen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - msglen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if msglen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + msglen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Programs = append(m.Programs, &Program{}) - if err := m.Programs[len(m.Programs)-1].Unmarshal(dAtA[iNdEx:postIndex]); err != nil { - return err - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Program) 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 ErrIntOverflowTransaction - } - 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: Program: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Program: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Code", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Code = append(m.Code[:0], dAtA[iNdEx:postIndex]...) - if m.Code == nil { - m.Code = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Parameter", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Parameter = append(m.Parameter[:0], dAtA[iNdEx:postIndex]...) - if m.Parameter == nil { - m.Parameter = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Payload) 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 ErrIntOverflowTransaction - } - 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: Payload: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Payload: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Type", wireType) - } - m.Type = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Type |= (PayloadType(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Data", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Data = append(m.Data[:0], dAtA[iNdEx:postIndex]...) - if m.Data == nil { - m.Data = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Coinbase) 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 ErrIntOverflowTransaction - } - 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: Coinbase: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Coinbase: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) - if m.Sender == nil { - m.Sender = []byte{} - } - iNdEx = postIndex - case 2: - 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 ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - 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 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *SigChainTxn) 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 ErrIntOverflowTransaction - } - 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: SigChainTxn: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: SigChainTxn: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field SigChain", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.SigChain = append(m.SigChain[:0], dAtA[iNdEx:postIndex]...) - if m.SigChain == nil { - m.SigChain = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Submitter", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Submitter = append(m.Submitter[:0], dAtA[iNdEx:postIndex]...) - if m.Submitter == nil { - m.Submitter = []byte{} - } - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *RegisterName) 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 ErrIntOverflowTransaction - } - 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: RegisterName: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: RegisterName: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Registrant", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Registrant = append(m.Registrant[:0], dAtA[iNdEx:postIndex]...) - if m.Registrant == nil { - m.Registrant = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegistrationFee", wireType) - } - m.RegistrationFee = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RegistrationFee |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TransferName) 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 ErrIntOverflowTransaction - } - 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: TransferName: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransferName: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Registrant", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Registrant = append(m.Registrant[:0], dAtA[iNdEx:postIndex]...) - if m.Registrant == nil { - m.Registrant = []byte{} - } - 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 ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - 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 - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *DeleteName) 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 ErrIntOverflowTransaction - } - 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: DeleteName: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: DeleteName: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Registrant", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Registrant = append(m.Registrant[:0], dAtA[iNdEx:postIndex]...) - if m.Registrant == nil { - m.Registrant = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Subscribe) 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 ErrIntOverflowTransaction - } - 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: Subscribe: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Subscribe: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscriber", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subscriber = append(m.Subscriber[:0], dAtA[iNdEx:postIndex]...) - if m.Subscriber == nil { - m.Subscriber = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identifier", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Identifier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Topic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Bucket", wireType) - } - m.Bucket = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Bucket |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Duration", wireType) - } - m.Duration = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Duration |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Meta", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Meta = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *Unsubscribe) 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 ErrIntOverflowTransaction - } - 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: Unsubscribe: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: Unsubscribe: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Subscriber", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Subscriber = append(m.Subscriber[:0], dAtA[iNdEx:postIndex]...) - if m.Subscriber == nil { - m.Subscriber = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Identifier", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Identifier = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Topic", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Topic = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *TransferAsset) 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 ErrIntOverflowTransaction - } - 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: TransferAsset: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: TransferAsset: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) - if m.Sender == nil { - m.Sender = []byte{} - } - iNdEx = postIndex - case 2: - 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 ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - 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 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *GenerateID) 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 ErrIntOverflowTransaction - } - 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: GenerateID: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: GenerateID: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field PublicKey", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.PublicKey = append(m.PublicKey[:0], dAtA[iNdEx:postIndex]...) - if m.PublicKey == nil { - m.PublicKey = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field RegistrationFee", wireType) - } - m.RegistrationFee = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.RegistrationFee |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *NanoPay) 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 ErrIntOverflowTransaction - } - 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: NanoPay: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: NanoPay: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) - if m.Sender == nil { - m.Sender = []byte{} - } - iNdEx = postIndex - case 2: - 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 ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - 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 3: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Id", wireType) - } - m.Id = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Id |= (uint64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Amount", wireType) - } - m.Amount = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Amount |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TxnExpiration", wireType) - } - m.TxnExpiration = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TxnExpiration |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 6: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field NanoPayExpiration", wireType) - } - m.NanoPayExpiration = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.NanoPayExpiration |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func (m *IssueAsset) 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 ErrIntOverflowTransaction - } - 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: IssueAsset: wiretype end group for non-group") - } - if fieldNum <= 0 { - return fmt.Errorf("proto: IssueAsset: illegal tag %d (wire type %d)", fieldNum, wire) - } - switch fieldNum { - case 1: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Sender", wireType) - } - var byteLen int - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - byteLen |= (int(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - if byteLen < 0 { - return ErrInvalidLengthTransaction - } - postIndex := iNdEx + byteLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Sender = append(m.Sender[:0], dAtA[iNdEx:postIndex]...) - if m.Sender == nil { - m.Sender = []byte{} - } - iNdEx = postIndex - case 2: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Name", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Name = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 3: - if wireType != 2 { - return fmt.Errorf("proto: wrong wireType = %d for field Symbol", wireType) - } - var stringLen uint64 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - 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 ErrInvalidLengthTransaction - } - postIndex := iNdEx + intStringLen - if postIndex > l { - return io.ErrUnexpectedEOF - } - m.Symbol = string(dAtA[iNdEx:postIndex]) - iNdEx = postIndex - case 4: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field TotalSupply", wireType) - } - m.TotalSupply = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.TotalSupply |= (int64(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - case 5: - if wireType != 0 { - return fmt.Errorf("proto: wrong wireType = %d for field Precision", wireType) - } - m.Precision = 0 - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return ErrIntOverflowTransaction - } - if iNdEx >= l { - return io.ErrUnexpectedEOF - } - b := dAtA[iNdEx] - iNdEx++ - m.Precision |= (uint32(b) & 0x7F) << shift - if b < 0x80 { - break - } - } - default: - iNdEx = preIndex - skippy, err := skipTransaction(dAtA[iNdEx:]) - if err != nil { - return err - } - if skippy < 0 { - return ErrInvalidLengthTransaction - } - if (iNdEx + skippy) > l { - return io.ErrUnexpectedEOF - } - iNdEx += skippy - } - } - - if iNdEx > l { - return io.ErrUnexpectedEOF - } - return nil -} -func skipTransaction(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, ErrIntOverflowTransaction - } - 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, ErrIntOverflowTransaction - } - 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, ErrIntOverflowTransaction - } - 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, ErrInvalidLengthTransaction - } - return iNdEx, nil - case 3: - for { - var innerWire uint64 - var start int = iNdEx - for shift := uint(0); ; shift += 7 { - if shift >= 64 { - return 0, ErrIntOverflowTransaction - } - 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 := skipTransaction(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 ( - ErrInvalidLengthTransaction = fmt.Errorf("proto: negative length found during unmarshaling") - ErrIntOverflowTransaction = fmt.Errorf("proto: integer overflow") -) - -func init() { proto.RegisterFile("pb/transaction.proto", fileDescriptor_transaction_4e588bd5864b6478) } -var fileDescriptor_transaction_4e588bd5864b6478 = []byte{ - // 935 bytes of a gzipped FileDescriptorProto - 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0x41, 0x6f, 0x1b, 0x45, - 0x14, 0xc7, 0x3d, 0xb6, 0xe3, 0xc4, 0xcf, 0x4e, 0x9a, 0x4e, 0xa3, 0x62, 0x05, 0x58, 0x85, 0x45, - 0x15, 0x01, 0x89, 0x44, 0x2a, 0x47, 0x38, 0x60, 0x27, 0xdb, 0xd4, 0x02, 0xb6, 0xd1, 0xec, 0x1a, - 0xb5, 0x07, 0xb4, 0xcc, 0xae, 0x27, 0xee, 0xa8, 0xde, 0xd9, 0xd5, 0xee, 0xac, 0x64, 0x8b, 0x4b, - 0x3f, 0x02, 0x7c, 0x0b, 0x2e, 0xdc, 0x39, 0x71, 0xe6, 0x98, 0x63, 0x8f, 0xc4, 0xb9, 0x70, 0xec, - 0x91, 0x23, 0x9a, 0xd9, 0xb1, 0xbd, 0x29, 0x11, 0x87, 0x0a, 0x6e, 0xef, 0xfd, 0xde, 0xdb, 0x37, - 0xff, 0xf7, 0xde, 0x8c, 0x0d, 0x7b, 0x69, 0x78, 0x2c, 0x33, 0x2a, 0x72, 0x1a, 0x49, 0x9e, 0x88, - 0xa3, 0x34, 0x4b, 0x64, 0x82, 0xeb, 0x69, 0xb8, 0xff, 0xe9, 0x84, 0xcb, 0xe7, 0x45, 0x78, 0x14, - 0x25, 0xf1, 0xf1, 0x24, 0x99, 0x24, 0xc7, 0x3a, 0x14, 0x16, 0x17, 0xda, 0xd3, 0x8e, 0xb6, 0xca, - 0x4f, 0xec, 0x1f, 0x00, 0x46, 0x22, 0xe7, 0x13, 0xc1, 0xc6, 0xfe, 0x0c, 0x3f, 0x80, 0xcd, 0x94, - 0xce, 0xa7, 0x09, 0x1d, 0xf7, 0xd0, 0x01, 0x3a, 0xec, 0x3c, 0xec, 0x1c, 0xa5, 0xe1, 0xd1, 0x79, - 0x89, 0xc8, 0x32, 0x86, 0xf7, 0x60, 0x43, 0x24, 0x22, 0x62, 0xbd, 0xfa, 0x01, 0x3a, 0x6c, 0x92, - 0xd2, 0xc1, 0xbb, 0xd0, 0xb8, 0x60, 0xac, 0xd7, 0x38, 0x40, 0x87, 0x0d, 0xa2, 0x4c, 0x6c, 0x01, - 0x50, 0x29, 0x33, 0x1e, 0x16, 0x92, 0xe5, 0xbd, 0xe6, 0x01, 0x3a, 0xec, 0x92, 0x0a, 0xb1, 0x27, - 0xd0, 0xf1, 0xd7, 0x4d, 0xe0, 0x63, 0xe8, 0x14, 0x46, 0x4b, 0x20, 0x67, 0x46, 0xc1, 0x8e, 0x52, - 0xb0, 0x96, 0x48, 0xa0, 0x58, 0xcb, 0xfd, 0x08, 0xb6, 0xd2, 0x2c, 0x99, 0x64, 0x34, 0xce, 0x7b, - 0xf5, 0x83, 0xc6, 0x4a, 0x6f, 0xc9, 0xc8, 0x2a, 0x68, 0x7f, 0x0e, 0x9b, 0x06, 0x62, 0x0c, 0xcd, - 0x28, 0x19, 0x33, 0x5d, 0xbd, 0x4b, 0xb4, 0x8d, 0xdf, 0x83, 0x76, 0x4a, 0x33, 0x1a, 0x33, 0xc9, - 0x32, 0xdd, 0x53, 0x97, 0xac, 0x81, 0x3d, 0x80, 0x4d, 0x33, 0x01, 0xfc, 0x21, 0x34, 0xe5, 0x3c, - 0x2d, 0x3f, 0xde, 0x79, 0x78, 0xa7, 0x32, 0x1c, 0x7f, 0x9e, 0x32, 0xa2, 0x83, 0xea, 0x84, 0x31, - 0x95, 0xd4, 0x14, 0xd2, 0xb6, 0xfd, 0x14, 0xb6, 0x4e, 0x12, 0x2e, 0x42, 0x9a, 0x33, 0x7c, 0x1f, - 0x5a, 0x39, 0x13, 0x63, 0x96, 0x19, 0x0d, 0xc6, 0x53, 0x2a, 0x32, 0x16, 0xf1, 0x94, 0x33, 0x21, - 0x97, 0x2a, 0x56, 0x40, 0x7d, 0x45, 0xe3, 0xa4, 0x10, 0xd2, 0x0c, 0xd8, 0x78, 0xf6, 0x63, 0xe8, - 0x78, 0x7c, 0x72, 0xf2, 0x9c, 0x72, 0xe1, 0xcf, 0x04, 0x7e, 0x17, 0xda, 0x39, 0x9f, 0x04, 0x91, - 0xf2, 0x4d, 0xfd, 0xad, 0xdc, 0xc4, 0xd5, 0x09, 0x79, 0x11, 0xc6, 0x5c, 0x56, 0xfa, 0x5c, 0x01, - 0x3b, 0x86, 0x2e, 0x61, 0x13, 0x9e, 0x4b, 0x96, 0xb9, 0x34, 0xd6, 0xdb, 0xcb, 0xb4, 0x9f, 0x51, - 0x21, 0x4d, 0xad, 0x0a, 0x51, 0x7d, 0x0a, 0x1a, 0x97, 0x97, 0xa0, 0x4d, 0xb4, 0x8d, 0x3f, 0x86, - 0xdd, 0x65, 0x86, 0x5a, 0x69, 0xb0, 0xbe, 0x10, 0x77, 0xaa, 0xfc, 0x11, 0x63, 0xf6, 0xf7, 0xd0, - 0xd5, 0xcb, 0xbf, 0x30, 0xc7, 0x2d, 0xcb, 0xa1, 0x4a, 0xb9, 0x9b, 0x12, 0xea, 0xff, 0x90, 0x70, - 0x63, 0x64, 0x8d, 0x37, 0x46, 0x66, 0x7f, 0x09, 0x70, 0xca, 0xa6, 0x4c, 0xb2, 0xb7, 0x6d, 0xc7, - 0xfe, 0x05, 0x41, 0xdb, 0x2b, 0xc2, 0x3c, 0xca, 0x78, 0xa8, 0x2b, 0xe4, 0x4b, 0x67, 0xb9, 0xbc, - 0x0a, 0x51, 0x71, 0x3e, 0x66, 0x42, 0xf2, 0x0b, 0x6e, 0xe6, 0xdb, 0x26, 0x15, 0xa2, 0x9e, 0x8d, - 0x4c, 0x52, 0x1e, 0x69, 0xa5, 0x6d, 0x52, 0x3a, 0x78, 0x1f, 0x5a, 0x61, 0x11, 0xbd, 0x60, 0x52, - 0x3f, 0x90, 0xed, 0x41, 0xbd, 0x87, 0x88, 0x21, 0x78, 0x1f, 0xb6, 0xc6, 0x45, 0x39, 0xb2, 0xde, - 0x86, 0x8a, 0x92, 0x95, 0xaf, 0xf4, 0xc6, 0x4c, 0xd2, 0x5e, 0xab, 0xd4, 0xab, 0x6c, 0x3b, 0x82, - 0xce, 0x48, 0xe4, 0xff, 0xaf, 0x60, 0xfb, 0x3b, 0xd8, 0x5e, 0x2e, 0xae, 0x9f, 0xe7, 0x4c, 0xfe, - 0xc7, 0x17, 0xfa, 0x5b, 0x80, 0x33, 0x26, 0x58, 0x46, 0x25, 0x1b, 0x9e, 0xe2, 0xf7, 0x01, 0xd2, - 0x22, 0x9c, 0xf2, 0x28, 0x78, 0xc1, 0xe6, 0xa6, 0x7e, 0xbb, 0x24, 0x5f, 0xb1, 0xf9, 0xad, 0xf7, - 0xad, 0x7e, 0xfb, 0x7d, 0xfb, 0x0d, 0xc1, 0xa6, 0x4b, 0x45, 0x72, 0x4e, 0xe7, 0x6f, 0xa9, 0x78, - 0x07, 0xea, 0x7c, 0xac, 0xd5, 0x36, 0x49, 0x9d, 0x8f, 0x2b, 0x1d, 0x34, 0xab, 0x1d, 0xe0, 0x07, - 0xb0, 0x23, 0x67, 0x22, 0x60, 0xb3, 0x94, 0xdf, 0xd8, 0xdd, 0xb6, 0x9c, 0x09, 0x67, 0x05, 0xf1, - 0x11, 0xdc, 0x13, 0x54, 0x24, 0x41, 0x4a, 0xe7, 0xd5, 0xdc, 0x96, 0xce, 0xbd, 0x2b, 0x4a, 0xa9, - 0xeb, 0x7c, 0xfb, 0x27, 0x04, 0x30, 0xcc, 0xf3, 0x82, 0xfd, 0xfb, 0xd4, 0x6f, 0x7b, 0x96, 0x2a, - 0x77, 0x1e, 0x87, 0xc9, 0xd4, 0x6c, 0xd2, 0x78, 0xf8, 0x03, 0xe8, 0xca, 0x44, 0xd2, 0x69, 0x90, - 0x17, 0x69, 0x3a, 0x9d, 0x9b, 0x3e, 0x3a, 0x9a, 0x79, 0x1a, 0xe9, 0xdf, 0x46, 0x35, 0x82, 0x7c, - 0xdd, 0xc7, 0x1a, 0x7c, 0xf2, 0xb2, 0x0e, 0x9d, 0xca, 0x2f, 0x20, 0xbe, 0x0b, 0xdb, 0x27, 0x4f, - 0x86, 0xee, 0xa0, 0xef, 0x39, 0x81, 0xff, 0xec, 0xdc, 0xd9, 0xad, 0xe1, 0x77, 0xe0, 0x9e, 0x4f, - 0xfa, 0xae, 0xf7, 0xc8, 0x21, 0x41, 0xdf, 0xf3, 0x1c, 0xbf, 0x0c, 0x20, 0x7c, 0x1f, 0xb0, 0x37, - 0x3c, 0x0b, 0x4e, 0x1e, 0xf7, 0x87, 0x6e, 0xe0, 0x3f, 0x75, 0x4b, 0x5e, 0x57, 0x9c, 0x38, 0x67, - 0x43, 0xcf, 0x77, 0x48, 0xe0, 0xf6, 0xbf, 0x31, 0x85, 0x1a, 0x8a, 0xaf, 0x0a, 0xad, 0x79, 0x13, - 0xef, 0xc1, 0xee, 0xa9, 0xf3, 0xb5, 0xe3, 0x3b, 0x15, 0xba, 0x81, 0x31, 0xec, 0x78, 0xa3, 0x81, - 0x77, 0x42, 0x86, 0x03, 0xc3, 0x5a, 0x2a, 0x73, 0xe4, 0xbe, 0x41, 0x37, 0x15, 0x3d, 0x73, 0x5c, - 0x87, 0xf4, 0x7d, 0x27, 0x18, 0x9e, 0x96, 0x74, 0x4b, 0x75, 0xe2, 0xf6, 0xdd, 0x27, 0xc1, 0x79, - 0xff, 0x59, 0x89, 0xda, 0x2a, 0x71, 0xe8, 0x79, 0x23, 0xa7, 0xda, 0x06, 0x0c, 0xbe, 0xb8, 0xbc, - 0xb2, 0x6a, 0xaf, 0xae, 0xac, 0xda, 0xeb, 0x2b, 0x0b, 0xfd, 0x75, 0x65, 0xa1, 0x97, 0x0b, 0x0b, - 0xfd, 0xbc, 0xb0, 0xd0, 0xaf, 0x0b, 0x0b, 0xfd, 0xbe, 0xb0, 0xd0, 0xe5, 0xc2, 0x42, 0x7f, 0x2c, - 0x2c, 0xf4, 0xe7, 0xc2, 0xaa, 0xbd, 0x5e, 0x58, 0xe8, 0xc7, 0x6b, 0xab, 0x76, 0x79, 0x6d, 0xd5, - 0x5e, 0x5d, 0x5b, 0xb5, 0xb0, 0xa5, 0xff, 0x86, 0x3f, 0xfb, 0x3b, 0x00, 0x00, 0xff, 0xff, 0x3d, - 0x1d, 0x56, 0xb8, 0xd1, 0x07, 0x00, 0x00, +func init() { proto.RegisterFile("pb/transaction.proto", fileDescriptor_transaction_dee487b0d08e39df) } + +var fileDescriptor_transaction_dee487b0d08e39df = []byte{ + // 833 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x95, 0xdd, 0x8e, 0xdb, 0x44, + 0x14, 0xc7, 0xb1, 0x93, 0xcd, 0xc7, 0x49, 0x36, 0xdd, 0x4e, 0x57, 0x25, 0x2a, 0x1f, 0x0a, 0x46, + 0x15, 0x0b, 0x17, 0x5b, 0xa9, 0x5c, 0x72, 0x43, 0x92, 0x75, 0xb7, 0x16, 0xe0, 0xae, 0xc6, 0x0e, + 0x6a, 0x2f, 0x90, 0x19, 0xdb, 0xb3, 0x61, 0xd4, 0x78, 0x6c, 0x79, 0xc6, 0x52, 0x2c, 0x6e, 0x78, + 0x05, 0x1e, 0x84, 0x57, 0xe0, 0xd9, 0xd0, 0x8c, 0x27, 0xb1, 0xb7, 0xac, 0xb8, 0xa8, 0xe8, 0xdd, + 0x9c, 0xdf, 0x39, 0x39, 0xf3, 0x3f, 0x1f, 0xe3, 0xc0, 0x79, 0x11, 0x3f, 0x93, 0x25, 0xe1, 0x82, + 0x24, 0x92, 0xe5, 0xfc, 0xb2, 0x28, 0x73, 0x99, 0x23, 0xbb, 0x88, 0x9d, 0xdf, 0x01, 0x36, 0x5c, + 0xb0, 0x2d, 0xa7, 0x69, 0xb8, 0x47, 0x4f, 0x61, 0x58, 0x90, 0x7a, 0x97, 0x93, 0x74, 0x6e, 0x2d, + 0xac, 0x8b, 0xc9, 0xf3, 0xc9, 0x65, 0x11, 0x5f, 0xde, 0x34, 0x08, 0x1f, 0x7c, 0xe8, 0x1c, 0x4e, + 0x78, 0xce, 0x13, 0x3a, 0xb7, 0x17, 0xd6, 0x45, 0x1f, 0x37, 0x06, 0x3a, 0x83, 0xde, 0x2d, 0xa5, + 0xf3, 0xde, 0xc2, 0xba, 0xe8, 0x61, 0x75, 0x44, 0x9f, 0x03, 0x10, 0x29, 0x4b, 0x16, 0x57, 0x92, + 0x8a, 0x79, 0x7f, 0x61, 0x5d, 0x4c, 0x71, 0x87, 0x38, 0x5b, 0x98, 0x84, 0xad, 0x2a, 0xf4, 0x0c, + 0x26, 0x95, 0xd1, 0x12, 0xc9, 0xbd, 0x51, 0x30, 0x53, 0x0a, 0x5a, 0x89, 0x18, 0xaa, 0x56, 0xee, + 0x57, 0x30, 0x2a, 0xca, 0x7c, 0x5b, 0x92, 0x4c, 0xcc, 0xed, 0x45, 0xef, 0xa8, 0xb7, 0x61, 0xf8, + 0xe8, 0x74, 0xbe, 0x83, 0xa1, 0x81, 0x08, 0x41, 0x3f, 0xc9, 0x53, 0xaa, 0xb3, 0x4f, 0xb1, 0x3e, + 0xa3, 0x4f, 0x61, 0x5c, 0x90, 0x92, 0x64, 0x54, 0xd2, 0x52, 0xd7, 0x34, 0xc5, 0x2d, 0x70, 0x56, + 0x30, 0x34, 0x1d, 0x40, 0x5f, 0x42, 0x5f, 0xd6, 0x45, 0xf3, 0xe3, 0xd9, 0xf3, 0x07, 0x9d, 0xe6, + 0x84, 0x75, 0x41, 0xb1, 0x76, 0xaa, 0x1b, 0x52, 0x22, 0x89, 0x49, 0xa4, 0xcf, 0xce, 0x6b, 0x18, + 0xad, 0x73, 0xc6, 0x63, 0x22, 0x28, 0x7a, 0x0c, 0x03, 0x41, 0x79, 0x4a, 0x4b, 0xa3, 0xc1, 0x58, + 0x4a, 0x45, 0x49, 0x13, 0x56, 0x30, 0xca, 0xe5, 0x41, 0xc5, 0x11, 0xa8, 0x5f, 0x91, 0x2c, 0xaf, + 0xb8, 0x34, 0x0d, 0x36, 0x96, 0xf3, 0x12, 0x26, 0x01, 0xdb, 0xae, 0x7f, 0x23, 0x8c, 0x87, 0x7b, + 0x8e, 0x3e, 0x81, 0xb1, 0x60, 0xdb, 0x28, 0x51, 0xb6, 0xc9, 0x3f, 0x12, 0xc6, 0xaf, 0x6e, 0x10, + 0x55, 0x9c, 0x31, 0xd9, 0xa9, 0xf3, 0x08, 0x9c, 0x0c, 0xa6, 0x98, 0x6e, 0x99, 0x90, 0xb4, 0xf4, + 0x49, 0xa6, 0xa7, 0x57, 0x6a, 0xbb, 0x24, 0x5c, 0x9a, 0x5c, 0x1d, 0xa2, 0xea, 0xe4, 0x24, 0x6b, + 0x96, 0x60, 0x8c, 0xf5, 0x19, 0x7d, 0x0d, 0x67, 0x87, 0x08, 0x35, 0xd2, 0xa8, 0x5d, 0x88, 0x07, + 0x5d, 0xfe, 0x82, 0x52, 0xe7, 0x57, 0x98, 0xea, 0xe1, 0xdf, 0x9a, 0xeb, 0x0e, 0xe9, 0xac, 0x4e, + 0xba, 0xbb, 0x12, 0xec, 0x7f, 0x49, 0xb8, 0xd3, 0xb2, 0xde, 0x3b, 0x2d, 0x73, 0xbe, 0x07, 0xb8, + 0xa2, 0x3b, 0x2a, 0xe9, 0xfb, 0x96, 0xe3, 0xfc, 0x65, 0xc1, 0x38, 0xa8, 0x62, 0x91, 0x94, 0x2c, + 0xd6, 0x19, 0xc4, 0xc1, 0x38, 0x0c, 0xaf, 0x43, 0x94, 0x9f, 0xa5, 0x94, 0x4b, 0x76, 0xcb, 0x4c, + 0x7f, 0xc7, 0xb8, 0x43, 0xd4, 0xb3, 0x91, 0x79, 0xc1, 0x12, 0xad, 0x74, 0x8c, 0x1b, 0x03, 0x3d, + 0x81, 0x41, 0x5c, 0x25, 0x6f, 0xa9, 0xd4, 0x0f, 0xe4, 0x74, 0x65, 0xcf, 0x2d, 0x6c, 0x08, 0x7a, + 0x02, 0xa3, 0xb4, 0x6a, 0x5a, 0x36, 0x3f, 0x51, 0x5e, 0x7c, 0xb4, 0x95, 0xde, 0x8c, 0x4a, 0x32, + 0x1f, 0x34, 0x7a, 0xd5, 0xd9, 0x49, 0x60, 0xb2, 0xe1, 0xe2, 0xc3, 0x0a, 0x76, 0x7e, 0x81, 0xd3, + 0xc3, 0xe0, 0x96, 0x42, 0x50, 0xf9, 0x3f, 0x2f, 0xf4, 0xcf, 0x00, 0xd7, 0x94, 0xd3, 0x92, 0x48, + 0xea, 0x5d, 0xa1, 0xcf, 0x00, 0x8a, 0x2a, 0xde, 0xb1, 0x24, 0x7a, 0x4b, 0x6b, 0x93, 0x7f, 0xdc, + 0x90, 0x1f, 0x68, 0x7d, 0xef, 0xbe, 0xd9, 0xf7, 0xef, 0xdb, 0xdf, 0x16, 0x0c, 0x7d, 0xc2, 0xf3, + 0x1b, 0x52, 0xbf, 0xa7, 0xe2, 0x19, 0xd8, 0x2c, 0xd5, 0x6a, 0xfb, 0xd8, 0x66, 0x69, 0xa7, 0x82, + 0x7e, 0xb7, 0x02, 0xf4, 0x14, 0x66, 0x72, 0xcf, 0x23, 0xba, 0x2f, 0xd8, 0x9d, 0xd9, 0x9d, 0xca, + 0x3d, 0x77, 0x8f, 0x10, 0x5d, 0xc2, 0x23, 0x4e, 0x78, 0x1e, 0x15, 0xa4, 0xee, 0xc6, 0x0e, 0x74, + 0xec, 0x43, 0xde, 0x48, 0x6d, 0xe3, 0x9d, 0x3f, 0x2d, 0x00, 0x4f, 0x88, 0x8a, 0xfe, 0x77, 0xd7, + 0xef, 0x7b, 0x96, 0x2a, 0xb6, 0xce, 0xe2, 0x7c, 0x67, 0x26, 0x69, 0x2c, 0xf4, 0x05, 0x4c, 0x65, + 0x2e, 0xc9, 0x2e, 0x12, 0x55, 0x51, 0xec, 0x6a, 0x53, 0xc7, 0x44, 0xb3, 0x40, 0x23, 0xfd, 0x6d, + 0x54, 0x2d, 0x10, 0x6d, 0x1d, 0x2d, 0xf8, 0xe6, 0x0f, 0x1b, 0x26, 0x9d, 0x2f, 0x20, 0x7a, 0x08, + 0xa7, 0xeb, 0x57, 0x9e, 0xbf, 0x5a, 0x06, 0x6e, 0x14, 0xbe, 0xb9, 0x71, 0xcf, 0x3e, 0x42, 0x1f, + 0xc3, 0xa3, 0x10, 0x2f, 0xfd, 0xe0, 0x85, 0x8b, 0xa3, 0x65, 0x10, 0xb8, 0x61, 0xe3, 0xb0, 0xd0, + 0x63, 0x40, 0x81, 0x77, 0x1d, 0xad, 0x5f, 0x2e, 0x3d, 0x3f, 0x0a, 0x5f, 0xfb, 0x0d, 0xb7, 0x15, + 0xc7, 0xee, 0xb5, 0x17, 0x84, 0x2e, 0x8e, 0xfc, 0xe5, 0x4f, 0x26, 0x51, 0x4f, 0xf1, 0x63, 0xa2, + 0x96, 0xf7, 0xd1, 0x39, 0x9c, 0x5d, 0xb9, 0x3f, 0xba, 0xa1, 0xdb, 0xa1, 0x27, 0x08, 0xc1, 0x2c, + 0xd8, 0xac, 0x82, 0x35, 0xf6, 0x56, 0x86, 0x0d, 0x54, 0xe4, 0xc6, 0x7f, 0x87, 0x0e, 0x15, 0xbd, + 0x76, 0x7d, 0x17, 0x2f, 0x43, 0x37, 0xf2, 0xae, 0x1a, 0x3a, 0x52, 0x95, 0xf8, 0x4b, 0xff, 0x55, + 0x74, 0xb3, 0x7c, 0xd3, 0xa0, 0xb1, 0x0a, 0xf4, 0x82, 0x60, 0xe3, 0x76, 0xcb, 0x80, 0x78, 0xa0, + 0xff, 0x4c, 0xbf, 0xfd, 0x27, 0x00, 0x00, 0xff, 0xff, 0x38, 0x07, 0xb4, 0xac, 0x64, 0x07, 0x00, + 0x00, } diff --git a/pb/transaction.proto b/pb/transaction.proto index 95a054fb5..e92004cd2 100644 --- a/pb/transaction.proto +++ b/pb/transaction.proto @@ -2,19 +2,6 @@ syntax = "proto3"; package pb; -import "github.com/gogo/protobuf/gogoproto/gogo.proto"; - -option (gogoproto.gostring_all) = true; -option (gogoproto.goproto_stringer_all) = false; -option (gogoproto.stringer_all) = true; -option (gogoproto.marshaler_all) = true; -option (gogoproto.sizer_all) = true; -option (gogoproto.unmarshaler_all) = true; - -option (gogoproto.testgen_all) = true; -option (gogoproto.equal_all) = true; -option (gogoproto.populate_all) = true; - message UnsignedTx { Payload payload = 1; uint64 nonce = 2; diff --git a/pb/transactionpb_test.go b/pb/transactionpb_test.go deleted file mode 100644 index dbf6613f1..000000000 --- a/pb/transactionpb_test.go +++ /dev/null @@ -1,2213 +0,0 @@ -// Code generated by protoc-gen-gogo. DO NOT EDIT. -// source: pb/transaction.proto - -package pb - -import testing "testing" -import math_rand "math/rand" -import time "time" -import github_com_gogo_protobuf_proto "github.com/gogo/protobuf/proto" -import github_com_gogo_protobuf_jsonpb "github.com/gogo/protobuf/jsonpb" -import fmt "fmt" -import go_parser "go/parser" -import proto "github.com/gogo/protobuf/proto" -import math "math" -import _ "github.com/gogo/protobuf/gogoproto" - -// Reference imports to suppress errors if they are not otherwise used. -var _ = proto.Marshal -var _ = fmt.Errorf -var _ = math.Inf - -func TestUnsignedTxProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedTx(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedTx{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestUnsignedTxMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedTx(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedTx{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransactionProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransaction(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Transaction{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestTransactionMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransaction(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Transaction{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestProgramProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedProgram(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Program{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestProgramMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedProgram(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Program{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestPayloadProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPayload(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Payload{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestPayloadMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPayload(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Payload{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestCoinbaseProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedCoinbase(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Coinbase{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestCoinbaseMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedCoinbase(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Coinbase{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainTxnProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainTxn(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChainTxn{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestSigChainTxnMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainTxn(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChainTxn{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRegisterNameProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRegisterName(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RegisterName{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestRegisterNameMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRegisterName(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RegisterName{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransferNameProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferName(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &TransferName{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestTransferNameMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferName(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &TransferName{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestDeleteNameProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDeleteName(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &DeleteName{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestDeleteNameMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDeleteName(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &DeleteName{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSubscribeProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSubscribe(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Subscribe{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestSubscribeMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSubscribe(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Subscribe{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsubscribeProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsubscribe(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Unsubscribe{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestUnsubscribeMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsubscribe(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Unsubscribe{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransferAssetProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferAsset(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &TransferAsset{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestTransferAssetMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferAsset(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &TransferAsset{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGenerateIDProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGenerateID(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GenerateID{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestGenerateIDMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGenerateID(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GenerateID{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNanoPayProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNanoPay(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &NanoPay{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestNanoPayMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNanoPay(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &NanoPay{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIssueAssetProto(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIssueAsset(popr, false) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IssueAsset{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - littlefuzz := make([]byte, len(dAtA)) - copy(littlefuzz, dAtA) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } - if len(littlefuzz) > 0 { - fuzzamount := 100 - for i := 0; i < fuzzamount; i++ { - littlefuzz[popr.Intn(len(littlefuzz))] = byte(popr.Intn(256)) - littlefuzz = append(littlefuzz, byte(popr.Intn(256))) - } - // shouldn't panic - _ = github_com_gogo_protobuf_proto.Unmarshal(littlefuzz, msg) - } -} - -func TestIssueAssetMarshalTo(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIssueAsset(popr, false) - size := p.Size() - dAtA := make([]byte, size) - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - _, err := p.MarshalTo(dAtA) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IssueAsset{} - if err := github_com_gogo_protobuf_proto.Unmarshal(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - for i := range dAtA { - dAtA[i] = byte(popr.Intn(256)) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedTxJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedTx(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &UnsignedTx{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestTransactionJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransaction(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Transaction{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestProgramJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedProgram(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Program{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestPayloadJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPayload(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Payload{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestCoinbaseJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedCoinbase(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Coinbase{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestSigChainTxnJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainTxn(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &SigChainTxn{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestRegisterNameJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRegisterName(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &RegisterName{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestTransferNameJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferName(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &TransferName{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestDeleteNameJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDeleteName(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &DeleteName{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestSubscribeJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSubscribe(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Subscribe{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestUnsubscribeJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsubscribe(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &Unsubscribe{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestTransferAssetJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferAsset(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &TransferAsset{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestGenerateIDJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGenerateID(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &GenerateID{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestNanoPayJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNanoPay(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &NanoPay{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestIssueAssetJSON(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIssueAsset(popr, true) - marshaler := github_com_gogo_protobuf_jsonpb.Marshaler{} - jsondata, err := marshaler.MarshalToString(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - msg := &IssueAsset{} - err = github_com_gogo_protobuf_jsonpb.UnmarshalString(jsondata, msg) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Json Equal %#v", seed, msg, p) - } -} -func TestUnsignedTxProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedTx(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &UnsignedTx{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedTxProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedTx(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &UnsignedTx{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransactionProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransaction(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Transaction{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransactionProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransaction(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Transaction{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestProgramProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedProgram(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Program{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestProgramProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedProgram(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Program{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestPayloadProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPayload(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Payload{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestPayloadProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPayload(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Payload{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestCoinbaseProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedCoinbase(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Coinbase{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestCoinbaseProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedCoinbase(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Coinbase{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainTxnProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainTxn(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &SigChainTxn{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSigChainTxnProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainTxn(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &SigChainTxn{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRegisterNameProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRegisterName(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &RegisterName{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestRegisterNameProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRegisterName(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &RegisterName{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransferNameProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferName(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &TransferName{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransferNameProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferName(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &TransferName{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestDeleteNameProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDeleteName(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &DeleteName{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestDeleteNameProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDeleteName(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &DeleteName{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSubscribeProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSubscribe(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Subscribe{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestSubscribeProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSubscribe(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Subscribe{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsubscribeProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsubscribe(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &Unsubscribe{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsubscribeProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsubscribe(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &Unsubscribe{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransferAssetProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferAsset(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &TransferAsset{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestTransferAssetProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferAsset(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &TransferAsset{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGenerateIDProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGenerateID(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &GenerateID{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestGenerateIDProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGenerateID(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &GenerateID{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNanoPayProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNanoPay(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &NanoPay{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestNanoPayProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNanoPay(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &NanoPay{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIssueAssetProtoText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIssueAsset(popr, true) - dAtA := github_com_gogo_protobuf_proto.MarshalTextString(p) - msg := &IssueAsset{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestIssueAssetProtoCompactText(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIssueAsset(popr, true) - dAtA := github_com_gogo_protobuf_proto.CompactTextString(p) - msg := &IssueAsset{} - if err := github_com_gogo_protobuf_proto.UnmarshalText(dAtA, msg); err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - if !p.Equal(msg) { - t.Fatalf("seed = %d, %#v !Proto %#v", seed, msg, p) - } -} - -func TestUnsignedTxGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsignedTx(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestTransactionGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransaction(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestProgramGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedProgram(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestPayloadGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedPayload(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestCoinbaseGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedCoinbase(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestSigChainTxnGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSigChainTxn(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestRegisterNameGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRegisterName(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestTransferNameGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransferName(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestDeleteNameGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedDeleteName(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestSubscribeGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSubscribe(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestUnsubscribeGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsubscribe(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestTransferAssetGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransferAsset(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestGenerateIDGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGenerateID(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestNanoPayGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedNanoPay(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestIssueAssetGoString(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedIssueAsset(popr, false) - s1 := p.GoString() - s2 := fmt.Sprintf("%#v", p) - if s1 != s2 { - t.Fatalf("GoString want %v got %v", s1, s2) - } - _, err := go_parser.ParseExpr(s1) - if err != nil { - t.Fatal(err) - } -} -func TestUnsignedTxSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsignedTx(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestTransactionSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransaction(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestProgramSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedProgram(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestPayloadSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedPayload(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestCoinbaseSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedCoinbase(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestSigChainTxnSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSigChainTxn(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestRegisterNameSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedRegisterName(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestTransferNameSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferName(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestDeleteNameSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedDeleteName(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestSubscribeSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedSubscribe(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestUnsubscribeSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedUnsubscribe(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestTransferAssetSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedTransferAsset(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestGenerateIDSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedGenerateID(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestNanoPaySize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedNanoPay(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestIssueAssetSize(t *testing.T) { - seed := time.Now().UnixNano() - popr := math_rand.New(math_rand.NewSource(seed)) - p := NewPopulatedIssueAsset(popr, true) - size2 := github_com_gogo_protobuf_proto.Size(p) - dAtA, err := github_com_gogo_protobuf_proto.Marshal(p) - if err != nil { - t.Fatalf("seed = %d, err = %v", seed, err) - } - size := p.Size() - if len(dAtA) != size { - t.Errorf("seed = %d, size %v != marshalled size %v", seed, size, len(dAtA)) - } - if size2 != size { - t.Errorf("seed = %d, size %v != before marshal proto.Size %v", seed, size, size2) - } - size3 := github_com_gogo_protobuf_proto.Size(p) - if size3 != size { - t.Errorf("seed = %d, size %v != after marshal proto.Size %v", seed, size, size3) - } -} - -func TestUnsignedTxStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsignedTx(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestTransactionStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransaction(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestProgramStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedProgram(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestPayloadStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedPayload(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestCoinbaseStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedCoinbase(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestSigChainTxnStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSigChainTxn(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestRegisterNameStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedRegisterName(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestTransferNameStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransferName(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestDeleteNameStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedDeleteName(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestSubscribeStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedSubscribe(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestUnsubscribeStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedUnsubscribe(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestTransferAssetStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedTransferAsset(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestGenerateIDStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedGenerateID(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestNanoPayStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedNanoPay(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} -func TestIssueAssetStringer(t *testing.T) { - popr := math_rand.New(math_rand.NewSource(time.Now().UnixNano())) - p := NewPopulatedIssueAsset(popr, false) - s1 := p.String() - s2 := fmt.Sprintf("%v", p) - if s1 != s2 { - t.Fatalf("String want %v got %v", s1, s2) - } -} - -//These tests are generated by github.com/gogo/protobuf/plugin/testgen diff --git a/por/porpackage.go b/por/porpackage.go index 8a6821b5c..c323c004a 100644 --- a/por/porpackage.go +++ b/por/porpackage.go @@ -4,7 +4,7 @@ import ( "bytes" "errors" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/config" "github.com/nknorg/nkn/v2/pb" @@ -55,7 +55,7 @@ func (c PorPackages) Less(i, j int) bool { } func NewPorPackage(txn *transaction.Transaction, shouldVerify bool) (*PorPackage, error) { - if txn.UnsignedTx.Payload.Type != pb.SIG_CHAIN_TXN_TYPE { + if txn.UnsignedTx.Payload.Type != pb.PayloadType_SIG_CHAIN_TXN_TYPE { return nil, errors.New("Transaction type should be sigchain") } diff --git a/por/porserver.go b/por/porserver.go index bcb9ee033..c0ae8cdda 100644 --- a/por/porserver.go +++ b/por/porserver.go @@ -167,10 +167,10 @@ func (ps *PorServer) UpdateRelayMessage(relayMessage *pb.Relay, nextPubkey, prev return err } - sigAlgo := pb.HASH + sigAlgo := pb.SigAlgo_HASH if height, err := Store.GetHeightByBlockHash(blockHash); err == nil { if !config.AllowSigChainHashSignature.GetValueAtHeight(height) { - sigAlgo = pb.SIGNATURE + sigAlgo = pb.SigAlgo_SIGNATURE } } @@ -497,12 +497,12 @@ func (ps *PorServer) BacktrackSigChain(elems []*pb.SigChainElem, hash, senderPub var signature []byte switch scei.sigAlgo { - case pb.SIGNATURE: + case pb.SigAlgo_SIGNATURE: signature, err = crypto.Sign(ps.account.PrivKey(), hash) if err != nil { return nil, nil, nil, fmt.Errorf("sign error: %v", err) } - case pb.HASH: + case pb.SigAlgo_HASH: signature = hash default: return nil, nil, nil, fmt.Errorf("unknown sigAlgo: %v", scei.sigAlgo) diff --git a/por/sigchain.go b/por/sigchain.go index a31e7c4dd..4a4d7741f 100644 --- a/por/sigchain.go +++ b/por/sigchain.go @@ -78,8 +78,8 @@ func VerifySigChainMeta(sc *pb.SigChain, height uint32) error { } } if !config.AllowSigChainHashSignature.GetValueAtHeight(height) { - if e.SigAlgo != pb.SIGNATURE { - return fmt.Errorf("sigchain elem %d sig algo should be %v", i, pb.SIGNATURE) + if e.SigAlgo != pb.SigAlgo_SIGNATURE { + return fmt.Errorf("sigchain elem %d sig algo should be %v", i, pb.SigAlgo_SIGNATURE) } } } @@ -114,12 +114,12 @@ func VerifySigChainSignatures(sc *pb.SigChain) error { } switch e.SigAlgo { - case pb.SIGNATURE: + case pb.SigAlgo_SIGNATURE: err = crypto.Verify(prevNextPubkey, hash, e.Signature) if err != nil { return fmt.Errorf("signature %x is invalid: %v", e.Signature, err) } - case pb.HASH: + case pb.SigAlgo_HASH: if !bytes.Equal(e.Signature, hash) { return fmt.Errorf("signature %x is different from expected value %x", e.Signature, hash[:]) } diff --git a/transaction/payload.go b/transaction/payload.go index faf1f582e..4db34e4ec 100644 --- a/transaction/payload.go +++ b/transaction/payload.go @@ -3,65 +3,65 @@ package transaction import ( "errors" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/pb" ) -type IPayload interface { - Marshal() (data []byte, err error) - Unmarshal(data []byte) error -} - -func Pack(plType pb.PayloadType, payload IPayload) (*pb.Payload, error) { - data, err := payload.Marshal() +func Pack(plType pb.PayloadType, payload proto.Message) (*pb.Payload, error) { + data, err := proto.Marshal(payload) return &pb.Payload{ Type: plType, Data: data, }, err } -func Unpack(payload *pb.Payload) (IPayload, error) { - var pl IPayload +func Unpack(payload *pb.Payload) (proto.Message, error) { + var m proto.Message switch payload.Type { - case pb.COINBASE_TYPE: - pl = new(pb.Coinbase) - case pb.TRANSFER_ASSET_TYPE: - pl = new(pb.TransferAsset) - case pb.SIG_CHAIN_TXN_TYPE: - pl = new(pb.SigChainTxn) - case pb.REGISTER_NAME_TYPE: - pl = new(pb.RegisterName) - case pb.TRANSFER_NAME_TYPE: - pl = new(pb.TransferName) - case pb.DELETE_NAME_TYPE: - pl = new(pb.DeleteName) - case pb.SUBSCRIBE_TYPE: - pl = new(pb.Subscribe) - case pb.UNSUBSCRIBE_TYPE: - pl = new(pb.Unsubscribe) - case pb.GENERATE_ID_TYPE: - pl = new(pb.GenerateID) - case pb.NANO_PAY_TYPE: - pl = new(pb.NanoPay) - case pb.ISSUE_ASSET_TYPE: - pl = new(pb.IssueAsset) + case pb.PayloadType_COINBASE_TYPE: + m = new(pb.Coinbase) + case pb.PayloadType_TRANSFER_ASSET_TYPE: + m = new(pb.TransferAsset) + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: + m = new(pb.SigChainTxn) + case pb.PayloadType_REGISTER_NAME_TYPE: + m = new(pb.RegisterName) + case pb.PayloadType_TRANSFER_NAME_TYPE: + m = new(pb.TransferName) + case pb.PayloadType_DELETE_NAME_TYPE: + m = new(pb.DeleteName) + case pb.PayloadType_SUBSCRIBE_TYPE: + m = new(pb.Subscribe) + case pb.PayloadType_UNSUBSCRIBE_TYPE: + m = new(pb.Unsubscribe) + case pb.PayloadType_GENERATE_ID_TYPE: + m = new(pb.GenerateID) + case pb.PayloadType_NANO_PAY_TYPE: + m = new(pb.NanoPay) + case pb.PayloadType_ISSUE_ASSET_TYPE: + m = new(pb.IssueAsset) default: return nil, errors.New("invalid payload type") } - err := pl.Unmarshal(payload.Data) + err := proto.Unmarshal(payload.Data, m) + if err != nil { + return nil, err + } - return pl, err + return m, nil } -func NewCoinbase(sender, recipient common.Uint160, amount common.Fixed64) IPayload { +func NewCoinbase(sender, recipient common.Uint160, amount common.Fixed64) *pb.Coinbase { return &pb.Coinbase{ Sender: sender.ToArray(), Recipient: recipient.ToArray(), Amount: int64(amount), } } -func NewTransferAsset(sender, recipient common.Uint160, amount common.Fixed64) IPayload { + +func NewTransferAsset(sender, recipient common.Uint160, amount common.Fixed64) *pb.TransferAsset { return &pb.TransferAsset{ Sender: sender.ToArray(), Recipient: recipient.ToArray(), @@ -69,13 +69,14 @@ func NewTransferAsset(sender, recipient common.Uint160, amount common.Fixed64) I } } -func NewSigChainTxn(sigChain []byte, submitter common.Uint160) IPayload { +func NewSigChainTxn(sigChain []byte, submitter common.Uint160) *pb.SigChainTxn { return &pb.SigChainTxn{ SigChain: sigChain, Submitter: submitter.ToArray(), } } -func NewRegisterName(registrant []byte, name string, fee int64) IPayload { + +func NewRegisterName(registrant []byte, name string, fee int64) *pb.RegisterName { return &pb.RegisterName{ Registrant: registrant, Name: name, @@ -83,7 +84,7 @@ func NewRegisterName(registrant []byte, name string, fee int64) IPayload { } } -func NewTransferName(registrant []byte, receipt []byte, name string) IPayload { +func NewTransferName(registrant []byte, receipt []byte, name string) *pb.TransferName { return &pb.TransferName{ Registrant: registrant, Recipient: receipt, @@ -91,14 +92,14 @@ func NewTransferName(registrant []byte, receipt []byte, name string) IPayload { } } -func NewDeleteName(registrant []byte, name string) IPayload { +func NewDeleteName(registrant []byte, name string) *pb.DeleteName { return &pb.DeleteName{ Registrant: registrant, Name: name, } } -func NewSubscribe(subscriber []byte, id, topic string, duration uint32, meta string) IPayload { +func NewSubscribe(subscriber []byte, id, topic string, duration uint32, meta string) *pb.Subscribe { return &pb.Subscribe{ Subscriber: subscriber, Identifier: id, @@ -108,7 +109,7 @@ func NewSubscribe(subscriber []byte, id, topic string, duration uint32, meta str } } -func NewUnsubscribe(subscriber []byte, id, topic string) IPayload { +func NewUnsubscribe(subscriber []byte, id, topic string) *pb.Unsubscribe { return &pb.Unsubscribe{ Subscriber: subscriber, Identifier: id, @@ -116,14 +117,14 @@ func NewUnsubscribe(subscriber []byte, id, topic string) IPayload { } } -func NewGenerateID(publicKey []byte, regFee common.Fixed64) IPayload { +func NewGenerateID(publicKey []byte, regFee common.Fixed64) *pb.GenerateID { return &pb.GenerateID{ PublicKey: publicKey, RegistrationFee: int64(regFee), } } -func NewNanoPay(sender, recipient common.Uint160, id uint64, amount common.Fixed64, txnExpiration, nanoPayExpiration uint32) IPayload { +func NewNanoPay(sender, recipient common.Uint160, id uint64, amount common.Fixed64, txnExpiration, nanoPayExpiration uint32) *pb.NanoPay { return &pb.NanoPay{ Sender: sender.ToArray(), Recipient: recipient.ToArray(), @@ -134,7 +135,7 @@ func NewNanoPay(sender, recipient common.Uint160, id uint64, amount common.Fixed } } -func NewIssueAsset(sender common.Uint160, name, symbol string, precision uint32, totalSupply common.Fixed64) IPayload { +func NewIssueAsset(sender common.Uint160, name, symbol string, precision uint32, totalSupply common.Fixed64) *pb.IssueAsset { return &pb.IssueAsset{ Sender: sender.ToArray(), Name: name, diff --git a/transaction/transaction.go b/transaction/transaction.go index 126e80b0a..076389404 100644 --- a/transaction/transaction.go +++ b/transaction/transaction.go @@ -7,7 +7,7 @@ import ( "errors" "io" - "github.com/gogo/protobuf/proto" + "github.com/golang/protobuf/proto" "github.com/nknorg/nkn/v2/common" "github.com/nknorg/nkn/v2/common/serialization" "github.com/nknorg/nkn/v2/pb" @@ -115,61 +115,61 @@ func (tx *Transaction) GetProgramHashes() ([]common.Uint160, error) { } switch tx.UnsignedTx.Payload.Type { - case pb.SIG_CHAIN_TXN_TYPE: + case pb.PayloadType_SIG_CHAIN_TXN_TYPE: sender := payload.(*pb.SigChainTxn).Submitter hashes = append(hashes, common.BytesToUint160(sender)) - case pb.TRANSFER_ASSET_TYPE: + case pb.PayloadType_TRANSFER_ASSET_TYPE: sender := payload.(*pb.TransferAsset).Sender hashes = append(hashes, common.BytesToUint160(sender)) - case pb.COINBASE_TYPE: + case pb.PayloadType_COINBASE_TYPE: sender := payload.(*pb.Coinbase).Sender hashes = append(hashes, common.BytesToUint160(sender)) - case pb.REGISTER_NAME_TYPE: + case pb.PayloadType_REGISTER_NAME_TYPE: publicKey := payload.(*pb.RegisterName).Registrant programhash, err := program.CreateProgramHash(publicKey) if err != nil { return nil, err } hashes = append(hashes, programhash) - case pb.TRANSFER_NAME_TYPE: + case pb.PayloadType_TRANSFER_NAME_TYPE: publicKey := payload.(*pb.TransferName).Registrant programhash, err := program.CreateProgramHash(publicKey) if err != nil { return nil, err } hashes = append(hashes, programhash) - case pb.DELETE_NAME_TYPE: + case pb.PayloadType_DELETE_NAME_TYPE: publicKey := payload.(*pb.DeleteName).Registrant programhash, err := program.CreateProgramHash(publicKey) if err != nil { return nil, err } hashes = append(hashes, programhash) - case pb.SUBSCRIBE_TYPE: + case pb.PayloadType_SUBSCRIBE_TYPE: publicKey := payload.(*pb.Subscribe).Subscriber programhash, err := program.CreateProgramHash(publicKey) if err != nil { return nil, err } hashes = append(hashes, programhash) - case pb.UNSUBSCRIBE_TYPE: + case pb.PayloadType_UNSUBSCRIBE_TYPE: publicKey := payload.(*pb.Unsubscribe).Subscriber programhash, err := program.CreateProgramHash(publicKey) if err != nil { return nil, err } hashes = append(hashes, programhash) - case pb.GENERATE_ID_TYPE: + case pb.PayloadType_GENERATE_ID_TYPE: publicKey := payload.(*pb.GenerateID).PublicKey programhash, err := program.CreateProgramHash(publicKey) if err != nil { return nil, err } hashes = append(hashes, programhash) - case pb.NANO_PAY_TYPE: + case pb.PayloadType_NANO_PAY_TYPE: sender := payload.(*pb.NanoPay).Sender hashes = append(hashes, common.BytesToUint160(sender)) - case pb.ISSUE_ASSET_TYPE: + case pb.PayloadType_ISSUE_ASSET_TYPE: sender := payload.(*pb.IssueAsset).Sender hashes = append(hashes, common.BytesToUint160(sender)) default: @@ -218,7 +218,7 @@ func (tx *Transaction) SetHash(hash common.Uint256) { } func (txn *Transaction) VerifySignature() error { - if txn.UnsignedTx.Payload.Type == pb.COINBASE_TYPE { + if txn.UnsignedTx.Payload.Type == pb.PayloadType_COINBASE_TYPE { return nil } diff --git a/transaction/txBuilder.go b/transaction/txBuilder.go index b4966dc32..bbd6ce51c 100644 --- a/transaction/txBuilder.go +++ b/transaction/txBuilder.go @@ -12,7 +12,7 @@ const ( func NewTransferAssetTransaction(sender, recipient common.Uint160, nonce uint64, value, fee common.Fixed64) (*Transaction, error) { payload := NewTransferAsset(sender, recipient, value) - pl, err := Pack(pb.TRANSFER_ASSET_TYPE, payload) + pl, err := Pack(pb.PayloadType_TRANSFER_ASSET_TYPE, payload) if err != nil { return nil, err } @@ -26,7 +26,7 @@ func NewTransferAssetTransaction(sender, recipient common.Uint160, nonce uint64, func NewSigChainTransaction(sigChain []byte, submitter common.Uint160, nonce uint64) (*Transaction, error) { payload := NewSigChainTxn(sigChain, submitter) - pl, err := Pack(pb.SIG_CHAIN_TXN_TYPE, payload) + pl, err := Pack(pb.PayloadType_SIG_CHAIN_TXN_TYPE, payload) if err != nil { return nil, err } @@ -40,7 +40,7 @@ func NewSigChainTransaction(sigChain []byte, submitter common.Uint160, nonce uin func NewRegisterNameTransaction(registrant []byte, name string, nonce uint64, regFee common.Fixed64, fee common.Fixed64) (*Transaction, error) { payload := NewRegisterName(registrant, name, int64(regFee)) - pl, err := Pack(pb.REGISTER_NAME_TYPE, payload) + pl, err := Pack(pb.PayloadType_REGISTER_NAME_TYPE, payload) if err != nil { return nil, err } @@ -54,7 +54,7 @@ func NewRegisterNameTransaction(registrant []byte, name string, nonce uint64, re func NewTransferNameTransaction(registrant []byte, to []byte, name string, nonce uint64, fee common.Fixed64) (*Transaction, error) { payload := NewTransferName(registrant, to, name) - pl, err := Pack(pb.TRANSFER_NAME_TYPE, payload) + pl, err := Pack(pb.PayloadType_TRANSFER_NAME_TYPE, payload) if err != nil { return nil, err } @@ -68,7 +68,7 @@ func NewTransferNameTransaction(registrant []byte, to []byte, name string, nonce func NewDeleteNameTransaction(registrant []byte, name string, nonce uint64, fee common.Fixed64) (*Transaction, error) { payload := NewDeleteName(registrant, name) - pl, err := Pack(pb.DELETE_NAME_TYPE, payload) + pl, err := Pack(pb.PayloadType_DELETE_NAME_TYPE, payload) if err != nil { return nil, err } @@ -82,7 +82,7 @@ func NewDeleteNameTransaction(registrant []byte, name string, nonce uint64, fee func NewSubscribeTransaction(subscriber []byte, identifier string, topic string, duration uint32, meta string, nonce uint64, fee common.Fixed64) (*Transaction, error) { payload := NewSubscribe(subscriber, identifier, topic, duration, meta) - pl, err := Pack(pb.SUBSCRIBE_TYPE, payload) + pl, err := Pack(pb.PayloadType_SUBSCRIBE_TYPE, payload) if err != nil { return nil, err } @@ -96,7 +96,7 @@ func NewSubscribeTransaction(subscriber []byte, identifier string, topic string, func NewUnsubscribeTransaction(subscriber []byte, identifier string, topic string, nonce uint64, fee common.Fixed64) (*Transaction, error) { payload := NewUnsubscribe(subscriber, identifier, topic) - pl, err := Pack(pb.UNSUBSCRIBE_TYPE, payload) + pl, err := Pack(pb.PayloadType_UNSUBSCRIBE_TYPE, payload) if err != nil { return nil, err } @@ -110,7 +110,7 @@ func NewUnsubscribeTransaction(subscriber []byte, identifier string, topic strin func NewGenerateIDTransaction(publicKey []byte, regFee common.Fixed64, nonce uint64, fee common.Fixed64, attrs []byte) (*Transaction, error) { payload := NewGenerateID(publicKey, regFee) - pl, err := Pack(pb.GENERATE_ID_TYPE, payload) + pl, err := Pack(pb.PayloadType_GENERATE_ID_TYPE, payload) if err != nil { return nil, err } @@ -124,7 +124,7 @@ func NewGenerateIDTransaction(publicKey []byte, regFee common.Fixed64, nonce uin func NewNanoPayTransaction(sender, recipient common.Uint160, id uint64, amount common.Fixed64, txnExpiration, nanoPayExpiration uint32) (*Transaction, error) { payload := NewNanoPay(sender, recipient, id, amount, txnExpiration, nanoPayExpiration) - pl, err := Pack(pb.NANO_PAY_TYPE, payload) + pl, err := Pack(pb.PayloadType_NANO_PAY_TYPE, payload) if err != nil { return nil, err } @@ -138,7 +138,7 @@ func NewNanoPayTransaction(sender, recipient common.Uint160, id uint64, amount c func NewIssueAssetTransaction(sender common.Uint160, name, symbol string, totalSupply common.Fixed64, precision uint32, nonce uint64, fee common.Fixed64) (*Transaction, error) { payload := NewIssueAsset(sender, name, symbol, precision, totalSupply) - pl, err := Pack(pb.ISSUE_ASSET_TYPE, payload) + pl, err := Pack(pb.PayloadType_ISSUE_ASSET_TYPE, payload) if err != nil { return nil, err }