aboutsummaryrefslogtreecommitdiffstats
path: root/dev_console.go
diff options
context:
space:
mode:
authorobscuren <geffobscura@gmail.com>2014-01-25 03:16:48 +0800
committerobscuren <geffobscura@gmail.com>2014-01-25 03:16:48 +0800
commit97882a65bbe87beed8f939591f13ee01f7af6fa7 (patch)
treeacf017ecd4bfd8ed89c5ca0ecf34fb033cc1d969 /dev_console.go
parentc636f8e3e66a24a13d2cc6b2e89280f362e0f91b (diff)
downloaddexon-97882a65bbe87beed8f939591f13ee01f7af6fa7.tar.gz
dexon-97882a65bbe87beed8f939591f13ee01f7af6fa7.tar.zst
dexon-97882a65bbe87beed8f939591f13ee01f7af6fa7.zip
Dev test mining
Diffstat (limited to 'dev_console.go')
-rw-r--r--dev_console.go54
1 files changed, 34 insertions, 20 deletions
diff --git a/dev_console.go b/dev_console.go
index 252860fc8..f2aa4e08d 100644
--- a/dev_console.go
+++ b/dev_console.go
@@ -9,8 +9,8 @@ import (
"github.com/ethereum/ethchain-go"
"github.com/ethereum/ethdb-go"
"github.com/ethereum/ethutil-go"
- "github.com/ethereum/ethwire-go"
- "math/big"
+ _ "github.com/ethereum/ethwire-go"
+ _ "math/big"
"os"
"strings"
)
@@ -48,6 +48,9 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
case action == "encode" && argumentLength != 1:
err = true
expArgCount = 1
+ case action == "gettx" && argumentLength != 1:
+ err = true
+ expArgCount = 1
case action == "tx" && argumentLength != 2:
err = true
expArgCount = 2
@@ -125,28 +128,39 @@ func (i *Console) ParseInput(input string) bool {
}
case "encode":
fmt.Printf("%q\n", ethutil.Encode(tokens[1]))
- case "newblk":
- block := ethchain.CreateBlock(
- i.ethereum.BlockManager.BlockChain().LastBlock.State().Root,
- i.ethereum.BlockManager.LastBlockHash,
- "123",
- big.NewInt(1),
- big.NewInt(1),
- "",
- i.ethereum.TxPool.Flush(),
- )
- i.ethereum.Broadcast(ethwire.MsgBlockTy, block.RlpData())
- //fmt.Println(ethutil.NewRlpValue(block.RlpData()).Get(0))
- //err := i.ethereum.BlockManager.ProcessBlock(block)
- //if err != nil {
- // fmt.Println(err)
- //} else {
-
- // }
+ /*
+ case "newblk":
+ block := ethchain.CreateBlock(
+ i.ethereum.BlockManager.BlockChain().LastBlock.State().Root,
+ i.ethereum.BlockManager.LastBlockHash,
+ "123",
+ big.NewInt(1),
+ big.NewInt(1),
+ "",
+ i.ethereum.TxPool.Flush(),
+ )
+ err := i.ethereum.BlockManager.ProcessBlock(block)
+ if err != nil {
+ fmt.Println(err)
+ } else {
+ i.ethereum.Broadcast(ethwire.MsgBlockTy, block.RlpData())
+ }
+ //fmt.Println(ethutil.NewRlpValue(block.RlpData()).Get(0))
+ */
case "tx":
tx := ethchain.NewTransaction(tokens[1], ethutil.Big(tokens[2]), []string{""})
+ fmt.Printf("tx: %x\n", tx.Hash())
i.ethereum.TxPool.QueueTransaction(tx)
+ case "gettx":
+ addr, _ := hex.DecodeString(tokens[1])
+ data, _ := ethutil.Config.Db.Get(addr)
+ if len(data) != 0 {
+ decoder := ethutil.NewRlpDecoder(data)
+ fmt.Println(decoder)
+ } else {
+ fmt.Println("gettx: tx not found")
+ }
case "exit", "quit", "q":
return false
case "help":