les: remove useless fields

This commit is contained in:
rjl493456442 2019-11-13 14:14:18 +08:00
parent 0c51cefb85
commit 0dffdc91c3
2 changed files with 6 additions and 9 deletions

View file

@ -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()
}

View file

@ -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