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

tari-project / tari / 17275382059

27 Aug 2025 06:28PM UTC coverage: 60.14% (-0.1%) from 60.274%
17275382059

push

github

web-flow
chore: new release v5.0.0-pre.8 (#7446)

Description
---
new release

71505 of 118897 relevant lines covered (60.14%)

536444.51 hits per line

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

0.0
/base_layer/core/src/base_node/sync/rpc/mod.rs
1
//  Copyright 2020, 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
mod service;
24

25
mod sync_utxos_task;
26

27
pub use service::BaseNodeSyncRpcService;
28

29
#[cfg(test)]
30
mod tests;
31

32
use tari_comms::protocol::rpc::{Request, Response, RpcStatus, Streaming};
33
use tari_comms_rpc_macros::tari_rpc;
34

35
use crate::{
36
    base_node::LocalNodeCommsInterface,
37
    chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend},
38
    proto,
39
    proto::base_node::{
40
        FindChainSplitRequest,
41
        FindChainSplitResponse,
42
        SyncBlocksRequest,
43
        SyncHeadersRequest,
44
        SyncKernelsRequest,
45
        SyncUtxosRequest,
46
        SyncUtxosResponse,
47
    },
48
};
49

50
#[tari_rpc(protocol_name = b"t/blksync/1", server_struct = BaseNodeSyncRpcServer, client_struct = BaseNodeSyncRpcClient)]
×
51
pub trait BaseNodeSyncService: Send + Sync + 'static {
52
    #[rpc(method = 1)]
53
    async fn sync_blocks(
54
        &self,
55
        request: Request<SyncBlocksRequest>,
56
    ) -> Result<Streaming<proto::base_node::BlockBodyResponse>, RpcStatus>;
57

58
    #[rpc(method = 2)]
59
    async fn sync_headers(
60
        &self,
61
        request: Request<SyncHeadersRequest>,
62
    ) -> Result<Streaming<proto::core::BlockHeader>, RpcStatus>;
63

64
    #[rpc(method = 3)]
65
    async fn get_header_by_height(
66
        &self,
67
        request: Request<u64>,
68
    ) -> Result<Response<proto::core::BlockHeader>, RpcStatus>;
69

70
    #[rpc(method = 4)]
71
    async fn find_chain_split(
72
        &self,
73
        request: Request<FindChainSplitRequest>,
74
    ) -> Result<Response<FindChainSplitResponse>, RpcStatus>;
75

76
    #[rpc(method = 5)]
77
    async fn get_chain_metadata(
78
        &self,
79
        request: Request<()>,
80
    ) -> Result<Response<proto::base_node::ChainMetadata>, RpcStatus>;
81

82
    #[rpc(method = 6)]
83
    async fn sync_kernels(
84
        &self,
85
        request: Request<SyncKernelsRequest>,
86
    ) -> Result<Streaming<proto::types::TransactionKernel>, RpcStatus>;
87

88
    #[rpc(method = 8)]
89
    async fn sync_utxos(&self, request: Request<SyncUtxosRequest>) -> Result<Streaming<SyncUtxosResponse>, RpcStatus>;
90
}
91

92
pub fn create_base_node_sync_rpc_service<B: BlockchainBackend + 'static>(
×
93
    db: AsyncBlockchainDb<B>,
×
94
    base_node_service: LocalNodeCommsInterface,
×
95
) -> BaseNodeSyncRpcServer<BaseNodeSyncRpcService<B>> {
×
96
    BaseNodeSyncRpcServer::new(BaseNodeSyncRpcService::new(db, base_node_service))
×
97
}
×
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