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
f4433a68
Commit
f4433a68
authored
Feb 01, 2014
by
Ramesh Nair
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' into readme
Conflicts: README.md
parents
9cdf8f2c
e28632b9
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
28 deletions
+36
-28
dev_console.go
dev_console.go
+8
-8
ethereum.go
ethereum.go
+28
-20
No files found.
dev_console.go
View file @
f4433a68
...
@@ -76,11 +76,11 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
...
@@ -76,11 +76,11 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
}
}
func
(
i
*
Console
)
PrintRoot
()
{
func
(
i
*
Console
)
PrintRoot
()
{
root
:=
ethutil
.
Conv
(
i
.
trie
.
Root
T
)
root
:=
ethutil
.
Conv
(
i
.
trie
.
Root
)
if
len
(
root
.
AsBytes
())
!=
0
{
if
len
(
root
.
AsBytes
())
!=
0
{
fmt
.
Println
(
hex
.
EncodeToString
(
root
.
AsBytes
()))
fmt
.
Println
(
hex
.
EncodeToString
(
root
.
AsBytes
()))
}
else
{
}
else
{
fmt
.
Println
(
i
.
trie
.
Root
T
)
fmt
.
Println
(
i
.
trie
.
Root
)
}
}
}
}
...
@@ -108,15 +108,15 @@ func (i *Console) ParseInput(input string) bool {
...
@@ -108,15 +108,15 @@ func (i *Console) ParseInput(input string) bool {
}
else
{
}
else
{
switch
tokens
[
0
]
{
switch
tokens
[
0
]
{
case
"update"
:
case
"update"
:
i
.
trie
.
Update
T
(
tokens
[
1
],
tokens
[
2
])
i
.
trie
.
Update
(
tokens
[
1
],
tokens
[
2
])
i
.
PrintRoot
()
i
.
PrintRoot
()
case
"get"
:
case
"get"
:
fmt
.
Println
(
i
.
trie
.
Get
T
(
tokens
[
1
]))
fmt
.
Println
(
i
.
trie
.
Get
(
tokens
[
1
]))
case
"root"
:
case
"root"
:
i
.
PrintRoot
()
i
.
PrintRoot
()
case
"rawroot"
:
case
"rawroot"
:
fmt
.
Println
(
i
.
trie
.
Root
T
)
fmt
.
Println
(
i
.
trie
.
Root
)
case
"print"
:
case
"print"
:
i
.
db
.
Print
()
i
.
db
.
Print
()
case
"dag"
:
case
"dag"
:
...
@@ -124,11 +124,11 @@ func (i *Console) ParseInput(input string) bool {
...
@@ -124,11 +124,11 @@ func (i *Console) ParseInput(input string) bool {
ethutil
.
BigPow
(
2
,
36
),
// diff
ethutil
.
BigPow
(
2
,
36
),
// diff
ethutil
.
Big
(
tokens
[
2
])))
// nonce
ethutil
.
Big
(
tokens
[
2
])))
// nonce
case
"decode"
:
case
"decode"
:
d
,
_
:=
ethutil
.
Decode
([]
byte
(
tokens
[
1
]),
0
)
value
:=
ethutil
.
NewRlpDecoder
([]
byte
(
tokens
[
1
])
)
fmt
.
Print
f
(
"%q
\n
"
,
d
)
fmt
.
Print
ln
(
value
)
case
"getaddr"
:
case
"getaddr"
:
encoded
,
_
:=
hex
.
DecodeString
(
tokens
[
1
])
encoded
,
_
:=
hex
.
DecodeString
(
tokens
[
1
])
d
:=
i
.
ethereum
.
BlockManager
.
CurrentBlock
.
State
()
.
Get
(
string
(
encoded
))
d
:=
i
.
ethereum
.
BlockManager
.
BlockChain
()
.
CurrentBlock
.
State
()
.
Get
(
string
(
encoded
))
if
d
!=
""
{
if
d
!=
""
{
decoder
:=
ethutil
.
NewRlpDecoder
([]
byte
(
d
))
decoder
:=
ethutil
.
NewRlpDecoder
([]
byte
(
d
))
fmt
.
Println
(
decoder
)
fmt
.
Println
(
decoder
)
...
...
ethereum.go
View file @
f4433a68
...
@@ -8,7 +8,6 @@ import (
...
@@ -8,7 +8,6 @@ import (
"github.com/ethereum/ethutil-go"
"github.com/ethereum/ethutil-go"
_
"github.com/ethereum/ethwire-go"
_
"github.com/ethereum/ethwire-go"
"log"
"log"
"math/big"
"os"
"os"
"os/signal"
"os/signal"
"path"
"path"
...
@@ -84,20 +83,28 @@ func main() {
...
@@ -84,20 +83,28 @@ func main() {
ethereum
.
Start
()
ethereum
.
Start
()
if
StartMining
{
if
StartMining
{
blockTime
:=
time
.
Duration
(
1
5
)
blockTime
:=
time
.
Duration
(
1
0
)
log
.
Printf
(
"Dev Test Mining started. Blocks found each %d seconds
\n
"
,
blockTime
)
log
.
Printf
(
"Dev Test Mining started. Blocks found each %d seconds
\n
"
,
blockTime
)
// Fake block mining. It broadcasts a new block every 5 seconds
// Fake block mining. It broadcasts a new block every 5 seconds
go
func
()
{
go
func
()
{
pow
:=
&
ethchain
.
EasyPow
{}
for
{
for
{
txs
:=
ethereum
.
TxPool
.
Flush
()
block
:=
ethereum
.
BlockManager
.
BlockChain
()
.
NewBlock
(
"82c3b0b72cf62f1a9ce97c64da8072efa28225d8"
,
txs
)
nonce
:=
pow
.
Search
(
block
)
block
.
Nonce
=
nonce
log
.
Println
(
"nonce found:"
,
nonce
)
/*
time.Sleep(blockTime * time.Second)
time.Sleep(blockTime * time.Second)
txs
:=
ethereum
.
TxPool
.
Flush
()
block := ethchain.CreateBlock(
block := ethchain.CreateBlock(
ethereum
.
BlockManager
.
CurrentBlock
.
State
()
.
Root
,
ethereum.BlockManager.BlockChain()
.CurrentBlock.State().Root,
ethereum
.
BlockManager
.
LastBlockHash
,
ethereum.BlockManager.BlockChain()
.LastBlockHash,
"123",
"123",
big.NewInt(1),
big.NewInt(1),
big.NewInt(1),
big.NewInt(1),
...
@@ -107,8 +114,9 @@ func main() {
...
@@ -107,8 +114,9 @@ func main() {
if err != nil {
if err != nil {
log.Println(err)
log.Println(err)
} else {
} else {
log
.
Println
(
"
\n
+++++++ MINED BLK +++++++
\n
"
,
block
.
String
())
//
log.Println("\n+++++++ MINED BLK +++++++\n", block.String())
}
}
*/
}
}
}()
}()
}
}
...
...
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