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
015453f5
Commit
015453f5
authored
Apr 02, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default Value to 0 for NewTxArgs
parent
118ad22e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
10 additions
and
4 deletions
+10
-4
args.go
rpc/args.go
+1
-1
args_test.go
rpc/args_test.go
+9
-3
No files found.
rpc/args.go
View file @
015453f5
...
...
@@ -198,7 +198,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
var
num
int64
if
ext
.
Value
==
nil
{
return
NewValidationError
(
"value"
,
"is required"
)
num
=
0
}
else
{
if
err
:=
numString
(
ext
.
Value
,
&
num
);
err
!=
nil
{
return
err
...
...
rpc/args_test.go
View file @
015453f5
...
...
@@ -500,12 +500,18 @@ func TestNewTxArgsValueMissing(t *testing.T) {
"gasPrice": "0x9184e72a000",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]`
expected
:=
new
(
NewTxArgs
)
expected
.
Value
=
big
.
NewInt
(
0
)
args
:=
new
(
NewTxArgs
)
str
:=
ExpectValidationError
(
json
.
Unmarshal
([]
byte
(
input
),
&
args
))
if
len
(
str
)
>
0
{
t
.
Error
(
str
)
if
err
:=
json
.
Unmarshal
([]
byte
(
input
),
&
args
);
err
!=
nil
{
t
.
Error
(
err
)
}
if
bytes
.
Compare
(
expected
.
Value
.
Bytes
(),
args
.
Value
.
Bytes
())
!=
0
{
t
.
Errorf
(
"Value shoud be %v but is %v"
,
expected
.
Value
,
args
.
Value
)
}
}
func
TestNewTxArgsEmpty
(
t
*
testing
.
T
)
{
...
...
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