/
replay.go
31 lines (27 loc) · 1.01 KB
/
replay.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package commands
import (
"github.com/spf13/cobra"
"github.com/dashpay/tenderdash/config"
"github.com/dashpay/tenderdash/internal/consensus"
"github.com/dashpay/tenderdash/libs/log"
)
// MakeReplayCommand constructs a command to replay messages from the WAL into consensus.
func MakeReplayCommand(conf *config.Config, logger log.Logger) *cobra.Command {
return &cobra.Command{
Use: "replay",
Short: "Replay messages from WAL",
RunE: func(cmd *cobra.Command, args []string) error {
return consensus.RunReplayFile(cmd.Context(), logger, conf.BaseConfig, conf.Consensus, false)
},
}
}
// MakeReplayConsoleCommand constructs a command to replay WAL messages to stdout.
func MakeReplayConsoleCommand(conf *config.Config, logger log.Logger) *cobra.Command {
return &cobra.Command{
Use: "replay-console",
Short: "Replay messages from WAL in a console",
RunE: func(cmd *cobra.Command, args []string) error {
return consensus.RunReplayFile(cmd.Context(), logger, conf.BaseConfig, conf.Consensus, true)
},
}
}