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

tari-project / tari / 16123384529

07 Jul 2025 05:11PM UTC coverage: 64.327% (-7.6%) from 71.89%
16123384529

push

github

web-flow
chore: new release v4.9.0-pre.0 (#7289)

Description
---
new release esmeralda

77151 of 119935 relevant lines covered (64.33%)

227108.34 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
#[cfg(feature = "base_node")]
24
mod service;
25
#[cfg(feature = "base_node")]
26
mod sync_utxos_task;
27

28
#[cfg(feature = "base_node")]
29
pub use service::BaseNodeSyncRpcService;
30

31
#[cfg(test)]
32
mod tests;
33

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

37
#[cfg(feature = "base_node")]
38
use crate::{
39
    base_node::LocalNodeCommsInterface,
40
    chain_storage::{async_db::AsyncBlockchainDb, BlockchainBackend},
41
};
42
use crate::{
43
    proto,
44
    proto::base_node::{
45
        FindChainSplitRequest,
46
        FindChainSplitResponse,
47
        SyncBlocksRequest,
48
        SyncHeadersRequest,
49
        SyncKernelsRequest,
50
        SyncUtxosRequest,
51
        SyncUtxosResponse,
52
    },
53
};
54

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

63
    #[rpc(method = 2)]
64
    async fn sync_headers(
65
        &self,
66
        request: Request<SyncHeadersRequest>,
67
    ) -> Result<Streaming<proto::core::BlockHeader>, RpcStatus>;
68

69
    #[rpc(method = 3)]
70
    async fn get_header_by_height(
71
        &self,
72
        request: Request<u64>,
73
    ) -> Result<Response<proto::core::BlockHeader>, RpcStatus>;
74

75
    #[rpc(method = 4)]
76
    async fn find_chain_split(
77
        &self,
78
        request: Request<FindChainSplitRequest>,
79
    ) -> Result<Response<FindChainSplitResponse>, RpcStatus>;
80

81
    #[rpc(method = 5)]
82
    async fn get_chain_metadata(
83
        &self,
84
        request: Request<()>,
85
    ) -> Result<Response<proto::base_node::ChainMetadata>, RpcStatus>;
86

87
    #[rpc(method = 6)]
88
    async fn sync_kernels(
89
        &self,
90
        request: Request<SyncKernelsRequest>,
91
    ) -> Result<Streaming<proto::types::TransactionKernel>, RpcStatus>;
92

93
    #[rpc(method = 8)]
94
    async fn sync_utxos(&self, request: Request<SyncUtxosRequest>) -> Result<Streaming<SyncUtxosResponse>, RpcStatus>;
95
}
96

97
#[cfg(feature = "base_node")]
98
pub fn create_base_node_sync_rpc_service<B: BlockchainBackend + 'static>(
×
99
    db: AsyncBlockchainDb<B>,
×
100
    base_node_service: LocalNodeCommsInterface,
×
101
) -> BaseNodeSyncRpcServer<BaseNodeSyncRpcService<B>> {
×
102
    BaseNodeSyncRpcServer::new(BaseNodeSyncRpcService::new(db, base_node_service))
×
103
}
×
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