Skip to content

Commit ec05562

Browse files
committed
support custom last-success-threshold
1 parent 4df3d54 commit ec05562

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ nmngd node setup-check ~/.node_home --type validator/rpc/snapshot/archival
1818
## Node management
1919

2020
```bash
21-
nmngd node extract-addrbook ~/.node_home_source/config/addrbook.json ~/.node_home_dst/config/addrbook.json
21+
nmngd node extract-addrbook ~/.node_home_source/config/addrbook.json ~/.node_home_dst/config/addrbook.json [--last-success-threshold 48h]
2222
nmngd node prune-addrbook ~/.node_home/config/addrbook.json
2323
nmngd node prune-data ~/.node_home --binary xxxd [--backup-pvs ~/priv_validator_state.json.backup]
2424
nmngd node state-sync ~/.node_home --binary xxxd --rpc http://localhost:26657 [--address-book /home/x/.node/config/addrbook.json] [--peers [email protected]:26656] [--seeds [email protected]:26656] [--max-duration 12h]

cmd/node/extract_addrbook.go

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,10 @@ import (
1313

1414
const addrBookFileName = "addrbook.json"
1515

16+
const (
17+
flagLastSuccessThreshold = "last-success-threshold"
18+
)
19+
1620
func GetExtractAddrBookCmd() *cobra.Command {
1721
var cmd = &cobra.Command{
1822
Use: "extract-addrbook [input-file] [output-file]",
@@ -63,7 +67,8 @@ func GetExtractAddrBookCmd() *cobra.Command {
6367
return
6468
}
6569

66-
livePeers := addrBook.GetLivePeers(48 * time.Hour)
70+
lastSuccessThreshold, _ := cmd.Flags().GetDuration(flagLastSuccessThreshold)
71+
livePeers := addrBook.GetLivePeers(lastSuccessThreshold)
6772

6873
newAddrBook := types.AddrBook{
6974
Key: addrBook.Key,
@@ -84,5 +89,7 @@ func GetExtractAddrBookCmd() *cobra.Command {
8489
},
8590
}
8691

92+
cmd.Flags().DurationP(flagLastSuccessThreshold, "t", 48*time.Hour, "Threshold for last success time")
93+
8794
return cmd
8895
}

0 commit comments

Comments
 (0)