github.com/amazechain/amc@v0.1.3/api/protocol/sync_proto/sync.proto (about) 1 // Copyright 2022 The AmazeChain Authors 2 // This file is part of the AmazeChain library. 3 // 4 // The AmazeChain library is free software: you can redistribute it and/or modify 5 // it under the terms of the GNU Lesser General Public License as published by 6 // the Free Software Foundation, either version 3 of the License, or 7 // (at your option) any later version. 8 // 9 // The AmazeChain library is distributed in the hope that it will be useful, 10 // but WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 // GNU Lesser General Public License for more details. 13 // 14 // You should have received a copy of the GNU Lesser General Public License 15 // along with the AmazeChain library. If not, see <http://www.gnu.org/licenses/>. 16 17 syntax = "proto3"; 18 package sync_proto; 19 option go_package = "github.com/amazechain/amc/api/protocol/sync_proto"; 20 21 import "types_pb/types.proto"; 22 23 message SyncProtocol { 24 25 } 26 27 28 enum SyncType { 29 FINDReq = 0; 30 FindRes = 1; 31 HeaderReq = 2; 32 HeaderRes = 3; 33 BodyReq = 4; 34 BodyRes = 5; 35 StateReq = 6; 36 StateRes = 7; 37 TransactionReq = 8; 38 TransactionRes = 9; 39 PeerInfoBroadcast = 10; 40 } 41 42 message Value { 43 string hash = 1; 44 uint64 height = 2; 45 } 46 47 message SyncBlockRequest { 48 repeated types_pb.H256 number = 1; 49 } 50 51 message SyncBlockResponse { 52 repeated types_pb.Block blocks = 1; 53 } 54 55 message SyncHeaderRequest { 56 types_pb.H256 number = 1; 57 types_pb.H256 amount = 3; 58 } 59 60 message SyncHeaderResponse { 61 repeated types_pb.Header headers = 1; 62 } 63 64 message SyncTransactionRequest { 65 bytes bloom = 1; 66 } 67 68 message SyncTransactionResponse { 69 repeated types_pb.Transaction transactions = 1; 70 } 71 72 message SyncPeerInfoBroadcast { 73 types_pb.H256 Difficulty = 1; 74 types_pb.H256 Number = 2; 75 } 76 77 78 message SyncTask { 79 uint64 id = 1; // task id 80 bool ok = 2; 81 SyncType syncType = 3; 82 oneof payload { 83 //header 84 SyncHeaderRequest syncHeaderRequest = 4; 85 SyncHeaderResponse syncHeaderResponse = 5; 86 //body 87 SyncBlockRequest syncBlockRequest = 6; 88 SyncBlockResponse syncBlockResponse = 7; 89 //Transaction 90 SyncTransactionRequest syncTransactionRequest = 8; 91 SyncTransactionResponse syncTransactionResponse = 9; 92 // 93 SyncPeerInfoBroadcast syncPeerInfoBroadcast = 10; 94 } 95 } 96