Skip to content

Commit

Permalink
optimize code
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjiyou committed Jul 28, 2020
1 parent f770760 commit c67c051
Show file tree
Hide file tree
Showing 5 changed files with 0 additions and 43 deletions.
10 changes: 0 additions & 10 deletions cmd/gptn/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -308,16 +308,6 @@ func startNode(ctx *cli.Context, stack *node.Node) {
}
}()
// Start auxiliary services if enabled
//if ctx.GlobalBool(utils.MiningEnabledFlag.Name) || ctx.GlobalBool(utils.DeveloperFlag.Name) {
// // Mining only makes sense if a full PalletOne node is running
// if ctx.GlobalBool(utils.LightModeFlag.Name) || ctx.GlobalString(utils.SyncModeFlag.Name) == "light" {
// utils.Fatalf("Light clients do not support mining")
// }
// var palletone *ptn.PalletOne
// if err := stack.Service(&palletone); err != nil {
// utils.Fatalf("PalletOne service not running: %v", err)
// }
//}
}

func welcomePalletOne() {
Expand Down
5 changes: 0 additions & 5 deletions light/fetcher.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,6 @@ type headerInsertFn func(headers []*modules.Header) (int, error)
type peerDropFn func(id string)

// headerFilterTask represents a batch of headers needing fetcher filtering.
//type headerFilterTask struct {
//// peer string // The source peer of block headers
//// headers []*modules.Header // Collection of headers to filter
//// time time.Time // Arrival time of the headers
//}

// inject represents a schedules import operation.
type inject struct {
Expand Down
11 changes: 0 additions & 11 deletions light/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -372,12 +372,6 @@ func (pm *ProtocolManager) handle(p *peer) error {
//}
pm.removePeer(p.id)
}()
// Register the peer in the downloader. If the downloader considers it banned, we disconnect
//if pm.lightSync {
// if p.poolEntry != nil {
// pm.serverPool.registered(p.poolEntry)
// }
//}

stop := make(chan struct{})
defer close(stop)
Expand Down Expand Up @@ -536,11 +530,6 @@ type peerConnection struct {
peer *peer
}

//Head(modules.AssetId) (common.Hash, *modules.ChainIndex)
//RequestHeadersByHash(common.Hash, int, int, bool) error
//RequestHeadersByNumber(*modules.ChainIndex, int, int, bool) error
//RequestDagHeadersByHash(common.Hash, int, int, bool) error
//RequestLeafNodes() error

func (pc *peerConnection) Head(assetId modules.AssetId) (common.Hash, *modules.ChainIndex) {
//return common.Hash{}, nil
Expand Down
13 changes: 0 additions & 13 deletions ptn/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,6 @@ type ProtocolManager struct {
fetcher *fetcher.Fetcher
peers *peerSet

//lightdownloader *downloader.Downloader
//lightFetcher *lps.LightFetcher
//lightPeers *peerSet

SubProtocols []p2p.Protocol

Expand Down Expand Up @@ -209,11 +206,6 @@ func NewProtocolManager(mode downloader.SyncMode, networkId uint64, gasToken mod
protocolName, _, _, _, _ := gasToken.ParseAssetId()
manager.mainAssetId = gasToken

// Figure out whether to allow fast sync or not
//if mode == downloader.FastSync && dag.CurrentUnit().UnitHeader.Index() > 0 {
// log.Info("dag not empty, fast sync disabled")
// mode = downloader.FullSync
//}

if mode == downloader.FastSync {
manager.fastSync = uint32(1)
Expand Down Expand Up @@ -262,8 +254,6 @@ func NewProtocolManager(mode downloader.SyncMode, networkId uint64, gasToken mod
manager.downloader = downloader.New(mode, manager.eventMux, manager.removePeer, nil, dag, txpool)
manager.fetcher = manager.newFetcher()

//manager.lightdownloader = downloader.New(downloader.LightSync, manager.eventMux, nil, nil, dag, txpool)
//manager.lightFetcher = manager.newLightFetcher()
return manager, nil
}

Expand Down Expand Up @@ -510,9 +500,6 @@ func (pm *ProtocolManager) handle(p *peer) error {
log.Debug("Enter ProtocolManager handle", "peer id:", p.id)
defer log.Debug("End ProtocolManager handle", "peer id:", p.id)

//if len(p.Caps()) > 0 && (pm.SubProtocols[0].Name != p.Caps()[0].Name) {
// return pm.PartitionHandle(p)
//}
return pm.LocalHandle(p)

}
Expand Down
4 changes: 0 additions & 4 deletions ptn/message.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,10 +297,6 @@ func (pm *ProtocolManager) GetNodeDataMsg(msg p2p.Msg, p *peer) error {
return errResp(ErrDecode, "msg %v: %v", msg, err)
}
// Retrieve the requested state entry, stopping if enough was found
//if entry, err := pm.blockchain.TrieNode(hash); err == nil {
// data = append(data, entry)
// bytes += len(entry)
//}
}
return p.SendNodeData(data)
}
Expand Down

0 comments on commit c67c051

Please sign in to comment.