Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
Geth-Modification
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
张蕾
Geth-Modification
Commits
4747aad1
Commit
4747aad1
authored
May 09, 2018
by
kiel barry
Committed by
Péter Szilágyi
May 09, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
eth: golint fixes to variable names (#16711)
parent
4ea493e7
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
42 additions
and
42 deletions
+42
-42
api_backend.go
eth/api_backend.go
+33
-33
backend.go
eth/backend.go
+5
-5
protocol.go
eth/protocol.go
+3
-3
ethstats.go
ethstats/ethstats.go
+1
-1
No files found.
eth/api_backend.go
View file @
4747aad1
...
...
@@ -37,26 +37,26 @@ import (
"github.com/ethereum/go-ethereum/rpc"
)
// EthA
pi
Backend implements ethapi.Backend for full nodes
type
EthA
pi
Backend
struct
{
// EthA
PI
Backend implements ethapi.Backend for full nodes
type
EthA
PI
Backend
struct
{
eth
*
Ethereum
gpo
*
gasprice
.
Oracle
}
func
(
b
*
EthA
pi
Backend
)
ChainConfig
()
*
params
.
ChainConfig
{
func
(
b
*
EthA
PI
Backend
)
ChainConfig
()
*
params
.
ChainConfig
{
return
b
.
eth
.
chainConfig
}
func
(
b
*
EthA
pi
Backend
)
CurrentBlock
()
*
types
.
Block
{
func
(
b
*
EthA
PI
Backend
)
CurrentBlock
()
*
types
.
Block
{
return
b
.
eth
.
blockchain
.
CurrentBlock
()
}
func
(
b
*
EthA
pi
Backend
)
SetHead
(
number
uint64
)
{
func
(
b
*
EthA
PI
Backend
)
SetHead
(
number
uint64
)
{
b
.
eth
.
protocolManager
.
downloader
.
Cancel
()
b
.
eth
.
blockchain
.
SetHead
(
number
)
}
func
(
b
*
EthA
pi
Backend
)
HeaderByNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
(
*
types
.
Header
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
HeaderByNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
(
*
types
.
Header
,
error
)
{
// Pending block is only known by the miner
if
blockNr
==
rpc
.
PendingBlockNumber
{
block
:=
b
.
eth
.
miner
.
PendingBlock
()
...
...
@@ -69,7 +69,7 @@ func (b *EthApiBackend) HeaderByNumber(ctx context.Context, blockNr rpc.BlockNum
return
b
.
eth
.
blockchain
.
GetHeaderByNumber
(
uint64
(
blockNr
)),
nil
}
func
(
b
*
EthA
pi
Backend
)
BlockByNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
(
*
types
.
Block
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
BlockByNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
(
*
types
.
Block
,
error
)
{
// Pending block is only known by the miner
if
blockNr
==
rpc
.
PendingBlockNumber
{
block
:=
b
.
eth
.
miner
.
PendingBlock
()
...
...
@@ -82,7 +82,7 @@ func (b *EthApiBackend) BlockByNumber(ctx context.Context, blockNr rpc.BlockNumb
return
b
.
eth
.
blockchain
.
GetBlockByNumber
(
uint64
(
blockNr
)),
nil
}
func
(
b
*
EthA
pi
Backend
)
StateAndHeaderByNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
(
*
state
.
StateDB
,
*
types
.
Header
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
StateAndHeaderByNumber
(
ctx
context
.
Context
,
blockNr
rpc
.
BlockNumber
)
(
*
state
.
StateDB
,
*
types
.
Header
,
error
)
{
// Pending state is only known by the miner
if
blockNr
==
rpc
.
PendingBlockNumber
{
block
,
state
:=
b
.
eth
.
miner
.
Pending
()
...
...
@@ -97,18 +97,18 @@ func (b *EthApiBackend) StateAndHeaderByNumber(ctx context.Context, blockNr rpc.
return
stateDb
,
header
,
err
}
func
(
b
*
EthA
pi
Backend
)
GetBlock
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
*
types
.
Block
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
GetBlock
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
*
types
.
Block
,
error
)
{
return
b
.
eth
.
blockchain
.
GetBlockByHash
(
hash
),
nil
}
func
(
b
*
EthA
pi
Backend
)
GetReceipts
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
types
.
Receipts
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
GetReceipts
(
ctx
context
.
Context
,
hash
common
.
Hash
)
(
types
.
Receipts
,
error
)
{
if
number
:=
rawdb
.
ReadHeaderNumber
(
b
.
eth
.
chainDb
,
hash
);
number
!=
nil
{
return
rawdb
.
ReadReceipts
(
b
.
eth
.
chainDb
,
hash
,
*
number
),
nil
}
return
nil
,
nil
}
func
(
b
*
EthA
pi
Backend
)
GetLogs
(
ctx
context
.
Context
,
hash
common
.
Hash
)
([][]
*
types
.
Log
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
GetLogs
(
ctx
context
.
Context
,
hash
common
.
Hash
)
([][]
*
types
.
Log
,
error
)
{
number
:=
rawdb
.
ReadHeaderNumber
(
b
.
eth
.
chainDb
,
hash
)
if
number
==
nil
{
return
nil
,
nil
...
...
@@ -124,11 +124,11 @@ func (b *EthApiBackend) GetLogs(ctx context.Context, hash common.Hash) ([][]*typ
return
logs
,
nil
}
func
(
b
*
EthA
pi
Backend
)
GetTd
(
blockHash
common
.
Hash
)
*
big
.
Int
{
func
(
b
*
EthA
PI
Backend
)
GetTd
(
blockHash
common
.
Hash
)
*
big
.
Int
{
return
b
.
eth
.
blockchain
.
GetTdByHash
(
blockHash
)
}
func
(
b
*
EthA
pi
Backend
)
GetEVM
(
ctx
context
.
Context
,
msg
core
.
Message
,
state
*
state
.
StateDB
,
header
*
types
.
Header
,
vmCfg
vm
.
Config
)
(
*
vm
.
EVM
,
func
()
error
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
GetEVM
(
ctx
context
.
Context
,
msg
core
.
Message
,
state
*
state
.
StateDB
,
header
*
types
.
Header
,
vmCfg
vm
.
Config
)
(
*
vm
.
EVM
,
func
()
error
,
error
)
{
state
.
SetBalance
(
msg
.
From
(),
math
.
MaxBig256
)
vmError
:=
func
()
error
{
return
nil
}
...
...
@@ -136,31 +136,31 @@ func (b *EthApiBackend) GetEVM(ctx context.Context, msg core.Message, state *sta
return
vm
.
NewEVM
(
context
,
state
,
b
.
eth
.
chainConfig
,
vmCfg
),
vmError
,
nil
}
func
(
b
*
EthA
pi
Backend
)
SubscribeRemovedLogsEvent
(
ch
chan
<-
core
.
RemovedLogsEvent
)
event
.
Subscription
{
func
(
b
*
EthA
PI
Backend
)
SubscribeRemovedLogsEvent
(
ch
chan
<-
core
.
RemovedLogsEvent
)
event
.
Subscription
{
return
b
.
eth
.
BlockChain
()
.
SubscribeRemovedLogsEvent
(
ch
)
}
func
(
b
*
EthA
pi
Backend
)
SubscribeChainEvent
(
ch
chan
<-
core
.
ChainEvent
)
event
.
Subscription
{
func
(
b
*
EthA
PI
Backend
)
SubscribeChainEvent
(
ch
chan
<-
core
.
ChainEvent
)
event
.
Subscription
{
return
b
.
eth
.
BlockChain
()
.
SubscribeChainEvent
(
ch
)
}
func
(
b
*
EthA
pi
Backend
)
SubscribeChainHeadEvent
(
ch
chan
<-
core
.
ChainHeadEvent
)
event
.
Subscription
{
func
(
b
*
EthA
PI
Backend
)
SubscribeChainHeadEvent
(
ch
chan
<-
core
.
ChainHeadEvent
)
event
.
Subscription
{
return
b
.
eth
.
BlockChain
()
.
SubscribeChainHeadEvent
(
ch
)
}
func
(
b
*
EthA
pi
Backend
)
SubscribeChainSideEvent
(
ch
chan
<-
core
.
ChainSideEvent
)
event
.
Subscription
{
func
(
b
*
EthA
PI
Backend
)
SubscribeChainSideEvent
(
ch
chan
<-
core
.
ChainSideEvent
)
event
.
Subscription
{
return
b
.
eth
.
BlockChain
()
.
SubscribeChainSideEvent
(
ch
)
}
func
(
b
*
EthA
pi
Backend
)
SubscribeLogsEvent
(
ch
chan
<-
[]
*
types
.
Log
)
event
.
Subscription
{
func
(
b
*
EthA
PI
Backend
)
SubscribeLogsEvent
(
ch
chan
<-
[]
*
types
.
Log
)
event
.
Subscription
{
return
b
.
eth
.
BlockChain
()
.
SubscribeLogsEvent
(
ch
)
}
func
(
b
*
EthA
pi
Backend
)
SendTx
(
ctx
context
.
Context
,
signedTx
*
types
.
Transaction
)
error
{
func
(
b
*
EthA
PI
Backend
)
SendTx
(
ctx
context
.
Context
,
signedTx
*
types
.
Transaction
)
error
{
return
b
.
eth
.
txPool
.
AddLocal
(
signedTx
)
}
func
(
b
*
EthA
pi
Backend
)
GetPoolTransactions
()
(
types
.
Transactions
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
GetPoolTransactions
()
(
types
.
Transactions
,
error
)
{
pending
,
err
:=
b
.
eth
.
txPool
.
Pending
()
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -172,56 +172,56 @@ func (b *EthApiBackend) GetPoolTransactions() (types.Transactions, error) {
return
txs
,
nil
}
func
(
b
*
EthA
pi
Backend
)
GetPoolTransaction
(
hash
common
.
Hash
)
*
types
.
Transaction
{
func
(
b
*
EthA
PI
Backend
)
GetPoolTransaction
(
hash
common
.
Hash
)
*
types
.
Transaction
{
return
b
.
eth
.
txPool
.
Get
(
hash
)
}
func
(
b
*
EthA
pi
Backend
)
GetPoolNonce
(
ctx
context
.
Context
,
addr
common
.
Address
)
(
uint64
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
GetPoolNonce
(
ctx
context
.
Context
,
addr
common
.
Address
)
(
uint64
,
error
)
{
return
b
.
eth
.
txPool
.
State
()
.
GetNonce
(
addr
),
nil
}
func
(
b
*
EthA
pi
Backend
)
Stats
()
(
pending
int
,
queued
int
)
{
func
(
b
*
EthA
PI
Backend
)
Stats
()
(
pending
int
,
queued
int
)
{
return
b
.
eth
.
txPool
.
Stats
()
}
func
(
b
*
EthA
pi
Backend
)
TxPoolContent
()
(
map
[
common
.
Address
]
types
.
Transactions
,
map
[
common
.
Address
]
types
.
Transactions
)
{
func
(
b
*
EthA
PI
Backend
)
TxPoolContent
()
(
map
[
common
.
Address
]
types
.
Transactions
,
map
[
common
.
Address
]
types
.
Transactions
)
{
return
b
.
eth
.
TxPool
()
.
Content
()
}
func
(
b
*
EthA
pi
Backend
)
SubscribeTxPreEvent
(
ch
chan
<-
core
.
TxPreEvent
)
event
.
Subscription
{
func
(
b
*
EthA
PI
Backend
)
SubscribeTxPreEvent
(
ch
chan
<-
core
.
TxPreEvent
)
event
.
Subscription
{
return
b
.
eth
.
TxPool
()
.
SubscribeTxPreEvent
(
ch
)
}
func
(
b
*
EthA
pi
Backend
)
Downloader
()
*
downloader
.
Downloader
{
func
(
b
*
EthA
PI
Backend
)
Downloader
()
*
downloader
.
Downloader
{
return
b
.
eth
.
Downloader
()
}
func
(
b
*
EthA
pi
Backend
)
ProtocolVersion
()
int
{
func
(
b
*
EthA
PI
Backend
)
ProtocolVersion
()
int
{
return
b
.
eth
.
EthVersion
()
}
func
(
b
*
EthA
pi
Backend
)
SuggestPrice
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
{
func
(
b
*
EthA
PI
Backend
)
SuggestPrice
(
ctx
context
.
Context
)
(
*
big
.
Int
,
error
)
{
return
b
.
gpo
.
SuggestPrice
(
ctx
)
}
func
(
b
*
EthA
pi
Backend
)
ChainDb
()
ethdb
.
Database
{
func
(
b
*
EthA
PI
Backend
)
ChainDb
()
ethdb
.
Database
{
return
b
.
eth
.
ChainDb
()
}
func
(
b
*
EthA
pi
Backend
)
EventMux
()
*
event
.
TypeMux
{
func
(
b
*
EthA
PI
Backend
)
EventMux
()
*
event
.
TypeMux
{
return
b
.
eth
.
EventMux
()
}
func
(
b
*
EthA
pi
Backend
)
AccountManager
()
*
accounts
.
Manager
{
func
(
b
*
EthA
PI
Backend
)
AccountManager
()
*
accounts
.
Manager
{
return
b
.
eth
.
AccountManager
()
}
func
(
b
*
EthA
pi
Backend
)
BloomStatus
()
(
uint64
,
uint64
)
{
func
(
b
*
EthA
PI
Backend
)
BloomStatus
()
(
uint64
,
uint64
)
{
sections
,
_
,
_
:=
b
.
eth
.
bloomIndexer
.
Sections
()
return
params
.
BloomBitsBlocks
,
sections
}
func
(
b
*
EthA
pi
Backend
)
ServiceFilter
(
ctx
context
.
Context
,
session
*
bloombits
.
MatcherSession
)
{
func
(
b
*
EthA
PI
Backend
)
ServiceFilter
(
ctx
context
.
Context
,
session
*
bloombits
.
MatcherSession
)
{
for
i
:=
0
;
i
<
bloomFilterThreads
;
i
++
{
go
session
.
Multiplex
(
bloomRetrievalBatch
,
bloomRetrievalWait
,
b
.
eth
.
bloomRequests
)
}
...
...
eth/backend.go
View file @
4747aad1
...
...
@@ -82,7 +82,7 @@ type Ethereum struct {
bloomRequests
chan
chan
*
bloombits
.
Retrieval
// Channel receiving bloom data retrieval requests
bloomIndexer
*
core
.
ChainIndexer
// Bloom indexer operating during block imports
A
piBackend
*
EthApi
Backend
A
PIBackend
*
EthAPI
Backend
miner
*
miner
.
Miner
gasPrice
*
big
.
Int
...
...
@@ -169,12 +169,12 @@ func New(ctx *node.ServiceContext, config *Config) (*Ethereum, error) {
eth
.
miner
=
miner
.
New
(
eth
,
eth
.
chainConfig
,
eth
.
EventMux
(),
eth
.
engine
)
eth
.
miner
.
SetExtra
(
makeExtraData
(
config
.
ExtraData
))
eth
.
A
piBackend
=
&
EthApi
Backend
{
eth
,
nil
}
eth
.
A
PIBackend
=
&
EthAPI
Backend
{
eth
,
nil
}
gpoParams
:=
config
.
GPO
if
gpoParams
.
Default
==
nil
{
gpoParams
.
Default
=
config
.
GasPrice
}
eth
.
A
piBackend
.
gpo
=
gasprice
.
NewOracle
(
eth
.
Api
Backend
,
gpoParams
)
eth
.
A
PIBackend
.
gpo
=
gasprice
.
NewOracle
(
eth
.
API
Backend
,
gpoParams
)
return
eth
,
nil
}
...
...
@@ -242,7 +242,7 @@ func CreateConsensusEngine(ctx *node.ServiceContext, config *ethash.Config, chai
// APIs returns the collection of RPC services the ethereum package offers.
// NOTE, some of these services probably need to be moved to somewhere else.
func
(
s
*
Ethereum
)
APIs
()
[]
rpc
.
API
{
apis
:=
ethapi
.
GetAPIs
(
s
.
A
pi
Backend
)
apis
:=
ethapi
.
GetAPIs
(
s
.
A
PI
Backend
)
// Append any APIs exposed explicitly by the consensus engine
apis
=
append
(
apis
,
s
.
engine
.
APIs
(
s
.
BlockChain
())
...
)
...
...
@@ -272,7 +272,7 @@ func (s *Ethereum) APIs() []rpc.API {
},
{
Namespace
:
"eth"
,
Version
:
"1.0"
,
Service
:
filters
.
NewPublicFilterAPI
(
s
.
A
pi
Backend
,
false
),
Service
:
filters
.
NewPublicFilterAPI
(
s
.
A
PI
Backend
,
false
),
Public
:
true
,
},
{
Namespace
:
"admin"
,
...
...
eth/protocol.go
View file @
4747aad1
...
...
@@ -34,13 +34,13 @@ const (
eth63
=
63
)
//
O
fficial short name of the protocol used during capability negotiation.
//
ProtocolName is the o
fficial short name of the protocol used during capability negotiation.
var
ProtocolName
=
"eth"
//
S
upported versions of the eth protocol (first is primary).
//
ProtocolVersions are the
upported versions of the eth protocol (first is primary).
var
ProtocolVersions
=
[]
uint
{
eth63
,
eth62
}
//
N
umber of implemented message corresponding to different protocol versions.
//
ProtocolLengths are the n
umber of implemented message corresponding to different protocol versions.
var
ProtocolLengths
=
[]
uint64
{
17
,
8
}
const
ProtocolMaxMsgSize
=
10
*
1024
*
1024
// Maximum cap on the size of a protocol message
...
...
ethstats/ethstats.go
View file @
4747aad1
...
...
@@ -689,7 +689,7 @@ func (s *Service) reportStats(conn *websocket.Conn) error {
sync
:=
s
.
eth
.
Downloader
()
.
Progress
()
syncing
=
s
.
eth
.
BlockChain
()
.
CurrentHeader
()
.
Number
.
Uint64
()
>=
sync
.
HighestBlock
price
,
_
:=
s
.
eth
.
A
pi
Backend
.
SuggestPrice
(
context
.
Background
())
price
,
_
:=
s
.
eth
.
A
PI
Backend
.
SuggestPrice
(
context
.
Background
())
gasprice
=
int
(
price
.
Uint64
())
}
else
{
sync
:=
s
.
les
.
Downloader
()
.
Progress
()
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment