github.com/klaytn/klaytn@v1.10.2/datasync/downloader/downloader_fake.go (about) 1 // Copyright 2020 The klaytn Authors 2 // This file is part of the klaytn library. 3 // 4 // The klaytn 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 klaytn 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 klaytn library. If not, see <http://www.gnu.org/licenses/>. 16 17 package downloader 18 19 import ( 20 "math/big" 21 22 "github.com/klaytn/klaytn" 23 "github.com/klaytn/klaytn/blockchain/types" 24 "github.com/klaytn/klaytn/common" 25 "github.com/klaytn/klaytn/node/cn/snap" 26 "github.com/klaytn/klaytn/reward" 27 ) 28 29 // fakeDownloader do nothing 30 type FakeDownloader struct{} 31 32 func NewFakeDownloader() *FakeDownloader { 33 logger.Warn("downloader is disabled; no data will be downloaded from peers") 34 return &FakeDownloader{} 35 } 36 37 func (*FakeDownloader) RegisterPeer(id string, version int, peer Peer) error { return nil } 38 func (*FakeDownloader) UnregisterPeer(id string) error { return nil } 39 40 func (*FakeDownloader) DeliverBodies(id string, transactions [][]*types.Transaction) error { 41 return nil 42 } 43 func (*FakeDownloader) DeliverHeaders(id string, headers []*types.Header) error { return nil } 44 func (*FakeDownloader) DeliverNodeData(id string, data [][]byte) error { return nil } 45 func (*FakeDownloader) DeliverReceipts(id string, receipts [][]*types.Receipt) error { return nil } 46 func (*FakeDownloader) DeliverStakingInfos(id string, stakingInfos []*reward.StakingInfo) error { 47 return nil 48 } 49 50 func (*FakeDownloader) DeliverSnapPacket(peer *snap.Peer, packet snap.Packet) error { 51 return nil 52 } 53 54 func (*FakeDownloader) Terminate() {} 55 func (*FakeDownloader) Synchronise(id string, head common.Hash, td *big.Int, mode SyncMode) error { 56 return nil 57 } 58 func (*FakeDownloader) Progress() klaytn.SyncProgress { return klaytn.SyncProgress{} } 59 func (*FakeDownloader) Cancel() {} 60 61 func (*FakeDownloader) GetSnapSyncer() *snap.Syncer { return nil } 62 func (*FakeDownloader) SyncStakingInfo(id string, from, to uint64) error { return nil } 63 func (*FakeDownloader) SyncStakingInfoStatus() *SyncingStatus { return nil }