func getSha(db database.Db, str string) (wire.ShaHash, error) { argtype, idx, sha, err := parsesha(str) if err != nil { log.Warnf("unable to decode [%v] %v", str, err) return wire.ShaHash{}, err } switch argtype { case argSha: // nothing to do case argHeight: sha, err = db.FetchBlockShaByHeight(idx) if err != nil { return wire.ShaHash{}, err } } if sha == nil { fmt.Printf("wtf sha is nil but err is %v", err) } return *sha, nil }