func toABlocksList(source []interfaces.BinaryMarshallableAndCopyable) []interfaces.IAdminBlock { answer := make([]interfaces.IAdminBlock, len(source)) for i, v := range source { answer[i] = v.(interfaces.IAdminBlock) } sort.Sort(util.ByABlockIDAccending(answer)) return answer }
func ExportAChain(db interfaces.DBOverlay) error { fmt.Printf("ExportAChain\n") // get all aBlocks from db aBlocks, err := db.FetchAllABlocks() if err != nil { return err } sort.Sort(util.ByABlockIDAccending(aBlocks)) for _, block := range aBlocks { err = ExportBlock(block.(interfaces.DatabaseBatchable)) if err != nil { return err } } return nil }