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
0ed19d9f
Commit
0ed19d9f
authored
Jun 26, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Logging, variable rearrangement
parent
39cb3485
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
23 additions
and
26 deletions
+23
-26
block_chain.go
ethchain/block_chain.go
+5
-6
vm.go
ethchain/vm.go
+15
-16
ethereum.go
ethereum.go
+2
-2
script.go
ethutil/script.go
+0
-1
trie.go
ethutil/trie.go
+1
-1
No files found.
ethchain/block_chain.go
View file @
0ed19d9f
...
...
@@ -174,18 +174,12 @@ func (bc *BlockChain) ResetTillBlockHash(hash []byte) error {
bc
.
LastBlockHash
=
bc
.
genesisBlock
.
Hash
()
bc
.
LastBlockNumber
=
1
}
else
{
// TODO: Somehow this doesn't really give the right numbers, double check.
// TODO: Change logs into debug lines
returnTo
=
bc
.
GetBlock
(
hash
)
bc
.
CurrentBlock
=
returnTo
bc
.
LastBlockHash
=
returnTo
.
Hash
()
//info := bc.BlockInfo(returnTo)
bc
.
LastBlockNumber
=
returnTo
.
Number
.
Uint64
()
}
// XXX Why are we resetting? This is the block chain, it has nothing to do with states
//bc.Ethereum.StateManager().PrepareDefault(returnTo)
// Manually reset the last sync block
err
:=
ethutil
.
Config
.
Db
.
Delete
(
lastBlock
.
Hash
())
if
err
!=
nil
{
...
...
@@ -231,6 +225,11 @@ func (bc *BlockChain) GetChainFromHash(hash []byte, max uint64) []interface{} {
for
i
:=
uint64
(
0
);
bytes
.
Compare
(
currentHash
,
hash
)
!=
0
&&
num
>=
parentNumber
&&
i
<
count
;
i
++
{
// Get the block of the chain
block
:=
bc
.
GetBlock
(
currentHash
)
if
block
==
nil
{
ethutil
.
Config
.
Log
.
Debugf
(
"Unexpected error during GetChainFromHash: Unable to find %x
\n
"
,
currentHash
)
break
}
currentHash
=
block
.
PrevHash
chain
=
append
(
chain
,
block
.
Value
()
.
Val
)
...
...
ethchain/vm.go
View file @
0ed19d9f
...
...
@@ -99,22 +99,21 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
ethutil
.
Config
.
Log
.
Debugf
(
"[VM] (~) %x gas: %v (d) %x
\n
"
,
closure
.
object
.
Address
(),
closure
.
Gas
,
closure
.
Args
)
// Memory for the current closure
mem
:=
&
Memory
{}
// New stack (should this be shared?)
stack
:=
NewStack
()
require
:=
func
(
m
int
)
{
var
(
op
OpCode
mem
=
&
Memory
{}
stack
=
NewStack
()
pc
=
big
.
NewInt
(
0
)
step
=
0
prevStep
=
0
require
=
func
(
m
int
)
{
if
stack
.
Len
()
<
m
{
isRequireError
=
true
panic
(
fmt
.
Sprintf
(
"stack err = %d, req = %d"
,
stack
.
Len
(),
m
))
panic
(
fmt
.
Sprintf
(
"%04v (%v) stack err size = %d, required = %d"
,
pc
,
op
,
stack
.
Len
(),
m
))
}
}
// Program counter
pc
:=
big
.
NewInt
(
0
)
// Current step count
step
:=
0
prevStep
:=
0
)
for
{
prevStep
=
step
...
...
@@ -125,7 +124,7 @@ func (vm *Vm) RunClosure(closure *Closure, hook DebugHook) (ret []byte, err erro
// Get the memory location of pc
val
:=
closure
.
Get
(
pc
)
// Get the opcode (it must be an opcode!)
op
:
=
OpCode
(
val
.
Uint
())
op
=
OpCode
(
val
.
Uint
())
gas
:=
new
(
big
.
Int
)
addStepGasUsage
:=
func
(
amount
*
big
.
Int
)
{
...
...
ethereum.go
View file @
0ed19d9f
...
...
@@ -340,7 +340,7 @@ func (s *Ethereum) Start(seed bool) {
// Bind to addr and port
ln
,
err
:=
net
.
Listen
(
"tcp"
,
":"
+
s
.
Port
)
if
err
!=
nil
{
log
.
Println
(
"Connection listening disabled. Acting as client
"
)
ethutil
.
Config
.
Log
.
Infof
(
"port=%s in use. Connection listening disabled.
"
)
s
.
listening
=
false
}
else
{
s
.
listening
=
true
...
...
@@ -395,7 +395,7 @@ func (s *Ethereum) Seed() {
peers
=
append
(
peers
,
peer
)
}
}
else
{
ethutil
.
Config
.
Log
.
Debugln
(
"[SERV
}
Couldn't resolve :"
,
target
)
ethutil
.
Config
.
Log
.
Debugln
(
"[SERV
]
Couldn't resolve :"
,
target
)
}
}
// Connect to Peer list
...
...
ethutil/script.go
View file @
0ed19d9f
...
...
@@ -22,7 +22,6 @@ func Compile(script string) (ret []byte, err error) {
}
else
{
compiler
:=
mutan
.
NewCompiler
(
backend
.
NewEthereumBackend
())
byteCode
,
errors
:=
compiler
.
Compile
(
strings
.
NewReader
(
script
))
//byteCode, errors := mutan.Compile(strings.NewReader(script), false)
if
len
(
errors
)
>
0
{
var
errs
string
for
_
,
er
:=
range
errors
{
...
...
ethutil/trie.go
View file @
0ed19d9f
...
...
@@ -47,7 +47,7 @@ func (cache *Cache) Put(v interface{}) interface{} {
value
:=
NewValue
(
v
)
enc
:=
value
.
Encode
()
if
len
(
enc
)
>=
32
{
if
len
(
enc
)
<
32
{
sha
:=
Sha3Bin
(
enc
)
cache
.
nodes
[
string
(
sha
)]
=
NewNode
(
sha
,
value
,
true
)
...
...
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