aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2015-01-30 06:17:43 +0800
committerobscuren <geffobscura@gmail.com>2015-01-30 06:17:43 +0800
commit9022f5034f952405d02f89c905104c80f0c13b8f (patch)
treeff5f31857ea1f422d932986260d382beb57bc5dc
parentbd992e7baf5da01e97fe4e0c85184716daafa7e5 (diff)
downloadgo-tangerine-9022f5034f952405d02f89c905104c80f0c13b8f.tar.gz
go-tangerine-9022f5034f952405d02f89c905104c80f0c13b8f.tar.zst
go-tangerine-9022f5034f952405d02f89c905104c80f0c13b8f.zip
default values removed
-rw-r--r--cmd/mist/assets/examples/coin.html30
-rw-r--r--rpc/packages.go2
-rw-r--r--trie/encoding.go6
-rw-r--r--trie/node.go2
4 files changed, 24 insertions, 16 deletions
diff --git a/cmd/mist/assets/examples/coin.html b/cmd/mist/assets/examples/coin.html
index 297d7e042..93edfd6f6 100644
--- a/cmd/mist/assets/examples/coin.html
+++ b/cmd/mist/assets/examples/coin.html
@@ -53,12 +53,17 @@
"outputs": []
}];
- var code = "0x60056011565b60ae8060356000396000f35b64174876e800600033600160a060020a031660005260205260406000208190555056006001600060e060020a600035048063d0679d34146022578063e3d670d714603457005b602e6004356024356047565b60006000f35b603d600435608d565b8060005260206000f35b80600083600160a060020a0316600052602052604060002090815401908190555080600033600160a060020a031660005260205260406000209081540390819055505050565b6000600082600160a060020a0316600052602052604060002054905091905056";
- var address = web3.eth.transact({
- data: code,
- gasprice: "1000000000000000",
- gas: "10000",
- });
+ var address = web3.db.get("jevcoin", "address");
+ if( address.length == 0 ) {
+ var code = "0x60056011565b60ae8060356000396000f35b64174876e800600033600160a060020a031660005260205260406000208190555056006001600060e060020a600035048063d0679d34146022578063e3d670d714603457005b602e6004356024356047565b60006000f35b603d600435608d565b8060005260206000f35b80600083600160a060020a0316600052602052604060002090815401908190555080600033600160a060020a031660005260205260406000209081540390819055505050565b6000600082600160a060020a0316600052602052604060002054905091905056";
+ address = web3.eth.transact({
+ data: code,
+ gasprice: "1000000000000000",
+ gas: "10000",
+ });
+ web3.db.put("jevcoin", "address", address);
+ }
+
var contract = web3.eth.contract(address, desc);
document.querySelector("#balance").innerHTML = contract.call().balance(eth.coinbase);
@@ -73,13 +78,16 @@
}
function transact() {
- //var to = "0x"+document.querySelector("#address").value;
- var to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3";
- console.log("to "+to);
+ var to = document.querySelector("#address").value;
+ if( to.length == 0 ) {
+ to = "0x4205b06c2cfa0e30359edcab94543266cb6fa1d3";
+ } else {
+ to = "0x"+to;
+ }
+
var value = parseInt( document.querySelector("#amount").value );
- console.log("value "+value);
- contract.transact({gas: "10000", gasPrice: "1000000000000"}).send( to, value );
+ contract.transact({gas: "10000", gasprice: eth.gasPrice}).send( to, value );
}
reflesh();
diff --git a/rpc/packages.go b/rpc/packages.go
index 6136adf49..aa51aad42 100644
--- a/rpc/packages.go
+++ b/rpc/packages.go
@@ -334,7 +334,7 @@ func (p *EthereumApi) GetRequestReply(req *RpcRequest, reply *interface{}) error
}
return p.FilterChanged(args, reply)
case "eth_gasPrice":
- *reply = "1000000000000000"
+ *reply = "10000000000000"
return nil
case "web3_sha3":
args, err := req.ToSha3Args()
diff --git a/trie/encoding.go b/trie/encoding.go
index 4906bc90b..94ea184c9 100644
--- a/trie/encoding.go
+++ b/trie/encoding.go
@@ -49,7 +49,7 @@ func CompactDecode(str string) []byte {
func CompactHexDecode(str string) []byte {
base := "0123456789abcdef"
- hexSlice := make([]byte, 0)
+ var hexSlice []byte
enc := hex.EncodeToString([]byte(str))
for _, v := range enc {
@@ -61,7 +61,7 @@ func CompactHexDecode(str string) []byte {
}
func DecodeCompact(key []byte) string {
- base := "0123456789abcdef"
+ const base = "0123456789abcdef"
var str string
for _, v := range key {
@@ -70,7 +70,7 @@ func DecodeCompact(key []byte) string {
}
}
- res, _ := hex.DecodeString(str)
+ res, err := hex.DecodeString(str)
return string(res)
}
diff --git a/trie/node.go b/trie/node.go
index a1f68480f..f28f24771 100644
--- a/trie/node.go
+++ b/trie/node.go
@@ -18,7 +18,7 @@ func (self *ValueNode) String() string { return self.fstring("") }
func (self *FullNode) String() string { return self.fstring("") }
func (self *ShortNode) String() string { return self.fstring("") }
func (self *ValueNode) fstring(ind string) string { return fmt.Sprintf("%x ", self.data) }
-func (self *HashNode) fstring(ind string) string { return fmt.Sprintf("%x ", self.key) }
+func (self *HashNode) fstring(ind string) string { return fmt.Sprintf("< %x > ", self.key) }
// Full node
func (self *FullNode) fstring(ind string) string {