Beispiel #1
0
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
}
Beispiel #2
0
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
}