Updated to work with the new chain

This commit is contained in:
obscuren 2014-03-21 11:16:41 +01:00
parent 85e0447684
commit 0db86e4485
4 changed files with 12 additions and 7 deletions

@ -7,11 +7,12 @@ all:
install: install:
# Linux build # Linux build
ifeq ($(UNAME),Linux) ifeq ($(UNAME),Linux)
mkdir /usr/local/ethereal mkdir -p /usr/local/ethereal
files=(wallet.qml net.png network.png new.png tx.png) files=(net.png network.png new.png tx.png)
for file in "${files[@]}"; do for file in "${files[@]}"; do
cp $file /usr/share/ethereal cp $file /usr/share/ethereal
done done
cp -r qml /usr/share/ethereal/qml
cp $GOPATH/bin/go-ethereum /usr/local/bin/ethereal cp $GOPATH/bin/go-ethereum /usr/local/bin/ethereal
endif endif
# OS X build # OS X build

@ -190,16 +190,19 @@ func main() {
// Apply all transactions to the block // Apply all transactions to the block
ethereum.StateManager().ApplyTransactions(block, block.Transactions()) 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 // Search the nonce
block.Nonce = pow.Search(block) block.Nonce = pow.Search(block)
ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val}) ethereum.Broadcast(ethwire.MsgBlockTy, []interface{}{block.Value().Val})
ethereum.StateManager().PrepareDefault(block)
err := ethereum.StateManager().ProcessBlock(block) err := ethereum.StateManager().ProcessBlock(block)
if err != nil { if err != nil {
log.Println(err) log.Println(err)
} else { } 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()) log.Printf("🔨 Mined block %x\n", block.Hash())
} }
} }

@ -81,6 +81,7 @@ func (ui *Gui) Start() {
Init: func(p *Tx, obj qml.Object) { p.Value = ""; p.Hash = ""; p.Address = "" }, 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") ethutil.Config.Log.Infoln("[GUI] Starting GUI")
// Create a new QML engine // Create a new QML engine
ui.engine = qml.NewEngine() ui.engine = qml.NewEngine()

@ -27,14 +27,14 @@ func (lib *EthLib) CreateTx(receiver, a, data string) string {
} }
k, _ := ethutil.Config.Db.Get([]byte("KeyRing")) k, _ := ethutil.Config.Db.Get([]byte("KeyRing"))
keyRing := ethutil.NewValueFromBytes(k) keyPair := ethutil.NewKeyFromBytes(k)
amount := ethutil.Big(a) amount := ethutil.Big(a)
code := ethchain.Compile(strings.Split(data, "\n")) code := ethchain.Compile(strings.Split(data, "\n"))
tx := ethchain.NewTransaction(hash, amount, code) 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) lib.txPool.QueueTransaction(tx)