This commit is contained in:
obscuren 2014-01-30 23:50:15 +01:00
parent 8f16b66507
commit e28632b997
2 changed files with 28 additions and 20 deletions

View File

@ -124,8 +124,8 @@ func (i *Console) ParseInput(input string) bool {
ethutil.BigPow(2, 36), // diff ethutil.BigPow(2, 36), // diff
ethutil.Big(tokens[2]))) // nonce ethutil.Big(tokens[2]))) // nonce
case "decode": case "decode":
d, _ := ethutil.Decode([]byte(tokens[1]), 0) value := ethutil.NewRlpDecoder([]byte(tokens[1]))
fmt.Printf("%q\n", d) fmt.Println(value)
case "getaddr": case "getaddr":
encoded, _ := hex.DecodeString(tokens[1]) encoded, _ := hex.DecodeString(tokens[1])
d := i.ethereum.BlockManager.BlockChain().CurrentBlock.State().Get(string(encoded)) d := i.ethereum.BlockManager.BlockChain().CurrentBlock.State().Get(string(encoded))

View File

@ -8,7 +8,6 @@ import (
"github.com/ethereum/ethutil-go" "github.com/ethereum/ethutil-go"
_ "github.com/ethereum/ethwire-go" _ "github.com/ethereum/ethwire-go"
"log" "log"
"math/big"
"os" "os"
"os/signal" "os/signal"
"path" "path"
@ -89,26 +88,35 @@ func main() {
// Fake block mining. It broadcasts a new block every 5 seconds // Fake block mining. It broadcasts a new block every 5 seconds
go func() { go func() {
pow := &ethchain.EasyPow{}
for { for {
time.Sleep(blockTime * time.Second)
txs := ethereum.TxPool.Flush() txs := ethereum.TxPool.Flush()
block := ethereum.BlockManager.BlockChain().NewBlock("82c3b0b72cf62f1a9ce97c64da8072efa28225d8", txs)
block := ethchain.CreateBlock( nonce := pow.Search(block)
ethereum.BlockManager.BlockChain().CurrentBlock.State().Root, block.Nonce = nonce
ethereum.BlockManager.BlockChain().LastBlockHash,
"123", log.Println("nonce found:", nonce)
big.NewInt(1), /*
big.NewInt(1), time.Sleep(blockTime * time.Second)
"",
txs)
err := ethereum.BlockManager.ProcessBlockWithState(block, block.State()) block := ethchain.CreateBlock(
if err != nil { ethereum.BlockManager.BlockChain().CurrentBlock.State().Root,
log.Println(err) ethereum.BlockManager.BlockChain().LastBlockHash,
} else { "123",
//log.Println("\n+++++++ MINED BLK +++++++\n", block.String()) big.NewInt(1),
} big.NewInt(1),
"",
txs)
err := ethereum.BlockManager.ProcessBlockWithState(block, block.State())
if err != nil {
log.Println(err)
} else {
//log.Println("\n+++++++ MINED BLK +++++++\n", block.String())
}
*/
} }
}() }()
} }