mirror of
https://github.com/kaspanet/kaspad.git
synced 2025-03-30 15:08:33 +00:00

* Add stability-tests * Fix requires * Fix golint errors * Update README.md * Remove payloadHash from everywhere * don't run vet on kaspad in stability-tests/install_and_test
33 lines
732 B
Go
33 lines
732 B
Go
package main
|
|
|
|
import (
|
|
"encoding/json"
|
|
|
|
"github.com/kaspanet/kaspad/domain/consensus/model/externalapi"
|
|
"github.com/kaspanet/kaspad/stability-tests/common"
|
|
"github.com/pkg/errors"
|
|
)
|
|
|
|
var blockBuffer []byte
|
|
|
|
func readBlocks() (<-chan *externalapi.DomainBlock, error) {
|
|
c := make(chan *externalapi.DomainBlock)
|
|
|
|
spawn("applicationLevelGarbage-readBlocks", func() {
|
|
lineNum := 0
|
|
for blockJSON := range common.ScanFile(activeConfig().BlocksFilePath) {
|
|
domainBlock := &externalapi.DomainBlock{}
|
|
|
|
err := json.Unmarshal(blockJSON, domainBlock)
|
|
if err != nil {
|
|
panic(errors.Wrapf(err, "error deserializing line No. %d with json %s", lineNum, blockJSON))
|
|
}
|
|
|
|
c <- domainBlock
|
|
}
|
|
close(c)
|
|
})
|
|
|
|
return c, nil
|
|
}
|