ValidateBasic performs basic validation (checking param bounds, etc.) and returns an error if any check fails.
()
| 817 | // ValidateBasic performs basic validation (checking param bounds, etc.) and |
| 818 | // returns an error if any check fails. |
| 819 | func (cfg *P2PConfig) ValidateBasic() error { |
| 820 | if cfg.MaxNumInboundPeers < 0 { |
| 821 | return errors.New("max-num-inbound-peers can't be negative") |
| 822 | } |
| 823 | if cfg.MaxNumOutboundPeers < 0 { |
| 824 | return errors.New("max-num-outbound-peers can't be negative") |
| 825 | } |
| 826 | if cfg.FlushThrottleTimeout < 0 { |
| 827 | return errors.New("flush-throttle-timeout can't be negative") |
| 828 | } |
| 829 | if cfg.PersistentPeersMaxDialPeriod < 0 { |
| 830 | return errors.New("persistent-peers-max-dial-period can't be negative") |
| 831 | } |
| 832 | if cfg.MaxPacketMsgPayloadSize < 0 { |
| 833 | return errors.New("max-packet-msg-payload-size can't be negative") |
| 834 | } |
| 835 | if cfg.SendRate < 0 { |
| 836 | return errors.New("send-rate can't be negative") |
| 837 | } |
| 838 | if cfg.RecvRate < 0 { |
| 839 | return errors.New("recv-rate can't be negative") |
| 840 | } |
| 841 | if cfg.MaxOutgoingConnections > cfg.MaxConnections { |
| 842 | return errors.New("max-outgoing-connections cannot be larger than max-connections") |
| 843 | } |
| 844 | return nil |
| 845 | } |
| 846 | |
| 847 | //----------------------------------------------------------------------------- |
| 848 | // MempoolConfig |
nothing calls this directly
no outgoing calls
no test coverage detected