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
c636f8e3
Commit
c636f8e3
authored
Jan 24, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Broadcast block
parent
7bf4f2a9
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
32 additions
and
0 deletions
+32
-0
dev_console.go
dev_console.go
+32
-0
No files found.
dev_console.go
View file @
c636f8e3
...
...
@@ -9,6 +9,8 @@ import (
"github.com/ethereum/ethchain-go"
"github.com/ethereum/ethdb-go"
"github.com/ethereum/ethutil-go"
"github.com/ethereum/ethwire-go"
"math/big"
"os"
"strings"
)
...
...
@@ -49,6 +51,9 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
case
action
==
"tx"
&&
argumentLength
!=
2
:
err
=
true
expArgCount
=
2
case
action
==
"getaddr"
&&
argumentLength
!=
1
:
err
=
true
expArgCount
=
1
}
if
err
{
...
...
@@ -109,8 +114,35 @@ func (i *Console) ParseInput(input string) bool {
case
"decode"
:
d
,
_
:=
ethutil
.
Decode
([]
byte
(
tokens
[
1
]),
0
)
fmt
.
Printf
(
"%q
\n
"
,
d
)
case
"getaddr"
:
encoded
,
_
:=
hex
.
DecodeString
(
tokens
[
1
])
d
:=
i
.
ethereum
.
BlockManager
.
BlockChain
()
.
LastBlock
.
State
()
.
Get
(
string
(
encoded
))
if
d
!=
""
{
decoder
:=
ethutil
.
NewRlpDecoder
([]
byte
(
d
))
fmt
.
Println
(
decoder
)
}
else
{
fmt
.
Println
(
"getaddr: address unknown"
)
}
case
"encode"
:
fmt
.
Printf
(
"%q
\n
"
,
ethutil
.
Encode
(
tokens
[
1
]))
case
"newblk"
:
block
:=
ethchain
.
CreateBlock
(
i
.
ethereum
.
BlockManager
.
BlockChain
()
.
LastBlock
.
State
()
.
Root
,
i
.
ethereum
.
BlockManager
.
LastBlockHash
,
"123"
,
big
.
NewInt
(
1
),
big
.
NewInt
(
1
),
""
,
i
.
ethereum
.
TxPool
.
Flush
(),
)
i
.
ethereum
.
Broadcast
(
ethwire
.
MsgBlockTy
,
block
.
RlpData
())
//fmt.Println(ethutil.NewRlpValue(block.RlpData()).Get(0))
//err := i.ethereum.BlockManager.ProcessBlock(block)
//if err != nil {
// fmt.Println(err)
//} else {
// }
case
"tx"
:
tx
:=
ethchain
.
NewTransaction
(
tokens
[
1
],
ethutil
.
Big
(
tokens
[
2
]),
[]
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