add hard mode test methods

really simple to check block merkle root
next can modify "ingestMerkleBlock" to ingest either type of block.
This commit is contained in:
Tadge Dryja committed 2016-02-06 19:15:35 -08:00
1 parent 63b5926e01
commit 8518be13f7
6 files changed
+176 -30

No files matched your search

+30 -1
View File
@@ -151,7 +151,13 @@ func Shellparse(cmdslice []string) error {
}
return nil
}
if cmd == "blk" {
err = Blk(args)
if err != nil {
fmt.Printf("blk error: %s\n", err)
}
return nil
}
fmt.Printf("Command not recognized. type help for command list.\n")
return nil
}
@@ -167,6 +173,26 @@ func Txs(args []string) error {
return nil
}
func Blk(args []string) error {
if SCon.RBytes == 0 {
return fmt.Errorf("Can't check block, spv connection broken")
}
if len(args) == 0 {
return fmt.Errorf("must specify height")
}
height, err := strconv.ParseInt(args[0], 10, 32)
if err != nil {
return err
}
// request most recent block just to test
err = SCon.AskForOneBlock(int32(height))
if err != nil {
return err
}
return nil
}
// Bal prints out your score.
func Bal(args []string) error {
if SCon.TS == nil {
@@ -208,6 +234,9 @@ func Adr(args []string) error {
// Send sends coins.
func Send(args []string) error {
if SCon.RBytes == 0 {
return fmt.Errorf("Can't send, spv connection broken")
}
// get all utxos from the database
allUtxos, err := SCon.TS.GetAllUtxos()
if err != nil {