func getDBlock(args []string) { os.Args = args flag.Parse() args = flag.Args() if len(args) < 1 { man("getDBlock") return } keymr := args[0] dblock, err := factom.GetDBlock(keymr) if err != nil { errorln(err) return } fmt.Println("PrevBlockKeyMR:", dblock.Header.PrevBlockKeyMR) fmt.Println("Timestamp:", dblock.Header.Timestamp) fmt.Println("SequenceNumber:", dblock.Header.SequenceNumber) for _, v := range dblock.EntryBlockList { fmt.Println("EntryBlock {") fmt.Println(" ChainID", v.ChainID) fmt.Println(" KeyMR", v.KeyMR) fmt.Println("}") } }
func GetDBlockFromFactom(keyMR string) (*DBlock, error) { answer := new(DBlock) body, err := factom.GetDBlock(keyMR) if err != nil { return answer, err } answer = new(DBlock) answer.DBHash = body.DBHash answer.PrevBlockKeyMR = body.Header.PrevBlockKeyMR answer.Timestamp = body.Header.Timestamp answer.SequenceNumber = body.Header.SequenceNumber answer.EntryBlockList = make([]ListEntry, len(body.EntryBlockList)) for i, v := range body.EntryBlockList { answer.EntryBlockList[i].ChainID = v.ChainID answer.EntryBlockList[i].KeyMR = v.KeyMR } //answer.DBlock = *body answer.BlockTimeStr = TimestampToString(body.Header.Timestamp) answer.KeyMR = keyMR return answer, nil }
var getDBlock = func() *fctCmd { cmd := new(fctCmd) cmd.helpMsg = "factom-cli get dblock KEYMR" cmd.description = "Get dblock contents by merkle root" cmd.execFunc = func(args []string) { os.Args = args flag.Parse() args = flag.Args() if len(args) < 1 { fmt.Println(cmd.helpMsg) return } keymr := args[0] dblock, err := factom.GetDBlock(keymr) if err != nil { errorln(err) return } fmt.Println(dblock) } help.Add("get dblock", cmd) return cmd }() var getEBlock = func() *fctCmd { cmd := new(fctCmd) cmd.helpMsg = "factom-cli get eblock KEYMR" cmd.description = "Get eblock by merkle root" cmd.execFunc = func(args []string) {