Debugging handles

pull/9/head
obscuren 11 years ago
parent c6062a0f73
commit 8b9dcdcdf0
  1. 12
      dev_console.go
  2. 7
      ethereum.go

@ -9,7 +9,7 @@ import (
"github.com/ethereum/ethchain-go" "github.com/ethereum/ethchain-go"
"github.com/ethereum/ethdb-go" "github.com/ethereum/ethdb-go"
"github.com/ethereum/ethutil-go" "github.com/ethereum/ethutil-go"
_ "github.com/ethereum/ethwire-go" "github.com/ethereum/ethwire-go"
_ "math/big" _ "math/big"
"os" "os"
"strings" "strings"
@ -60,6 +60,12 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
case action == "contract" && argumentLength != 1: case action == "contract" && argumentLength != 1:
err = true err = true
expArgCount = 1 expArgCount = 1
case action == "say" && argumentLength != 1:
err = true
expArgCount = 1
case action == "addp" && argumentLength != 1:
err = true
expArgCount = 1
} }
if err { if err {
@ -129,6 +135,10 @@ func (i *Console) ParseInput(input string) bool {
} else { } else {
fmt.Println("getaddr: address unknown") fmt.Println("getaddr: address unknown")
} }
case "say":
i.ethereum.Broadcast(ethwire.MsgTalkTy, tokens[1])
case "addp":
i.ethereum.ConnectToPeer(tokens[1])
case "encode": case "encode":
fmt.Printf("%q\n", ethutil.Encode(tokens[1])) fmt.Printf("%q\n", ethutil.Encode(tokens[1]))
/* /*

@ -50,6 +50,8 @@ func main() {
ethchain.InitFees() ethchain.InitFees()
ethutil.ReadConfig() ethutil.ReadConfig()
log.Printf("Starting Ethereum v%s\n", ethutil.Config.Ver)
// Instantiated a eth stack // Instantiated a eth stack
ethereum, err := eth.New() ethereum, err := eth.New()
if err != nil { if err != nil {
@ -77,8 +79,6 @@ func main() {
go console.Start() go console.Start()
} }
log.Println("Starting Ethereum")
RegisterInterupts(ethereum) RegisterInterupts(ethereum)
ethereum.Start() ethereum.Start()
@ -90,10 +90,11 @@ 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() {
for { for {
txs := ethereum.TxPool.Flush()
time.Sleep(blockTime * time.Second) time.Sleep(blockTime * time.Second)
txs := ethereum.TxPool.Flush()
block := ethchain.CreateBlock( block := ethchain.CreateBlock(
ethereum.BlockManager.CurrentBlock.State().Root, ethereum.BlockManager.CurrentBlock.State().Root,
ethereum.BlockManager.LastBlockHash, ethereum.BlockManager.LastBlockHash,

Loading…
Cancel
Save