• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

tari-project / tari / 18223061931

03 Oct 2025 01:04PM UTC coverage: 59.567% (+0.06%) from 59.504%
18223061931

push

github

SWvheerden
chore: new release v5.1.0-rc.0

67624 of 113525 relevant lines covered (59.57%)

229295.33 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/comms/core/src/peer_validator/error.rs
1
// Copyright 2023, The Tari Project
2
//
3
// Redistribution and use in source and binary forms, with or without modification, are permitted provided that the
4
// following conditions are met:
5
//
6
// 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following
7
// disclaimer.
8
//
9
// 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the
10
// following disclaimer in the documentation and/or other materials provided with the distribution.
11
//
12
// 3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote
13
// products derived from this software without specific prior written permission.
14
//
15
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
16
// INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17
// DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
18
// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
19
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
20
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
21
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
22

23
use std::time::Duration;
24

25
use crate::{bans::BAN_DURATION_LONG, peer_manager::NodeId};
26

27
/// Validation errors for peers shared on the network
28
#[derive(Debug, Clone, thiserror::Error)]
29
pub enum PeerValidatorError {
30
    #[error("Peer signature was invalid for peer '{peer}'")]
31
    InvalidPeerSignature { peer: NodeId },
32
    #[error("One or more peer addresses were invalid for '{peer}'")]
33
    InvalidPeerAddresses { peer: NodeId },
34
    #[error("Peer '{peer}' has no address claims")]
35
    PeerHasNoAddresses { peer: NodeId },
36
    #[error("Invalid multiaddr: {0}")]
37
    InvalidMultiaddr(String),
38
    #[error("Onion v2 is deprecated and not supported")]
39
    OnionV2NotSupported,
40
    #[error("Peer provided too many supported protocols: expected max {max} but got {length}")]
41
    PeerIdentityTooManyProtocols { length: usize, max: usize },
42
    #[error("Peer provided too many addresses: expected max {max} but got {length}")]
43
    PeerIdentityTooManyAddresses { length: usize, max: usize },
44
    #[error("Peer provided a protocol id that exceeds the maximum length: expected max {max} but got {length}")]
45
    PeerIdentityProtocolIdTooLong { length: usize, max: usize },
46
    #[error("Peer provided a user agent that exceeds the maximum length: expected max {max} but got {length}")]
47
    PeerIdentityUserAgentTooLong { length: usize, max: usize },
48
}
49

50
impl PeerValidatorError {
51
    pub fn as_ban_duration(&self) -> Option<Duration> {
×
52
        Some(BAN_DURATION_LONG)
×
53
    }
×
54
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc