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
b0798e0a
Commit
b0798e0a
authored
May 13, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'develop' of github.com-obscure:ethereum/eth-go into develop
parents
9831ba20
c9ac5b0f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
40 additions
and
1 deletion
+40
-1
state_manager.go
ethchain/state_manager.go
+3
-0
ethereum.go
ethereum.go
+15
-0
pub.go
ethpub/pub.go
+22
-1
No files found.
ethchain/state_manager.go
View file @
b0798e0a
...
...
@@ -20,6 +20,9 @@ type EthManager interface {
TxPool
()
*
TxPool
Broadcast
(
msgType
ethwire
.
MsgType
,
data
[]
interface
{})
Reactor
()
*
ethutil
.
ReactorEngine
PeerCount
()
int
IsMining
()
bool
IsListening
()
bool
}
type
StateManager
struct
{
...
...
ethereum.go
View file @
b0798e0a
...
...
@@ -65,6 +65,10 @@ type Ethereum struct {
// Specifies the desired amount of maximum peers
MaxPeers
int
Mining
bool
listening
bool
reactor
*
ethutil
.
ReactorEngine
RpcServer
*
ethrpc
.
JsonRpcServer
...
...
@@ -128,6 +132,15 @@ func (s *Ethereum) TxPool() *ethchain.TxPool {
func
(
s
*
Ethereum
)
ServerCaps
()
Caps
{
return
s
.
serverCaps
}
func
(
s
*
Ethereum
)
IsMining
()
bool
{
return
s
.
Mining
}
func
(
s
*
Ethereum
)
PeerCount
()
int
{
return
s
.
peers
.
Len
()
}
func
(
s
*
Ethereum
)
IsListening
()
bool
{
return
s
.
listening
}
func
(
s
*
Ethereum
)
AddPeer
(
conn
net
.
Conn
)
{
peer
:=
NewPeer
(
conn
,
s
,
true
)
...
...
@@ -305,7 +318,9 @@ func (s *Ethereum) Start(seed bool) {
ln
,
err
:=
net
.
Listen
(
"tcp"
,
":"
+
s
.
Port
)
if
err
!=
nil
{
log
.
Println
(
"Connection listening disabled. Acting as client"
)
s
.
listening
=
false
}
else
{
s
.
listening
=
true
// Starting accepting connections
ethutil
.
Config
.
Log
.
Infoln
(
"Ready and accepting connections"
)
// Start the peer handler
...
...
ethpub/pub.go
View file @
b0798e0a
package
ethpub
import
(
"encoding/hex"
"github.com/ethereum/eth-go/ethchain"
"github.com/ethereum/eth-go/ethutil"
)
...
...
@@ -56,11 +57,31 @@ func (lib *PEthereum) GetStateObject(address string) *PStateObject {
return
NewPStateObject
(
nil
)
}
func
(
lib
*
PEthereum
)
GetPeerCount
()
int
{
return
lib
.
manager
.
PeerCount
()
}
func
(
lib
*
PEthereum
)
GetIsMining
()
bool
{
return
lib
.
manager
.
IsMining
()
}
func
(
lib
*
PEthereum
)
GetIsListening
()
bool
{
return
lib
.
manager
.
IsListening
()
}
func
(
lib
*
PEthereum
)
GetCoinBase
()
string
{
data
,
_
:=
ethutil
.
Config
.
Db
.
Get
([]
byte
(
"KeyRing"
))
keyRing
:=
ethutil
.
NewValueFromBytes
(
data
)
key
:=
keyRing
.
Get
(
0
)
.
Bytes
()
return
lib
.
SecretToAddress
(
hex
.
EncodeToString
(
key
))
}
func
(
lib
*
PEthereum
)
GetStorage
(
address
,
storageAddress
string
)
string
{
return
lib
.
GetStateObject
(
address
)
.
GetStorage
(
storageAddress
)
}
func
(
lib
*
PEthereum
)
GetTxCount
(
address
string
)
int
{
func
(
lib
*
PEthereum
)
GetTxCount
At
(
address
string
)
int
{
return
lib
.
GetStateObject
(
address
)
.
Nonce
()
}
...
...
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