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
db7c34a9
Commit
db7c34a9
authored
Feb 05, 2015
by
obscuren
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Default gas price and default gas for rpc
parent
a1b4547a
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
15 additions
and
18 deletions
+15
-18
coin.html
cmd/mist/assets/examples/coin.html
+2
-2
pow.go
pow/ezp/pow.go
+0
-2
args.go
rpc/args.go
+0
-10
packages.go
rpc/packages.go
+13
-4
No files found.
cmd/mist/assets/examples/coin.html
View file @
db7c34a9
...
@@ -62,7 +62,7 @@
...
@@ -62,7 +62,7 @@
],
],
}];
}];
var
address
=
""
;
//
web3.db.get("jevcoin", "address");
var
address
=
web3
.
db
.
get
(
"jevcoin"
,
"address"
);
if
(
address
.
length
==
0
)
{
if
(
address
.
length
==
0
)
{
var
code
=
"0x60056011565b60b88060356000396000f35b64e8d4a51000600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a68146028578063d0679d34146034578063e3d670d714604657005b602e60b3565b60006000f35b60406004356024356059565b60006000f35b604f6004356091565b8060005260206000f35b8060005281600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660206000a25050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156"
;
var
code
=
"0x60056011565b60b88060356000396000f35b64e8d4a51000600033600160a060020a0316600052602052604060002081905550560060e060020a6000350480637bb98a68146028578063d0679d34146034578063e3d670d714604657005b602e60b3565b60006000f35b60406004356024356059565b60006000f35b604f6004356091565b8060005260206000f35b8060005281600160a060020a03167fb52dda022b6c1a1f40905a85f257f689aa5d69d850e49cf939d688fbe5af594660206000a25050565b6000600082600160a060020a03166000526020526040600020549050919050565b5b60008156"
;
address
=
web3
.
eth
.
transact
({
address
=
web3
.
eth
.
transact
({
...
@@ -77,7 +77,7 @@
...
@@ -77,7 +77,7 @@
contract
.
Changed
({
to
:
"0xaa"
}).
changed
(
function
(
e
)
{
contract
.
Changed
({
to
:
"0xaa"
}).
changed
(
function
(
e
)
{
console
.
log
(
"e: "
+
JSON
.
stringify
(
e
));
console
.
log
(
"e: "
+
JSON
.
stringify
(
e
));
});
});
contract
.
transact
({
gas
:
"10000"
,
gasprice
:
eth
.
gasPrice
}).
send
(
"0xaa"
,
10000
);
contract
.
send
(
"0xaa"
,
10000
);
function
reflesh
()
{
function
reflesh
()
{
document
.
querySelector
(
"#balance"
).
innerHTML
=
contract
.
balance
(
eth
.
coinbase
);
document
.
querySelector
(
"#balance"
).
innerHTML
=
contract
.
balance
(
eth
.
coinbase
);
...
...
pow/ezp/pow.go
View file @
db7c34a9
package
ezp
package
ezp
import
(
import
(
"fmt"
"math/big"
"math/big"
"math/rand"
"math/rand"
"time"
"time"
...
@@ -60,7 +59,6 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
...
@@ -60,7 +59,6 @@ func (pow *EasyPow) Search(block pow.Block, stop <-chan struct{}) []byte {
sha
:=
crypto
.
Sha3
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
sha
:=
crypto
.
Sha3
(
big
.
NewInt
(
r
.
Int63
())
.
Bytes
())
if
verify
(
hash
,
diff
,
sha
)
{
if
verify
(
hash
,
diff
,
sha
)
{
fmt
.
Printf
(
"HASH: %x
\n
DIFF %v
\n
SHA %x
\n
"
,
hash
,
diff
,
sha
)
return
sha
return
sha
}
}
}
}
...
...
rpc/args.go
View file @
db7c34a9
...
@@ -37,16 +37,6 @@ type NewTxArgs struct {
...
@@ -37,16 +37,6 @@ type NewTxArgs struct {
Data
string
`json:"data"`
Data
string
`json:"data"`
}
}
func
(
a
*
NewTxArgs
)
requirements
()
error
{
if
a
.
Gas
==
""
{
return
NewErrorResponse
(
"Transact requires a 'gas' value as argument"
)
}
if
a
.
GasPrice
==
""
{
return
NewErrorResponse
(
"Transact requires a 'gasprice' value as argument"
)
}
return
nil
}
type
PushTxArgs
struct
{
type
PushTxArgs
struct
{
Tx
string
`json:"tx"`
Tx
string
`json:"tx"`
}
}
...
...
rpc/packages.go
View file @
db7c34a9
...
@@ -40,6 +40,11 @@ import (
...
@@ -40,6 +40,11 @@ import (
"github.com/ethereum/go-ethereum/xeth"
"github.com/ethereum/go-ethereum/xeth"
)
)
const
(
defaultGasPrice
=
"10000000000000"
defaultGas
=
"10000"
)
type
EthereumApi
struct
{
type
EthereumApi
struct
{
xeth
*
xeth
.
XEth
xeth
*
xeth
.
XEth
filterManager
*
filter
.
FilterManager
filterManager
*
filter
.
FilterManager
...
@@ -116,10 +121,14 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
...
@@ -116,10 +121,14 @@ func (p *EthereumApi) GetBlock(args *GetBlockArgs, reply *interface{}) error {
}
}
func
(
p
*
EthereumApi
)
Transact
(
args
*
NewTxArgs
,
reply
*
interface
{})
error
{
func
(
p
*
EthereumApi
)
Transact
(
args
*
NewTxArgs
,
reply
*
interface
{})
error
{
err
:=
args
.
requirements
()
if
len
(
args
.
Gas
)
==
0
{
if
err
!=
nil
{
args
.
Gas
=
defaultGas
return
err
}
if
len
(
args
.
GasPrice
)
==
0
{
args
.
GasPrice
=
defaultGasPrice
}
}
result
,
_
:=
p
.
xeth
.
Transact
(
/* TODO specify account */
args
.
To
,
args
.
Value
,
args
.
Gas
,
args
.
GasPrice
,
args
.
Data
)
result
,
_
:=
p
.
xeth
.
Transact
(
/* TODO specify account */
args
.
To
,
args
.
Value
,
args
.
Gas
,
args
.
GasPrice
,
args
.
Data
)
*
reply
=
result
*
reply
=
result
return
nil
return
nil
...
@@ -387,7 +396,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
...
@@ -387,7 +396,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
}
return
p
.
FilterChanged
(
args
,
reply
)
return
p
.
FilterChanged
(
args
,
reply
)
case
"eth_gasPrice"
:
case
"eth_gasPrice"
:
*
reply
=
"10000000000000"
*
reply
=
defaultGasPrice
return
nil
return
nil
case
"web3_sha3"
:
case
"web3_sha3"
:
args
,
err
:=
req
.
ToSha3Args
()
args
,
err
:=
req
.
ToSha3Args
()
...
...
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