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
e65c4ee9
Commit
e65c4ee9
authored
Mar 27, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated transaction constructor
parent
642630db
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
15 deletions
+11
-15
.gitignore
.gitignore
+1
-0
dev_console.go
ethereum/dev_console.go
+10
-15
No files found.
.gitignore
View file @
e65c4ee9
...
@@ -9,4 +9,5 @@
...
@@ -9,4 +9,5 @@
*un~
*un~
.DS_Store
.DS_Store
*/**/.DS_Store
*/**/.DS_Store
./ethereum/ethereum
ethereum/dev_console.go
View file @
e65c4ee9
...
@@ -11,6 +11,7 @@ import (
...
@@ -11,6 +11,7 @@ import (
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethdb"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethutil"
"github.com/ethereum/eth-go/ethwire"
"github.com/ethereum/eth-go/ethwire"
"github.com/obscuren/mutan"
_
"math/big"
_
"math/big"
"os"
"os"
"strings"
"strings"
...
@@ -58,9 +59,9 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
...
@@ -58,9 +59,9 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
case
action
==
"getaddr"
&&
argumentLength
!=
1
:
case
action
==
"getaddr"
&&
argumentLength
!=
1
:
err
=
true
err
=
true
expArgCount
=
1
expArgCount
=
1
case
action
==
"contract"
&&
argumentLength
!=
1
:
case
action
==
"contract"
&&
argumentLength
!=
2
:
err
=
true
err
=
true
expArgCount
=
1
expArgCount
=
2
case
action
==
"say"
&&
argumentLength
!=
1
:
case
action
==
"say"
&&
argumentLength
!=
1
:
err
=
true
err
=
true
expArgCount
=
1
expArgCount
=
1
...
@@ -79,7 +80,7 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
...
@@ -79,7 +80,7 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
}
}
}
}
func
(
i
*
Console
)
Editor
()
[]
string
{
func
(
i
*
Console
)
Editor
()
string
{
var
buff
bytes
.
Buffer
var
buff
bytes
.
Buffer
for
{
for
{
reader
:=
bufio
.
NewReader
(
os
.
Stdin
)
reader
:=
bufio
.
NewReader
(
os
.
Stdin
)
...
@@ -94,15 +95,7 @@ func (i *Console) Editor() []string {
...
@@ -94,15 +95,7 @@ func (i *Console) Editor() []string {
}
}
}
}
scanner
:=
bufio
.
NewScanner
(
strings
.
NewReader
(
buff
.
String
()))
return
buff
.
String
()
scanner
.
Split
(
bufio
.
ScanLines
)
var
lines
[]
string
for
scanner
.
Scan
()
{
lines
=
append
(
lines
,
scanner
.
Text
())
}
return
lines
}
}
func
(
i
*
Console
)
PrintRoot
()
{
func
(
i
*
Console
)
PrintRoot
()
{
...
@@ -178,7 +171,7 @@ func (i *Console) ParseInput(input string) bool {
...
@@ -178,7 +171,7 @@ func (i *Console) ParseInput(input string) bool {
if
err
!=
nil
{
if
err
!=
nil
{
fmt
.
Println
(
"recipient err:"
,
err
)
fmt
.
Println
(
"recipient err:"
,
err
)
}
else
{
}
else
{
tx
:=
ethchain
.
NewT
ransaction
(
recipient
,
ethutil
.
Big
(
tokens
[
2
]),
[]
string
{
""
})
tx
:=
ethchain
.
NewT
x
(
recipient
,
ethutil
.
Big
(
tokens
[
2
]),
[]
string
{
""
})
key
:=
ethutil
.
Config
.
Db
.
GetKeys
()[
0
]
key
:=
ethutil
.
Config
.
Db
.
GetKeys
()[
0
]
tx
.
Sign
(
key
.
PrivateKey
)
tx
.
Sign
(
key
.
PrivateKey
)
...
@@ -197,9 +190,11 @@ func (i *Console) ParseInput(input string) bool {
...
@@ -197,9 +190,11 @@ func (i *Console) ParseInput(input string) bool {
}
}
case
"contract"
:
case
"contract"
:
fmt
.
Println
(
"Contract editor (Ctrl-D = done)"
)
fmt
.
Println
(
"Contract editor (Ctrl-D = done)"
)
code
:=
ethchain
.
Compile
(
i
.
Editor
())
asm
:=
mutan
.
NewCompiler
()
.
Compile
(
strings
.
NewReader
(
i
.
Editor
()))
code
:=
ethutil
.
Assemble
(
asm
)
contract
:=
ethchain
.
New
Transaction
(
ethchain
.
ContractAddr
,
ethutil
.
Big
(
tokens
[
1
]),
code
)
contract
:=
ethchain
.
New
ContractCreationTx
(
ethutil
.
Big
(
tokens
[
0
])
,
ethutil
.
Big
(
tokens
[
1
]),
code
)
key
:=
ethutil
.
Config
.
Db
.
GetKeys
()[
0
]
key
:=
ethutil
.
Config
.
Db
.
GetKeys
()[
0
]
contract
.
Sign
(
key
.
PrivateKey
)
contract
.
Sign
(
key
.
PrivateKey
)
...
...
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