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
cb4d168e
Commit
cb4d168e
authored
Dec 02, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated LOG to match proper gas in all cases
parent
5ebae82e
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
17 additions
and
43 deletions
+17
-43
block_pool.go
block_pool.go
+0
-26
chain_manager.go
chain/chain_manager.go
+3
-2
dagger.go
chain/dagger.go
+9
-5
peer.go
peer.go
+1
-1
types.go
vm/types.go
+1
-7
vm_debug.go
vm/vm_debug.go
+3
-2
No files found.
block_pool.go
View file @
cb4d168e
...
...
@@ -336,32 +336,6 @@ out:
self
.
Remove
(
block
.
Hash
())
}
}
/*
// Test and import
bchain := chain.NewChain(blocks)
_, err := chainManager.TestChain(bchain)
if err != nil && !chain.IsTDError(err) {
poollogger.Debugln(err)
self.Reset()
if self.peer != nil && self.peer.conn != nil {
poollogger.Debugf("Punishing peer for supplying bad chain (%v)\n", self.peer.conn.RemoteAddr())
}
// This peer gave us bad hashes and made us fetch a bad chain, therefor he shall be punished.
self.eth.BlacklistPeer(self.peer)
self.peer.StopWithReason(DiscBadPeer)
self.td = ethutil.Big0
self.peer = nil
} else {
chainManager.InsertChain(bchain)
for _, block := range blocks {
self.Remove(block.Hash())
}
}
*/
}
}
}
...
...
chain/chain_manager.go
View file @
cb4d168e
...
...
@@ -321,7 +321,6 @@ func NewChain(blocks Blocks) *BlockChain {
return
chain
}
// This function assumes you've done your checking. No checking is done at this stage anymore
func
(
self
*
ChainManager
)
InsertChain
(
chain
Blocks
)
error
{
for
_
,
block
:=
range
chain
{
td
,
messages
,
err
:=
self
.
Ethereum
.
BlockManager
()
.
Process
(
block
)
...
...
@@ -330,7 +329,9 @@ func (self *ChainManager) InsertChain(chain Blocks) error {
continue
}
chainlogger
.
Infof
(
"block process failed %v (%x)
\n
"
,
block
.
Number
,
block
.
Hash
()[
:
4
])
chainlogger
.
Infof
(
"block #%v process failed (%x)
\n
"
,
block
.
Number
,
block
.
Hash
()[
:
4
])
chainlogger
.
Infoln
(
block
)
chainlogger
.
Infoln
(
err
)
return
err
}
...
...
chain/dagger.go
View file @
cb4d168e
...
...
@@ -81,13 +81,17 @@ func (pow *EasyPow) Verify(hash []byte, diff *big.Int, nonce []byte) bool {
d
:=
append
(
hash
,
nonce
...
)
sha
.
Write
(
d
)
v
:=
ethutil
.
BigPow
(
2
,
256
)
re
t
:=
new
(
big
.
Int
)
.
Div
(
v
,
diff
)
v
erification
:=
new
(
big
.
Int
)
.
Div
(
ethutil
.
BigPow
(
2
,
256
),
diff
)
re
s
:=
ethutil
.
U256
(
ethutil
.
BigD
(
sha
.
Sum
(
nil
))
)
res
:=
new
(
big
.
Int
)
res
.
SetBytes
(
sha
.
Sum
(
nil
))
/*
fmt.Printf("hash w/o nonce %x\n", hash)
fmt.Printf("2**256 / %v = %v\n", diff, verification)
fmt.Printf("%v <= %v\n", res, verification)
fmt.Printf("vlen: %d rlen: %d\n", len(verification.Bytes()), len(res.Bytes()))
*/
return
res
.
Cmp
(
ret
)
==
-
1
return
res
.
Cmp
(
verification
)
<=
0
}
func
(
pow
*
EasyPow
)
SetHash
(
hash
*
big
.
Int
)
{
...
...
peer.go
View file @
cb4d168e
...
...
@@ -24,7 +24,7 @@ const (
// The size of the output buffer for writing messages
outputBufferSize
=
50
// Current protocol version
ProtocolVersion
=
4
5
ProtocolVersion
=
4
6
// Current P2P version
P2PVersion
=
2
// Ethereum network version
...
...
vm/types.go
View file @
cb4d168e
...
...
@@ -163,8 +163,8 @@ const (
// 0xf0 range - closures
CREATE
OpCode
=
0xf0
+
iota
CALL
RETURN
CALLCODE
RETURN
// 0x70 range - other
SUICIDE
=
0xff
...
...
@@ -309,12 +309,6 @@ var opCodeToString = map[OpCode]string{
SWAP15
:
"SWAP15"
,
SWAP16
:
"SWAP16"
,
LOG0
:
"LOG0"
,
LOG1
:
"LOG1"
,
LOG2
:
"LOG2"
,
LOG3
:
"LOG3"
,
LOG4
:
"LOG4"
,
// 0xf0 range
CREATE
:
"CREATE"
,
CALL
:
"CALL"
,
...
...
vm/vm_debug.go
View file @
cb4d168e
...
...
@@ -165,10 +165,11 @@ func (self *DebugVm) RunClosure(closure *Closure) (ret []byte, err error) {
n
:=
int
(
op
-
LOG0
)
require
(
n
+
2
)
mSize
,
mStart
:=
stack
.
Peekn
()
gas
.
Set
(
GasLog
)
addStepGasUsage
(
new
(
big
.
Int
)
.
Mul
(
big
.
NewInt
(
int64
(
n
)),
GasLog
))
addStepGasUsage
(
new
(
big
.
Int
)
.
Add
(
mSize
,
mStart
))
mSize
,
_
:=
stack
.
Peekn
()
addStepGasUsage
(
mSize
)
case
EXP
:
require
(
2
)
...
...
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