Added block retrieval
This commit is contained in:
parent
d831064f65
commit
980987ae8f
|
@ -66,6 +66,9 @@ func (i *Console) ValidateInput(action string, argumentLength int) error {
|
||||||
case action == "addp" && argumentLength != 1:
|
case action == "addp" && argumentLength != 1:
|
||||||
err = true
|
err = true
|
||||||
expArgCount = 1
|
expArgCount = 1
|
||||||
|
case action == "block" && argumentLength != 1:
|
||||||
|
err = true
|
||||||
|
expArgCount = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
if err {
|
if err {
|
||||||
|
@ -128,13 +131,12 @@ func (i *Console) ParseInput(input string) bool {
|
||||||
fmt.Println(value)
|
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))
|
addr := i.ethereum.BlockManager.BlockChain().CurrentBlock.GetAddr(encoded)
|
||||||
if d != "" {
|
fmt.Println("addr:", addr)
|
||||||
decoder := ethutil.NewRlpValueFromBytes([]byte(d))
|
case "block":
|
||||||
fmt.Println(decoder)
|
encoded, _ := hex.DecodeString(tokens[1])
|
||||||
} else {
|
block := i.ethereum.BlockManager.BlockChain().GetBlock(encoded)
|
||||||
fmt.Println("getaddr: address unknown")
|
fmt.Println(block)
|
||||||
}
|
|
||||||
case "say":
|
case "say":
|
||||||
i.ethereum.Broadcast(ethwire.MsgTalkTy, []interface{}{tokens[1]})
|
i.ethereum.Broadcast(ethwire.MsgTalkTy, []interface{}{tokens[1]})
|
||||||
case "addp":
|
case "addp":
|
||||||
|
@ -179,6 +181,8 @@ func (i *Console) ParseInput(input string) bool {
|
||||||
"get KEY - Retrieves the given key\n" +
|
"get KEY - Retrieves the given key\n" +
|
||||||
"root - Prints the hex encoded merkle root\n" +
|
"root - Prints the hex encoded merkle root\n" +
|
||||||
"rawroot - Prints the raw merkle root\n" +
|
"rawroot - Prints the raw merkle root\n" +
|
||||||
|
"block HASH - Prints the block\n" +
|
||||||
|
"getaddr ADDR - Prints the account associated with the address\n" +
|
||||||
"\033[1m= Dagger =\033[0m\n" +
|
"\033[1m= Dagger =\033[0m\n" +
|
||||||
"dag HASH NONCE - Verifies a nonce with the given hash with dagger\n" +
|
"dag HASH NONCE - Verifies a nonce with the given hash with dagger\n" +
|
||||||
"\033[1m= Encoding =\033[0m\n" +
|
"\033[1m= Encoding =\033[0m\n" +
|
||||||
|
|
Loading…
Reference in New Issue