main: Disable enabling both --prune and --addrindex

You can have a addrindex but with the actual blocks gone, they won't be
much of a help.  Consider allowing these option to be both on in the
future where the addrindex is only indexing the non-pruned blocks.
This commit is contained in:
Calvin Kim 2023-04-03 11:54:47 +09:00
parent a1736b4267
commit 57903c71c9

View file

@ -1155,6 +1155,14 @@ func loadConfig() (*config, []string, error) {
return nil, nil, err
}
if cfg.Prune != 0 && cfg.AddrIndex {
err := fmt.Errorf("%s: the --prune and --addrindex options may "+
"not be activated at the same time", funcName)
fmt.Fprintln(os.Stderr, err)
fmt.Fprintln(os.Stderr, usageMessage)
return nil, nil, err
}
// Warn about missing config file only after all other configuration is
// done. This prevents the warning on help messages and invalid
// options. Note this should go directly before the return.