good morning!!!!
Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
B
bor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Harbor Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
open
bor
Commits
12e8d9c4
Commit
12e8d9c4
authored
Apr 18, 2015
by
Jeffrey Wilcke
Browse files
Options
Downloads
Patches
Plain Diff
eth: listen for mined blocks and propagate using the protocol manager
parent
ecc74d76
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
eth/backend.go
+15
-17
15 additions, 17 deletions
eth/backend.go
with
15 additions
and
17 deletions
eth/backend.go
+
15
−
17
View file @
12e8d9c4
...
@@ -139,7 +139,7 @@ type Ethereum struct {
...
@@ -139,7 +139,7 @@ type Ethereum struct {
net
*
p2p
.
Server
net
*
p2p
.
Server
eventMux
*
event
.
TypeMux
eventMux
*
event
.
TypeMux
txSub
event
.
Subscription
txSub
event
.
Subscription
//b
lockSub event.Subscription
minedB
lockSub
event
.
Subscription
miner
*
miner
.
Miner
miner
*
miner
.
Miner
// logger logger.LogSystem
// logger logger.LogSystem
...
@@ -387,8 +387,8 @@ func (s *Ethereum) Start() error {
...
@@ -387,8 +387,8 @@ func (s *Ethereum) Start() error {
go
s
.
txBroadcastLoop
()
go
s
.
txBroadcastLoop
()
// broadcast mined blocks
// broadcast mined blocks
//s.b
lockSub = s.eventMux.Subscribe(core.
ChainHead
Event{})
s
.
minedB
lockSub
=
s
.
eventMux
.
Subscribe
(
core
.
NewMinedBlock
Event
{})
go
s
.
block
BroadcastLoop
()
go
s
.
mined
BroadcastLoop
()
glog
.
V
(
logger
.
Info
)
.
Infoln
(
"Server started"
)
glog
.
V
(
logger
.
Info
)
.
Infoln
(
"Server started"
)
return
nil
return
nil
...
@@ -420,7 +420,7 @@ func (s *Ethereum) Stop() {
...
@@ -420,7 +420,7 @@ func (s *Ethereum) Stop() {
defer
s
.
extraDb
.
Close
()
defer
s
.
extraDb
.
Close
()
s
.
txSub
.
Unsubscribe
()
// quits txBroadcastLoop
s
.
txSub
.
Unsubscribe
()
// quits txBroadcastLoop
//s.b
lockSub.Unsubscribe() // quits blockBroadcastLoop
s
.
minedB
lockSub
.
Unsubscribe
()
// quits blockBroadcastLoop
s
.
txPool
.
Stop
()
s
.
txPool
.
Stop
()
s
.
eventMux
.
Stop
()
s
.
eventMux
.
Stop
()
...
@@ -462,16 +462,14 @@ func (self *Ethereum) syncAccounts(tx *types.Transaction) {
...
@@ -462,16 +462,14 @@ func (self *Ethereum) syncAccounts(tx *types.Transaction) {
}
}
}
}
func
(
self
*
Ethereum
)
block
BroadcastLoop
()
{
func
(
self
*
Ethereum
)
mined
BroadcastLoop
()
{
// automatically stops if unsubscribe
// automatically stops if unsubscribe
/*
for
obj
:=
range
self
.
minedBlockSub
.
Chan
()
{
for obj := range self.blockSub.Chan() {
switch
ev
:=
obj
.
(
type
)
{
switch
ev
:=
obj
.
(
type
)
{
case core.
ChainHead
Event:
case
core
.
NewMinedBlock
Event
:
self.
net.BroadcastLimited("eth", NewBlockMsg, math.Sqrt, []interface{}{ev.
Block
,
ev.Block
.Td}
)
self
.
protocolManager
.
Broadcast
Block
(
ev
.
Block
)
}
}
}
}
*/
}
}
func
saveProtocolVersion
(
db
common
.
Database
,
protov
int
)
{
func
saveProtocolVersion
(
db
common
.
Database
,
protov
int
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment