From 0dffdc91c3cd22a762b91b3e717fb37f9e89580d Mon Sep 17 00:00:00 2001 From: rjl493456442 Date: Wed, 13 Nov 2019 14:14:18 +0800 Subject: [PATCH] les: remove useless fields --- les/api.go | 9 ++------- les/clientpool.go | 6 ++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/les/api.go b/les/api.go index 48a79baf0c..c417b4ec02 100644 --- a/les/api.go +++ b/les/api.go @@ -20,7 +20,6 @@ import ( "errors" "fmt" "math" - "sync" "time" "github.com/ethereum/go-ethereum/common/hexutil" @@ -38,15 +37,10 @@ var ( const maxBalance = math.MaxInt64 -type clientApiFields struct { - balanceUpdatePeriod uint64 -} - // PrivateLightServerAPI provides an API to access the LES light server. type PrivateLightServerAPI struct { server *LesServer defaultPosFactors, defaultNegFactors priceFactors - lock sync.Mutex } // NewPrivateLightServerAPI creates a new LES light server API. @@ -157,7 +151,8 @@ func (api *PrivateLightServerAPI) setParams(params map[string]interface{}, clien case !defParams && name == "capacity": if capacity, ok := value.(float64); ok && uint64(capacity) >= api.server.minCapacity { err = api.server.clientPool.setCapacity(client, uint64(capacity)) - updateFactors = true + // Don't have to call factor update explicitly. It's already done + // in setCapacity function. } else { err = errValue() } diff --git a/les/clientpool.go b/les/clientpool.go index ecf3bb18bb..0169dc706b 100644 --- a/les/clientpool.go +++ b/les/clientpool.go @@ -122,7 +122,6 @@ type clientInfo struct { balanceTracker balanceTracker posFactors, negFactors priceFactors balanceMetaInfo string - clientApiFields } // connSetIndex callback updates clientInfo item index in connectedQueue @@ -645,7 +644,10 @@ func (e *negBalance) DecodeRLP(s *rlp.Stream) error { const ( // nodeDBVersion is the version identifier of the node data in db - nodeDBVersion = 0 + // + // Changelog: + // * Replace `lastTotal` with `meta` in positive balance: version 0=>1 + nodeDBVersion = 1 // dbCleanupCycle is the cycle of db for useless data cleanup dbCleanupCycle = time.Hour