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
c8e9ca04
Commit
c8e9ca04
authored
Mar 23, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed bad uncles
parent
0330077d
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
16 additions
and
6 deletions
+16
-6
peers.go
blockpool/peers.go
+2
-1
block_processor.go
core/block_processor.go
+2
-2
ethereum_js.go
jsre/ethereum_js.go
+1
-1
worker.go
miner/worker.go
+11
-2
No files found.
blockpool/peers.go
View file @
c8e9ca04
...
@@ -471,7 +471,8 @@ func (self *peer) getBlockHashes() bool {
...
@@ -471,7 +471,8 @@ func (self *peer) getBlockHashes() bool {
self
.
addError
(
ErrInvalidBlock
,
"%v"
,
err
)
self
.
addError
(
ErrInvalidBlock
,
"%v"
,
err
)
self
.
bp
.
status
.
badPeers
[
self
.
id
]
++
self
.
bp
.
status
.
badPeers
[
self
.
id
]
++
}
else
{
}
else
{
if
self
.
currentBlock
.
Td
!=
nil
{
// XXX added currentBlock check (?)
if
self
.
currentBlock
!=
nil
&&
self
.
currentBlock
.
Td
!=
nil
{
if
self
.
td
.
Cmp
(
self
.
currentBlock
.
Td
)
!=
0
{
if
self
.
td
.
Cmp
(
self
.
currentBlock
.
Td
)
!=
0
{
self
.
addError
(
ErrIncorrectTD
,
"on block %x"
,
self
.
currentBlockHash
)
self
.
addError
(
ErrIncorrectTD
,
"on block %x"
,
self
.
currentBlockHash
)
self
.
bp
.
status
.
badPeers
[
self
.
id
]
++
self
.
bp
.
status
.
badPeers
[
self
.
id
]
++
...
...
core/block_processor.go
View file @
c8e9ca04
...
@@ -7,12 +7,12 @@ import (
...
@@ -7,12 +7,12 @@ import (
"time"
"time"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/rlp"
"github.com/ethereum/go-ethereum/core/state"
"gopkg.in/fatih/set.v0"
"gopkg.in/fatih/set.v0"
)
)
...
@@ -243,7 +243,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
...
@@ -243,7 +243,7 @@ func (sm *BlockProcessor) processWithParent(block, parent *types.Block) (td *big
chainlogger
.
Infof
(
"found possible uncle block #%d (%x...)
\n
"
,
header
.
Number
,
block
.
Hash
()
.
Bytes
()[
0
:
4
])
chainlogger
.
Infof
(
"found possible uncle block #%d (%x...)
\n
"
,
header
.
Number
,
block
.
Hash
()
.
Bytes
()[
0
:
4
])
return
td
,
nil
,
BlockEqualTSErr
return
td
,
nil
,
BlockEqualTSErr
}
else
{
}
else
{
chainlogger
.
Infof
(
"processed block #%d (%
x...)
\n
"
,
header
.
Number
,
block
.
Hash
()
.
Bytes
()[
0
:
4
])
chainlogger
.
Infof
(
"processed block #%d (%
d TXs %d UNCs) (%x...)
\n
"
,
header
.
Number
,
len
(
block
.
Transactions
()),
len
(
block
.
Uncles
())
,
block
.
Hash
()
.
Bytes
()[
0
:
4
])
}
}
return
td
,
state
.
Logs
(),
nil
return
td
,
state
.
Logs
(),
nil
...
...
jsre/ethereum_js.go
View file @
c8e9ca04
This diff is collapsed.
Click to expand it.
miner/worker.go
View file @
c8e9ca04
...
@@ -9,11 +9,11 @@ import (
...
@@ -9,11 +9,11 @@ import (
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/common"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core"
"github.com/ethereum/go-ethereum/core/state"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/core/types"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/event"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/logger"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/pow"
"github.com/ethereum/go-ethereum/core/state"
"gopkg.in/fatih/set.v0"
"gopkg.in/fatih/set.v0"
)
)
...
@@ -199,6 +199,8 @@ func (self *worker) push() {
...
@@ -199,6 +199,8 @@ func (self *worker) push() {
func
(
self
*
worker
)
commitNewWork
()
{
func
(
self
*
worker
)
commitNewWork
()
{
self
.
mu
.
Lock
()
self
.
mu
.
Lock
()
defer
self
.
mu
.
Unlock
()
defer
self
.
mu
.
Unlock
()
self
.
uncleMu
.
Lock
()
defer
self
.
uncleMu
.
Unlock
()
block
:=
self
.
chain
.
NewBlock
(
self
.
coinbase
)
block
:=
self
.
chain
.
NewBlock
(
self
.
coinbase
)
...
@@ -241,7 +243,10 @@ gasLimit:
...
@@ -241,7 +243,10 @@ gasLimit:
}
}
self
.
eth
.
TxPool
()
.
RemoveSet
(
remove
)
self
.
eth
.
TxPool
()
.
RemoveSet
(
remove
)
var
uncles
[]
*
types
.
Header
var
(
uncles
[]
*
types
.
Header
badUncles
[]
common
.
Hash
)
for
hash
,
uncle
:=
range
self
.
possibleUncles
{
for
hash
,
uncle
:=
range
self
.
possibleUncles
{
if
len
(
uncles
)
==
2
{
if
len
(
uncles
)
==
2
{
break
break
...
@@ -250,12 +255,16 @@ gasLimit:
...
@@ -250,12 +255,16 @@ gasLimit:
if
err
:=
self
.
commitUncle
(
uncle
.
Header
());
err
!=
nil
{
if
err
:=
self
.
commitUncle
(
uncle
.
Header
());
err
!=
nil
{
minerlogger
.
Infof
(
"Bad uncle found and will be removed (%x)
\n
"
,
hash
[
:
4
])
minerlogger
.
Infof
(
"Bad uncle found and will be removed (%x)
\n
"
,
hash
[
:
4
])
minerlogger
.
Debugln
(
uncle
)
minerlogger
.
Debugln
(
uncle
)
badUncles
=
append
(
badUncles
,
hash
)
}
else
{
}
else
{
minerlogger
.
Infof
(
"commiting %x as uncle
\n
"
,
hash
[
:
4
])
minerlogger
.
Infof
(
"commiting %x as uncle
\n
"
,
hash
[
:
4
])
uncles
=
append
(
uncles
,
uncle
.
Header
())
uncles
=
append
(
uncles
,
uncle
.
Header
())
}
}
}
}
minerlogger
.
Infof
(
"commit new work with %d txs & %d uncles
\n
"
,
tcount
,
len
(
uncles
))
minerlogger
.
Infof
(
"commit new work with %d txs & %d uncles
\n
"
,
tcount
,
len
(
uncles
))
for
_
,
hash
:=
range
badUncles
{
delete
(
self
.
possibleUncles
,
hash
)
}
self
.
current
.
block
.
SetUncles
(
uncles
)
self
.
current
.
block
.
SetUncles
(
uncles
)
...
...
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