aboutsummaryrefslogtreecommitdiffstats
path: root/ethereal
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-06-05 15:01:10 +0800
committerobscuren <geffobscura@gmail.com>2014-06-05 15:01:10 +0800
commita107a5db052c53f54e4023111a8cc97fbf6f51e2 (patch)
treefbdd3e932c48a4ff233ff3df5c5569ed52011e5f /ethereal
parent964587b14a52f5a64c166fe28cc5a51eb2bac1c7 (diff)
parent7843390ecd52df37a28282d76be198d5456ce385 (diff)
downloadgo-tangerine-a107a5db052c53f54e4023111a8cc97fbf6f51e2.tar.gz
go-tangerine-a107a5db052c53f54e4023111a8cc97fbf6f51e2.tar.zst
go-tangerine-a107a5db052c53f54e4023111a8cc97fbf6f51e2.zip
Merge branch 'develop' of github.com-obscure:ethereum/go-ethereum into develop
Diffstat (limited to 'ethereal')
-rw-r--r--ethereal/assets/ext/ethereum.js4
-rw-r--r--ethereal/assets/qml/wallet.qml78
-rw-r--r--ethereal/assets/qml/webapp.qml9
-rw-r--r--ethereal/ui/gui.go30
4 files changed, 115 insertions, 6 deletions
diff --git a/ethereal/assets/ext/ethereum.js b/ethereal/assets/ext/ethereum.js
index d4eaf97fd..c58fe24c2 100644
--- a/ethereal/assets/ext/ethereum.js
+++ b/ethereal/assets/ext/ethereum.js
@@ -32,6 +32,10 @@ window.eth = {
postData({call: "getStorage", args: [address, storageAddress]}, cb);
},
+ getStateKeyVals: function(address, cb){
+ postData({call: "getStateKeyVals", args: [address]}, cb);
+ },
+
getKey: function(cb) {
postData({call: "getKey"}, cb);
},
diff --git a/ethereal/assets/qml/wallet.qml b/ethereal/assets/qml/wallet.qml
index bbb147d89..fece8e7d6 100644
--- a/ethereal/assets/qml/wallet.qml
+++ b/ethereal/assets/qml/wallet.qml
@@ -45,6 +45,13 @@ ApplicationWindow {
addPeerWin.visible = true
}
}
+ MenuItem {
+ text: "Show Peers"
+ shortcut: "Ctrl+e"
+ onTriggered: {
+ peerWindow.visible = true
+ }
+ }
}
Menu {
@@ -247,13 +254,12 @@ ApplicationWindow {
}
}
-
property var addressModel: ListModel {
id: addressModel
}
TableView {
id: addressView
- width: parent.width
+ width: parent.width - 200
height: 200
anchors.bottom: logView.top
TableViewColumn{ role: "name"; title: "name" }
@@ -262,6 +268,30 @@ ApplicationWindow {
model: addressModel
}
+ Rectangle {
+ anchors.top: addressView.top
+ anchors.left: addressView.right
+ anchors.leftMargin: 20
+
+ TextField {
+ placeholderText: "Name to register"
+ id: nameToReg
+ width: 150
+ }
+
+ Button {
+ anchors.top: nameToReg.bottom
+ text: "Register"
+ MouseArea{
+ anchors.fill: parent
+ onClicked: {
+ eth.registerName(nameToReg.text)
+ nameToReg.text = ""
+ }
+ }
+ }
+ }
+
property var logModel: ListModel {
id: logModel
@@ -359,6 +389,10 @@ ApplicationWindow {
id: peerImage
anchors.right: parent.right
width: 10; height: 10
+ MouseArea {
+ onDoubleClicked: peerWindow.visible = true
+ anchors.fill: parent
+ }
source: ui.assetPath("network.png")
}
}
@@ -623,6 +657,20 @@ ApplicationWindow {
function setPeers(text) {
peerLabel.text = text
}
+
+ function addPeer(peer) {
+ // We could just append the whole peer object but it cries if you try to alter them
+ peerModel.append({ip: peer.ip, port: peer.port, lastResponse:timeAgo(peer.lastSend), latency: peer.latency, version: peer.version})
+ }
+
+ function resetPeers(){
+ peerModel.clear()
+ }
+
+ function timeAgo(unixTs){
+ var lapsed = (Date.now() - new Date(unixTs*1000)) / 1000
+ return (lapsed + " seconds ago")
+ }
function convertToPretty(unixTs){
var a = new Date(unixTs*1000);
var months = ['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'];
@@ -635,6 +683,31 @@ ApplicationWindow {
var time = date+' '+month+' '+year+' '+hour+':'+min+':'+sec ;
return time;
}
+ // ******************************************
+ // Windows
+ // ******************************************
+ Window {
+ id: peerWindow
+ height: 200
+ width: 700
+ Rectangle {
+ anchors.fill: parent
+ property var peerModel: ListModel {
+ id: peerModel
+ }
+ TableView {
+ anchors.fill: parent
+ id: peerTable
+ model: peerModel
+ TableViewColumn{width: 100; role: "ip" ; title: "IP" }
+ TableViewColumn{width: 60; role: "port" ; title: "Port" }
+ TableViewColumn{width: 140; role: "lastResponse"; title: "Last event" }
+ TableViewColumn{width: 100; role: "latency"; title: "Latency" }
+ TableViewColumn{width: 260; role: "version" ; title: "Version" }
+ }
+ }
+ }
+
// *******************************************
// Components
// *******************************************
@@ -810,7 +883,6 @@ ApplicationWindow {
}
}
}
-
// New Transaction component
Component {
id: newTransaction
diff --git a/ethereal/assets/qml/webapp.qml b/ethereal/assets/qml/webapp.qml
index d3cffeeca..ec236a18c 100644
--- a/ethereal/assets/qml/webapp.qml
+++ b/ethereal/assets/qml/webapp.qml
@@ -34,7 +34,6 @@ ApplicationWindow {
top: parent.top
}
*/
-
onTitleChanged: { window.title = title }
experimental.preferences.javascriptEnabled: true
experimental.preferences.navigatorQtObjectEnabled: true
@@ -98,6 +97,12 @@ ApplicationWindow {
postData(data._seed, storage)
break
+ case "getStateKeyVals":
+ require(1);
+ var stateObject = eth.getStateObject(data.args[0]).stateKeyVal(true)
+ postData(data._seed,stateObject)
+
+ break
case "getBalance":
require(1);
@@ -188,7 +193,7 @@ ApplicationWindow {
WebView {
id: inspector
- visible: false
+ visible: true
url: webview.experimental.remoteInspectorUrl
anchors {
left: root.left
diff --git a/ethereal/ui/gui.go b/ethereal/ui/gui.go
index 44215efdb..4dda5017f 100644
--- a/ethereal/ui/gui.go
+++ b/ethereal/ui/gui.go
@@ -12,6 +12,7 @@ import (
"github.com/go-qml/qml"
"math/big"
"strings"
+ "time"
)
type Gui struct {
@@ -64,6 +65,8 @@ func (gui *Gui) Start(assetPath string) {
Init: func(p *ethpub.PBlock, obj qml.Object) { p.Number = 0; p.Hash = "" },
}, {
Init: func(p *ethpub.PTx, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
+ }, {
+ Init: func(p *ethpub.KeyVal, obj qml.Object) { p.Key = ""; p.Value = "" },
}})
ethutil.Config.SetClientString(fmt.Sprintf("/Ethereal v%s", version))
@@ -91,7 +94,7 @@ func (gui *Gui) Start(assetPath string) {
ethutil.Config.Log.AddLogSystem(gui)
}
if err != nil {
- ethutil.Config.Log.Infoln("FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'")
+ ethutil.Config.Log.Infoln("FATAL: asset not found: you can set an alternative asset path on on the command line using option 'asset_path'", err)
panic(err)
}
@@ -162,6 +165,17 @@ func (gui *Gui) setInitialBlockChain() {
blk := gui.eth.BlockChain().GetBlock(sBlk)
for ; blk != nil; blk = gui.eth.BlockChain().GetBlock(sBlk) {
sBlk = blk.PrevHash
+
+ // Loop through all transactions to see if we missed any while being offline
+ for _, tx := range blk.Transactions() {
+ if bytes.Compare(tx.Sender(), gui.addr) == 0 || bytes.Compare(tx.Recipient, gui.addr) == 0 {
+ if ok, _ := gui.txDb.Get(tx.Hash()); ok == nil {
+ gui.txDb.Put(tx.Hash(), tx.RlpEncode())
+ }
+
+ }
+ }
+
gui.processBlock(blk, true)
}
}
@@ -235,6 +249,8 @@ func (gui *Gui) update() {
reactor.Subscribe("object:"+string(namereg), objectChan)
reactor.Subscribe("peerList", peerChan)
+ ticker := time.NewTicker(5 * time.Second)
+
state := gui.eth.StateManager().TransState()
unconfirmedFunds := new(big.Int)
@@ -284,12 +300,19 @@ func (gui *Gui) update() {
gui.loadAddressBook()
case <-peerChan:
gui.setPeerInfo()
+ case <-ticker.C:
+ gui.setPeerInfo()
}
}
}
func (gui *Gui) setPeerInfo() {
gui.win.Root().Call("setPeers", fmt.Sprintf("%d / %d", gui.eth.PeerCount(), gui.eth.MaxPeers))
+
+ gui.win.Root().Call("resetPeers")
+ for _, peer := range gui.pub.GetPeers() {
+ gui.win.Root().Call("addPeer", peer)
+ }
}
// Logging functions that log directly to the GUI interface
@@ -308,6 +331,11 @@ func (gui *Gui) Printf(format string, v ...interface{}) {
gui.win.Root().Call("addLog", line)
}
}
+func (gui *Gui) RegisterName(name string) {
+ keyPair := ethutil.GetKeyRing().Get(0)
+ name = fmt.Sprintf("\"%s\"\n1", name)
+ gui.pub.Transact(ethutil.Hex(keyPair.PrivateKey), "namereg", "1000", "1000000", "150", name)
+}
func (gui *Gui) Transact(recipient, value, gas, gasPrice, data string) (*ethpub.PReceipt, error) {
keyPair := ethutil.GetKeyRing().Get(0)