Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ nmngd node setup-check ~/.node_home --type validator/rpc/snapshot/archival
## Node management

```bash
nmngd node extract-addrbook ~/.node_home_source/config/addrbook.json ~/.node_home_dst/config/addrbook.json
nmngd node extract-addrbook ~/.node_home_source/config/addrbook.json ~/.node_home_dst/config/addrbook.json [--last-success-threshold 48h]
nmngd node prune-addrbook ~/.node_home/config/addrbook.json
nmngd node prune-data ~/.node_home --binary xxxd [--backup-pvs ~/priv_validator_state.json.backup]
nmngd node state-sync ~/.node_home --binary xxxd --rpc http://localhost:26657 [--address-book /home/x/.node/config/addrbook.json] [--peers nodeid@127.0.0.1:26656] [--seeds seed@1.1.1.1:26656] [--max-duration 12h]
Expand Down
9 changes: 8 additions & 1 deletion cmd/node/extract_addrbook.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@ import (

const addrBookFileName = "addrbook.json"

const (
flagLastSuccessThreshold = "last-success-threshold"
)

func GetExtractAddrBookCmd() *cobra.Command {
var cmd = &cobra.Command{
Use: "extract-addrbook [input-file] [output-file]",
Expand Down Expand Up @@ -63,7 +67,8 @@ func GetExtractAddrBookCmd() *cobra.Command {
return
}

livePeers := addrBook.GetLivePeers(48 * time.Hour)
lastSuccessThreshold, _ := cmd.Flags().GetDuration(flagLastSuccessThreshold)
livePeers := addrBook.GetLivePeers(lastSuccessThreshold)

newAddrBook := types.AddrBook{
Key: addrBook.Key,
Expand All @@ -84,5 +89,7 @@ func GetExtractAddrBookCmd() *cobra.Command {
},
}

cmd.Flags().DurationP(flagLastSuccessThreshold, "t", 48*time.Hour, "Threshold for last success time")

return cmd
}