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

tari-project / tari / 20742611763

06 Jan 2026 08:28AM UTC coverage: 60.745% (-0.03%) from 60.777%
20742611763

push

github

web-flow
fix(node): add missing data to get_active_validator_nodes (#7645)

Description
---
fix(node): add missing data to get_active_validator_nodes
fix(storage/vns): key bug in get_all_vns call

Motivation and Context
---
Additional info required from base layer get active validators call.

How Has This Been Tested?
---

What process can a PR reviewer use to test or verify this change?
---

<!-- Checklist -->
<!-- 1. Is the title of your PR in the form that would make nice release
notes? The title, excluding the conventional commit
tag, will be included exactly as is in the CHANGELOG, so please think
about it carefully. -->


Breaking Changes
---

- [x] None
- [ ] Requires data directory on base node to be deleted
- [ ] Requires hard fork
- [ ] Other - Please specify

<!-- Does this include a breaking change? If so, include this line as a
footer -->
<!-- BREAKING CHANGE: Description what the user should do, e.g. delete a
database, resync the chain -->

30 of 41 new or added lines in 5 files covered. (73.17%)

61 existing lines in 15 files now uncovered.

70500 of 116059 relevant lines covered (60.74%)

299672.34 hits per line

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

16.67
/base_layer/core/src/base_node/sync/ban.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 log::*;
26
use tari_comms::{connectivity::ConnectivityRequester, peer_manager::NodeId};
27

28
use crate::base_node::BlockchainSyncConfig;
29

30
const LOG_TARGET: &str = "c::bn::sync";
31

32
// Sync peers are banned if there exists a ban reason for the error and the peer is not on the allow list for sync.
33

34
pub struct PeerBanManager {
35
    config: BlockchainSyncConfig,
36
    connectivity: ConnectivityRequester,
37
}
38

39
impl PeerBanManager {
40
    pub fn new(config: BlockchainSyncConfig, connectivity: ConnectivityRequester) -> Self {
13✔
41
        Self { config, connectivity }
13✔
42
    }
13✔
43

UNCOV
44
    pub async fn ban_peer_if_required(&mut self, node_id: &NodeId, ban_reason: String, ban_duration: Duration) {
×
UNCOV
45
        if self.config.forced_sync_peers.contains(node_id) || self.config.monitored_peers.contains(node_id) {
×
46
            debug!(
×
47
                target: LOG_TARGET,
×
48
                "Not banning peer that is on the allow list for sync. Ban reason = {ban_reason}"
×
49
            );
50
            return;
×
UNCOV
51
        }
×
UNCOV
52
        debug!(target: LOG_TARGET, "Sync peer {node_id} removed from the sync peer list because {ban_reason}");
×
53

UNCOV
54
        match self
×
UNCOV
55
            .connectivity
×
UNCOV
56
            .ban_peer_until(node_id.clone(), ban_duration, ban_reason.clone())
×
UNCOV
57
            .await
×
58
        {
59
            Ok(_) => {
UNCOV
60
                warn!(target: LOG_TARGET, "Banned sync peer {node_id} for {ban_duration:?} because {ban_reason}")
×
61
            },
62
            Err(err) => error!(target: LOG_TARGET, "Failed to ban sync peer {node_id}: {err}"),
×
63
        }
UNCOV
64
    }
×
65
}
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