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
1676930a
Commit
1676930a
authored
Jan 05, 2014
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated testing"
parent
40dc4d02
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
6 deletions
+5
-6
parsing_test.go
parsing_test.go
+2
-2
testing.go
testing.go
+2
-1
transaction.go
transaction.go
+1
-3
No files found.
parsing_test.go
View file @
1676930a
...
@@ -6,13 +6,13 @@ import (
...
@@ -6,13 +6,13 @@ import (
)
)
func
TestCompile
(
t
*
testing
.
T
)
{
func
TestCompile
(
t
*
testing
.
T
)
{
instr
,
err
:=
CompileInstr
(
"
SET 10 1
"
)
instr
,
err
:=
CompileInstr
(
"
PUSH
"
)
if
err
!=
nil
{
if
err
!=
nil
{
t
.
Error
(
"Failed compiling instruction"
)
t
.
Error
(
"Failed compiling instruction"
)
}
}
calc
:=
(
67
+
10
*
256
+
1
*
int64
(
math
.
Pow
(
256
,
2
)))
calc
:=
(
48
+
0
*
256
+
0
*
int64
(
math
.
Pow
(
256
,
2
)))
if
Big
(
instr
)
.
Int64
()
!=
calc
{
if
Big
(
instr
)
.
Int64
()
!=
calc
{
t
.
Error
(
"Expected"
,
calc
,
", got:"
,
instr
)
t
.
Error
(
"Expected"
,
calc
,
", got:"
,
instr
)
}
}
...
...
testing.go
View file @
1676930a
...
@@ -13,8 +13,9 @@ func Testing() {
...
@@ -13,8 +13,9 @@ func Testing() {
bm
:=
NewBlockManager
()
bm
:=
NewBlockManager
()
tx
:=
NewTransaction
(
"
\x00
"
,
20
,
[]
string
{
"P
SH 10
"
})
tx
:=
NewTransaction
(
"
\x00
"
,
20
,
[]
string
{
"P
USH
"
})
txData
:=
tx
.
MarshalRlp
()
txData
:=
tx
.
MarshalRlp
()
fmt
.
Printf
(
"%q
\n
"
,
txData
)
copyTx
:=
&
Transaction
{}
copyTx
:=
&
Transaction
{}
copyTx
.
UnmarshalRlp
(
txData
)
copyTx
.
UnmarshalRlp
(
txData
)
...
...
transaction.go
View file @
1676930a
...
@@ -2,7 +2,7 @@ package main
...
@@ -2,7 +2,7 @@ package main
import
(
import
(
"math/big"
"math/big"
"fmt"
_
"fmt"
"github.com/obscuren/secp256k1-go"
"github.com/obscuren/secp256k1-go"
_
"encoding/hex"
_
"encoding/hex"
_
"crypto/sha256"
_
"crypto/sha256"
...
@@ -140,7 +140,6 @@ func (tx *Transaction) MarshalRlp() []byte {
...
@@ -140,7 +140,6 @@ func (tx *Transaction) MarshalRlp() []byte {
func
(
tx
*
Transaction
)
UnmarshalRlp
(
data
[]
byte
)
{
func
(
tx
*
Transaction
)
UnmarshalRlp
(
data
[]
byte
)
{
t
,
_
:=
Decode
(
data
,
0
)
t
,
_
:=
Decode
(
data
,
0
)
if
slice
,
ok
:=
t
.
([]
interface
{});
ok
{
if
slice
,
ok
:=
t
.
([]
interface
{});
ok
{
fmt
.
Printf
(
"NONCE %T
\n
"
,
slice
[
3
])
if
nonce
,
ok
:=
slice
[
0
]
.
(
uint8
);
ok
{
if
nonce
,
ok
:=
slice
[
0
]
.
(
uint8
);
ok
{
tx
.
nonce
=
string
(
nonce
)
tx
.
nonce
=
string
(
nonce
)
}
}
...
@@ -186,7 +185,6 @@ func (tx *Transaction) UnmarshalRlp(data []byte) {
...
@@ -186,7 +185,6 @@ func (tx *Transaction) UnmarshalRlp(data []byte) {
}
}
// vrs
// vrs
fmt
.
Printf
(
"v %T
\n
"
,
slice
[
5
])
if
v
,
ok
:=
slice
[
5
]
.
(
uint8
);
ok
{
if
v
,
ok
:=
slice
[
5
]
.
(
uint8
);
ok
{
tx
.
v
=
uint32
(
v
)
tx
.
v
=
uint32
(
v
)
}
}
...
...
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