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
b4eef59b
Commit
b4eef59b
authored
Apr 02, 2015
by
Taylor Gerring
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
No longer require gas & gas price in transactions
Defaults to 0, which is then set to default values in XEth
parent
015453f5
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
8 deletions
+19
-8
args.go
rpc/args.go
+2
-2
args_test.go
rpc/args_test.go
+17
-6
No files found.
rpc/args.go
View file @
b4eef59b
...
...
@@ -207,7 +207,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
args
.
Value
=
big
.
NewInt
(
num
)
if
ext
.
Gas
==
nil
{
return
NewValidationError
(
"gas"
,
"is required"
)
num
=
0
}
else
{
if
err
:=
numString
(
ext
.
Gas
,
&
num
);
err
!=
nil
{
return
err
...
...
@@ -216,7 +216,7 @@ func (args *NewTxArgs) UnmarshalJSON(b []byte) (err error) {
args
.
Gas
=
big
.
NewInt
(
num
)
if
ext
.
GasPrice
==
nil
{
return
NewValidationError
(
"gasprice"
,
"is required"
)
num
=
0
}
else
{
if
err
:=
numString
(
ext
.
GasPrice
,
&
num
);
err
!=
nil
{
return
err
...
...
rpc/args_test.go
View file @
b4eef59b
...
...
@@ -468,11 +468,16 @@ func TestNewTxArgsGasMissing(t *testing.T) {
"value": "0x9184e72a000",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]`
expected
:=
new
(
NewTxArgs
)
expected
.
Gas
=
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
.
Gas
.
Bytes
(),
args
.
Gas
.
Bytes
())
!=
0
{
t
.
Errorf
(
"Gas shoud be %v but is %v"
,
expected
.
Gas
,
args
.
Gas
)
}
}
...
...
@@ -484,12 +489,18 @@ func TestNewTxArgsBlockGaspriceMissing(t *testing.T) {
"value": "0x9184e72a000",
"data": "0xd46e8dd67c5d32be8d46e8dd67c5d32be8058bb8eb970870f072445675058bb8eb970870f072445675"
}]`
expected
:=
new
(
NewTxArgs
)
expected
.
GasPrice
=
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
.
GasPrice
.
Bytes
(),
args
.
GasPrice
.
Bytes
())
!=
0
{
t
.
Errorf
(
"GasPrice shoud be %v but is %v"
,
expected
.
GasPrice
,
args
.
GasPrice
)
}
}
func
TestNewTxArgsValueMissing
(
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