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
0a22dc2c
Commit
0a22dc2c
authored
Dec 02, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check coinbase for from/to inclusion
parent
cb4d168e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
8 deletions
+13
-8
block_manager.go
chain/block_manager.go
+11
-6
filter.go
chain/filter.go
+2
-2
No files found.
chain/block_manager.go
View file @
0a22dc2c
...
@@ -275,16 +275,24 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
...
@@ -275,16 +275,24 @@ func (sm *BlockManager) ProcessWithParent(block, parent *Block) (td *big.Int, me
}
}
}
}
func
(
sm
*
BlockManager
)
ApplyDiff
(
state
*
state
.
State
,
parent
,
block
*
Block
)
(
receipts
Receipts
,
err
error
)
{
func
(
sm
*
BlockManager
)
ApplyDiff
(
state
db
*
state
.
State
,
parent
,
block
*
Block
)
(
receipts
Receipts
,
err
error
)
{
coinbase
:=
state
.
GetOrNewStateObject
(
block
.
Coinbase
)
coinbase
:=
state
db
.
GetOrNewStateObject
(
block
.
Coinbase
)
coinbase
.
SetGasPool
(
block
.
CalcGasLimit
(
parent
))
coinbase
.
SetGasPool
(
block
.
CalcGasLimit
(
parent
))
// Process the transactions on to current block
// Process the transactions on to current block
receipts
,
_
,
_
,
_
,
err
=
sm
.
ProcessTransactions
(
coinbase
,
state
,
block
,
parent
,
block
.
Transactions
())
receipts
,
_
,
_
,
_
,
err
=
sm
.
ProcessTransactions
(
coinbase
,
state
db
,
block
,
parent
,
block
.
Transactions
())
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
}
}
statedb
.
Manifest
()
.
AddMessage
(
&
state
.
Message
{
To
:
block
.
Coinbase
,
From
:
block
.
Coinbase
,
Input
:
nil
,
Origin
:
nil
,
Block
:
block
.
Hash
(),
Timestamp
:
block
.
Time
,
Coinbase
:
block
.
Coinbase
,
Number
:
block
.
Number
,
Value
:
new
(
big
.
Int
),
})
return
receipts
,
nil
return
receipts
,
nil
}
}
...
@@ -303,9 +311,6 @@ func (sm *BlockManager) CalculateTD(block *Block) (*big.Int, bool) {
...
@@ -303,9 +311,6 @@ func (sm *BlockManager) CalculateTD(block *Block) (*big.Int, bool) {
// is greater than the previous.
// is greater than the previous.
if
td
.
Cmp
(
sm
.
bc
.
TD
)
>
0
{
if
td
.
Cmp
(
sm
.
bc
.
TD
)
>
0
{
return
td
,
true
return
td
,
true
// Set the new total difficulty back to the block chain
//sm.bc.SetTotalDifficulty(td)
}
}
return
nil
,
false
return
nil
,
false
...
...
chain/filter.go
View file @
0a22dc2c
...
@@ -175,7 +175,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
...
@@ -175,7 +175,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
var
fromIncluded
,
toIncluded
bool
var
fromIncluded
,
toIncluded
bool
if
len
(
self
.
from
)
>
0
{
if
len
(
self
.
from
)
>
0
{
for
_
,
from
:=
range
self
.
from
{
for
_
,
from
:=
range
self
.
from
{
if
BloomLookup
(
block
.
LogsBloom
,
from
)
{
if
BloomLookup
(
block
.
LogsBloom
,
from
)
||
bytes
.
Equal
(
block
.
Coinbase
,
from
)
{
fromIncluded
=
true
fromIncluded
=
true
break
break
}
}
...
@@ -186,7 +186,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
...
@@ -186,7 +186,7 @@ func (self *Filter) bloomFilter(block *Block) bool {
if
len
(
self
.
to
)
>
0
{
if
len
(
self
.
to
)
>
0
{
for
_
,
to
:=
range
self
.
to
{
for
_
,
to
:=
range
self
.
to
{
if
BloomLookup
(
block
.
LogsBloom
,
ethutil
.
U256
(
new
(
big
.
Int
)
.
Add
(
ethutil
.
Big1
,
ethutil
.
BigD
(
to
)))
.
Bytes
())
{
if
BloomLookup
(
block
.
LogsBloom
,
ethutil
.
U256
(
new
(
big
.
Int
)
.
Add
(
ethutil
.
Big1
,
ethutil
.
BigD
(
to
)))
.
Bytes
())
||
bytes
.
Equal
(
block
.
Coinbase
,
to
)
{
toIncluded
=
true
toIncluded
=
true
break
break
}
}
...
...
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