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
52 lines
1.2 KiB
Go
52 lines
1.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
|
|
"github.com/kaspanet/kaspad/infrastructure/config"
|
|
"github.com/kaspanet/kaspad/infrastructure/network/netadapter/standalone"
|
|
"github.com/kaspanet/kaspad/stability-tests/common"
|
|
"github.com/kaspanet/kaspad/util/panics"
|
|
"github.com/kaspanet/kaspad/util/profiling"
|
|
)
|
|
|
|
func main() {
|
|
defer panics.HandlePanic(log, "applicationLevelGarbage-main", nil)
|
|
err := parseConfig()
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error parsing config: %+v", err)
|
|
os.Exit(1)
|
|
}
|
|
defer backendLog.Close()
|
|
common.UseLogger(backendLog, log.Level())
|
|
cfg := activeConfig()
|
|
if cfg.Profile != "" {
|
|
profiling.Start(cfg.Profile, log)
|
|
}
|
|
|
|
kaspadConfig := config.DefaultConfig()
|
|
kaspadConfig.NetworkFlags = cfg.NetworkFlags
|
|
|
|
minimalNetAdapter, err := standalone.NewMinimalNetAdapter(kaspadConfig)
|
|
if err != nil {
|
|
fmt.Fprintf(os.Stderr, "Error creating minimalNetAdapter: %+v", err)
|
|
backendLog.Close()
|
|
os.Exit(1)
|
|
}
|
|
|
|
blocksChan, err := readBlocks()
|
|
if err != nil {
|
|
log.Errorf("Error reading blocks: %+v", err)
|
|
backendLog.Close()
|
|
os.Exit(1)
|
|
}
|
|
|
|
err = sendBlocks(cfg.NodeP2PAddress, minimalNetAdapter, blocksChan)
|
|
if err != nil {
|
|
log.Errorf("Error sending blocks: %+v", err)
|
|
backendLog.Close()
|
|
os.Exit(1)
|
|
}
|
|
}
|