From 0db86e4485176aff7c45f0ce673174ec8407c0fc Mon Sep 17 00:00:00 2001
From: obscuren <geffobscura@gmail.com>
Date: Fri, 21 Mar 2014 11:16:41 +0100
Subject: [PATCH] Updated to work with the new chain

---
 Makefile      | 5 +++--
 ethereum.go   | 7 +++++--
 ui/gui.go     | 1 +
 ui/library.go | 6 +++---
 4 files changed, 12 insertions(+), 7 deletions(-)

diff --git a/Makefile b/Makefile
index 4da4c551c..02d127963 100644
--- a/Makefile
+++ b/Makefile
@@ -7,11 +7,12 @@ all:
 install:
 # Linux build
 ifeq ($(UNAME),Linux)
-	mkdir /usr/local/ethereal
-	files=(wallet.qml net.png network.png new.png tx.png)
+	mkdir -p /usr/local/ethereal
+	files=(net.png network.png new.png tx.png)
 	for file in "${files[@]}"; do
 		cp $file /usr/share/ethereal
 	done
+	cp -r qml /usr/share/ethereal/qml
 	cp $GOPATH/bin/go-ethereum /usr/local/bin/ethereal
 endif
 # OS X build
diff --git a/ethereum.go b/ethereum.go
index 36cd75e47..ac1de5af4 100644
--- a/ethereum.go
+++ b/ethereum.go
@@ -190,16 +190,19 @@ func main() {
 					// Apply all transactions to the block
 					ethereum.StateManager().ApplyTransactions(block, block.Transactions())
 
-					ethereum.StateManager().AccumelateRewards(block, block)
+					ethereum.StateManager().Prepare(block.State(), block.State())
+					ethereum.StateManager().AccumelateRewards(block)
 
 					// Search the nonce
 					block.Nonce = pow.Search(block)
 					ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val})
+
+					ethereum.StateManager().PrepareDefault(block)
 					err := ethereum.StateManager().ProcessBlock(block)
 					if err != nil {
 						log.Println(err)
 					} else {
-						//log.Println("\n+++++++ MINED BLK +++++++\n", ethereum.BlockChain().CurrentBlock)
+						log.Println("\n+++++++ MINED BLK +++++++\n", ethereum.BlockChain().CurrentBlock)
 						log.Printf("🔨  Mined block %x\n", block.Hash())
 					}
 				}
diff --git a/ui/gui.go b/ui/gui.go
index 5f0b6e52d..c8f4bedab 100644
--- a/ui/gui.go
+++ b/ui/gui.go
@@ -81,6 +81,7 @@ func (ui *Gui) Start() {
 		Init: func(p *Tx, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" },
 	}})
 
+	ethutil.Config.SetClientString(fmt.Sprintf("/Ethereal v%s", "0.1"))
 	ethutil.Config.Log.Infoln("[GUI] Starting GUI")
 	// Create a new QML engine
 	ui.engine = qml.NewEngine()
diff --git a/ui/library.go b/ui/library.go
index 8dda0a89e..05fffd579 100644
--- a/ui/library.go
+++ b/ui/library.go
@@ -27,14 +27,14 @@ func (lib *EthLib) CreateTx(receiver, a, data string) string {
 	}
 
 	k, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
-	keyRing := ethutil.NewValueFromBytes(k)
+	keyPair := ethutil.NewKeyFromBytes(k)
 
 	amount := ethutil.Big(a)
 	code := ethchain.Compile(strings.Split(data, "\n"))
 	tx := ethchain.NewTransaction(hash, amount, code)
-	tx.Nonce = lib.stateManager.GetAddrState(keyRing.Get(1).Bytes()).Nonce
+	tx.Nonce = lib.stateManager.GetAddrState(keyPair.Address()).Nonce
 
-	tx.Sign(keyRing.Get(0).Bytes())
+	tx.Sign(keyPair.PrivateKey)
 
 	lib.txPool.QueueTransaction(tx)
 
-- 
GitLab