diff --git a/config/config.go b/config/config.go index 3e1ff2237..07dc01af3 100644 --- a/config/config.go +++ b/config/config.go @@ -165,6 +165,7 @@ type configFlags struct { DropAddrIndex bool `long:"dropaddrindex" description:"Deletes the address-based transaction index from the database on start up and then exits."` RelayNonStd bool `long:"relaynonstd" description:"Relay non-standard transactions regardless of the default settings for the active network."` RejectNonStd bool `long:"rejectnonstd" description:"Reject non-standard transactions regardless of the default settings for the active network."` + SubNetwork uint64 `long:"subnetwork" description:"If subnetwork > 0, than node will request and process only payloads from specified subnetwork. And if subnetwork is 0, than payloads of all subnetworks are processed."` } // Config defines the configuration options for btcd. @@ -750,6 +751,15 @@ func loadConfig() (*Config, []string, error) { cfg.MiningAddrs = append(cfg.MiningAddrs, addr) } + // Check that 'generate' and 'subnetwork' flags do not conflict + if cfg.Generate && cfg.SubNetwork != 0 { + str := "%s: both generate flag and subnetwork filtering are set " + err := fmt.Errorf(str, funcName) + fmt.Fprintln(os.Stderr, err) + fmt.Fprintln(os.Stderr, usageMessage) + return nil, nil, err + } + // Ensure there is at least one mining address when the generate flag is // set. if cfg.Generate && len(cfg.MiningAddrs) == 0 { diff --git a/sample-btcd.conf b/sample-btcd.conf index 0a6ddab7e..622055eac 100644 --- a/sample-btcd.conf +++ b/sample-btcd.conf @@ -343,3 +343,12 @@ ; be disabled if this option is not specified. The profile information can be ; accessed at http://localhost:/debug/pprof once running. ; profile=6061 + +; ------------------------------------------------------------------------------ +; Subnetworks +; ------------------------------------------------------------------------------ + +; If subnetwork > 0, than node will request and process only payloads from +; specified subnetwork. And if subnetwork is 0, than payloads of all subnetworks +; are processed. It also requires that generate flag will be false. +; subnetwork=0 \ No newline at end of file