converted zebra-rpc -- all crate tests pass
This commit is contained in:
parent
fed20b28f2
commit
676b3adbed
|
@ -84,7 +84,7 @@ pub trait ChainTip {
|
|||
/// and the height of the best tip.
|
||||
fn estimate_network_chain_tip_height(
|
||||
&self,
|
||||
network: Network,
|
||||
network: &Network,
|
||||
now: DateTime<Utc>,
|
||||
) -> Option<block::Height> {
|
||||
let (current_height, current_block_time) = self.best_tip_height_and_block_time()?;
|
||||
|
@ -110,7 +110,7 @@ pub trait ChainTip {
|
|||
/// Returns `None` if the state is empty.
|
||||
fn estimate_distance_to_network_chain_tip(
|
||||
&self,
|
||||
network: Network,
|
||||
network: &Network,
|
||||
) -> Option<(block::HeightDiff, block::Height)> {
|
||||
let (current_height, current_block_time) = self.best_tip_height_and_block_time()?;
|
||||
|
||||
|
|
|
@ -111,7 +111,7 @@ impl ChainTip for MockChainTip {
|
|||
|
||||
fn estimate_distance_to_network_chain_tip(
|
||||
&self,
|
||||
_network: Network,
|
||||
_network: &Network,
|
||||
) -> Option<(block::HeightDiff, block::Height)> {
|
||||
self.estimated_distance_to_network_chain_tip
|
||||
.borrow()
|
||||
|
|
|
@ -43,7 +43,7 @@ impl NetworkChainTipHeightEstimator {
|
|||
pub fn new(
|
||||
current_block_time: DateTime<Utc>,
|
||||
current_height: block::Height,
|
||||
network: Network,
|
||||
network: &Network,
|
||||
) -> Self {
|
||||
let mut target_spacings = NetworkUpgrade::target_spacings(&network);
|
||||
let (_genesis_height, initial_target_spacing) =
|
||||
|
|
|
@ -56,7 +56,7 @@ proptest! {
|
|||
let mock_local_time = current_block_time + estimated_time_difference + time_displacement;
|
||||
|
||||
assert_eq!(
|
||||
chain_tip.estimate_network_chain_tip_height(network, mock_local_time),
|
||||
chain_tip.estimate_network_chain_tip_height(&network, mock_local_time),
|
||||
Some(network_height)
|
||||
);
|
||||
}
|
||||
|
|
|
@ -12,7 +12,7 @@ impl Transaction {
|
|||
/// Returns a new version 5 coinbase transaction for `network` and `height`,
|
||||
/// which contains the specified `outputs`.
|
||||
pub fn new_v5_coinbase(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
height: Height,
|
||||
outputs: impl IntoIterator<Item = (Amount<NonNegative>, transparent::Script)>,
|
||||
extra_coinbase_data: Vec<u8>,
|
||||
|
@ -109,7 +109,7 @@ impl Transaction {
|
|||
/// If `like_zcashd` is true, try to match the coinbase transactions generated by `zcashd`
|
||||
/// in the `getblocktemplate` RPC.
|
||||
pub fn new_v4_coinbase(
|
||||
_network: Network,
|
||||
_network: &Network,
|
||||
height: Height,
|
||||
outputs: impl IntoIterator<Item = (Amount<NonNegative>, transparent::Script)>,
|
||||
like_zcashd: bool,
|
||||
|
|
|
@ -437,7 +437,7 @@ where
|
|||
let rpc_impl = RpcImpl {
|
||||
build_version,
|
||||
user_agent,
|
||||
network,
|
||||
network: network.clone(),
|
||||
debug_force_finished_sync,
|
||||
debug_like_zcashd,
|
||||
mempool: mempool.clone(),
|
||||
|
@ -491,7 +491,7 @@ where
|
|||
// TODO: use a generic error constructor (#5548)
|
||||
#[allow(clippy::unwrap_in_result)]
|
||||
fn get_blockchain_info(&self) -> Result<GetBlockChainInfo> {
|
||||
let network = self.network;
|
||||
let network = &self.network;
|
||||
|
||||
// `chain` field
|
||||
let chain = self.network.bip70_network_name();
|
||||
|
@ -1113,7 +1113,6 @@ where
|
|||
})?;
|
||||
|
||||
// Fetch the block referenced by [`hash_or_height`] from the state.
|
||||
|
||||
// TODO: If this RPC is called a lot, just get the block header,
|
||||
// rather than the whole block.
|
||||
let block_request = zebra_state::ReadRequest::Block(hash_or_height);
|
||||
|
|
|
@ -438,7 +438,7 @@ where
|
|||
/// If the `mining_config` is invalid.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
mining_config: crate::config::mining::Config,
|
||||
mempool: Mempool,
|
||||
state: State,
|
||||
|
@ -448,10 +448,10 @@ where
|
|||
address_book: AddressBook,
|
||||
) -> Self {
|
||||
// Prevent loss of miner funds due to an unsupported or incorrect address type.
|
||||
if let Some(miner_address) = mining_config.miner_address {
|
||||
if let Some(miner_address) = mining_config.miner_address.clone() {
|
||||
assert_eq!(
|
||||
miner_address.network(),
|
||||
network,
|
||||
network.clone(),
|
||||
"incorrect miner address config: {miner_address} \
|
||||
network.network {network} and miner address network {} must match",
|
||||
miner_address.network(),
|
||||
|
@ -486,7 +486,7 @@ where
|
|||
);
|
||||
|
||||
Self {
|
||||
network,
|
||||
network: network.clone(),
|
||||
miner_address: mining_config.miner_address,
|
||||
extra_coinbase_data,
|
||||
debug_like_zcashd,
|
||||
|
@ -576,8 +576,8 @@ where
|
|||
parameters: Option<get_block_template::JsonParameters>,
|
||||
) -> BoxFuture<Result<get_block_template::Response>> {
|
||||
// Clone Configs
|
||||
let network = self.network;
|
||||
let miner_address = self.miner_address;
|
||||
let network = self.network.clone();
|
||||
let miner_address = self.miner_address.clone();
|
||||
let debug_like_zcashd = self.debug_like_zcashd;
|
||||
let extra_coinbase_data = self.extra_coinbase_data.clone();
|
||||
|
||||
|
@ -626,7 +626,7 @@ where
|
|||
//
|
||||
// Optional TODO:
|
||||
// - add `async changed()` method to ChainSyncStatus (like `ChainTip`)
|
||||
check_synced_to_tip(network, latest_chain_tip.clone(), sync_status.clone())?;
|
||||
check_synced_to_tip(&network, latest_chain_tip.clone(), sync_status.clone())?;
|
||||
|
||||
// TODO: return an error if we have no peers, like `zcashd` does,
|
||||
// and add a developer config that mines regardless of how many peers we have.
|
||||
|
@ -861,9 +861,9 @@ where
|
|||
|
||||
// Randomly select some mempool transactions.
|
||||
let mempool_txs = zip317::select_mempool_transactions(
|
||||
network,
|
||||
&network,
|
||||
next_block_height,
|
||||
miner_address,
|
||||
&miner_address,
|
||||
mempool_txs,
|
||||
debug_like_zcashd,
|
||||
extra_coinbase_data.clone(),
|
||||
|
@ -881,8 +881,8 @@ where
|
|||
// - After this point, the template only depends on the previously fetched data.
|
||||
|
||||
let response = GetBlockTemplate::new(
|
||||
network,
|
||||
miner_address,
|
||||
&network,
|
||||
&miner_address,
|
||||
&chain_tip_and_local_time,
|
||||
server_long_poll_id,
|
||||
mempool_txs,
|
||||
|
@ -988,7 +988,7 @@ where
|
|||
}
|
||||
|
||||
fn get_mining_info(&self) -> BoxFuture<Result<get_mining_info::Response>> {
|
||||
let network = self.network;
|
||||
let network = self.network.clone();
|
||||
let solution_rate_fut = self.get_network_sol_ps(None, None);
|
||||
async move {
|
||||
Ok(get_mining_info::Response::new(
|
||||
|
@ -1062,7 +1062,7 @@ where
|
|||
&self,
|
||||
raw_address: String,
|
||||
) -> BoxFuture<Result<validate_address::Response>> {
|
||||
let network = self.network;
|
||||
let network = self.network.clone();
|
||||
|
||||
async move {
|
||||
let Ok(address) = raw_address
|
||||
|
@ -1107,7 +1107,7 @@ where
|
|||
&self,
|
||||
raw_address: String,
|
||||
) -> BoxFuture<Result<types::z_validate_address::Response>> {
|
||||
let network = self.network;
|
||||
let network = self.network.clone();
|
||||
|
||||
async move {
|
||||
let Ok(address) = raw_address
|
||||
|
@ -1148,7 +1148,7 @@ where
|
|||
|
||||
fn get_block_subsidy(&self, height: Option<u32>) -> BoxFuture<Result<BlockSubsidy>> {
|
||||
let latest_chain_tip = self.latest_chain_tip.clone();
|
||||
let network = self.network;
|
||||
let network = self.network.clone();
|
||||
|
||||
async move {
|
||||
let height = if let Some(height) = height {
|
||||
|
@ -1167,7 +1167,7 @@ where
|
|||
});
|
||||
}
|
||||
|
||||
let miner = miner_subsidy(height, network).map_err(|error| Error {
|
||||
let miner = miner_subsidy(height, &network).map_err(|error| Error {
|
||||
code: ErrorCode::ServerError(0),
|
||||
message: error.to_string(),
|
||||
data: None,
|
||||
|
@ -1176,7 +1176,7 @@ where
|
|||
let founders = Amount::zero();
|
||||
|
||||
let funding_streams =
|
||||
funding_stream_values(height, network).map_err(|error| Error {
|
||||
funding_stream_values(height, &network).map_err(|error| Error {
|
||||
code: ErrorCode::ServerError(0),
|
||||
message: error.to_string(),
|
||||
data: None,
|
||||
|
@ -1184,7 +1184,7 @@ where
|
|||
let mut funding_streams: Vec<_> = funding_streams
|
||||
.iter()
|
||||
.map(|(receiver, value)| {
|
||||
let address = funding_stream_address(height, network, *receiver);
|
||||
let address = funding_stream_address(height, &network, *receiver);
|
||||
(*receiver, FundingStream::new(*receiver, *value, address))
|
||||
})
|
||||
.collect();
|
||||
|
@ -1208,7 +1208,7 @@ where
|
|||
}
|
||||
|
||||
fn get_difficulty(&self) -> BoxFuture<Result<f64>> {
|
||||
let network = self.network;
|
||||
let network = self.network.clone();
|
||||
let mut state = self.state.clone();
|
||||
|
||||
async move {
|
||||
|
|
|
@ -113,7 +113,7 @@ where
|
|||
Tip: ChainTip + Clone + Send + Sync + 'static,
|
||||
SyncStatus: ChainSyncStatus + Clone + Send + Sync + 'static,
|
||||
{
|
||||
check_synced_to_tip(network, latest_chain_tip, sync_status)?;
|
||||
check_synced_to_tip(&network, latest_chain_tip, sync_status)?;
|
||||
|
||||
let block: Block = match block_proposal_bytes.zcash_deserialize_into() {
|
||||
Ok(block) => block,
|
||||
|
@ -158,7 +158,7 @@ where
|
|||
/// Returns an error if Zebra is not synced to the consensus chain tip.
|
||||
/// This error might be incorrect if the local clock is skewed.
|
||||
pub fn check_synced_to_tip<Tip, SyncStatus>(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
latest_chain_tip: Tip,
|
||||
sync_status: SyncStatus,
|
||||
) -> Result<()>
|
||||
|
@ -283,9 +283,9 @@ where
|
|||
/// If `like_zcashd` is true, try to match the coinbase transactions generated by `zcashd`
|
||||
/// in the `getblocktemplate` RPC.
|
||||
pub fn generate_coinbase_and_roots(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
height: Height,
|
||||
miner_address: transparent::Address,
|
||||
miner_address: &transparent::Address,
|
||||
mempool_txs: &[VerifiedUnminedTx],
|
||||
history_tree: Arc<zebra_chain::history_tree::HistoryTree>,
|
||||
like_zcashd: bool,
|
||||
|
@ -319,9 +319,9 @@ pub fn generate_coinbase_and_roots(
|
|||
/// If `like_zcashd` is true, try to match the coinbase transactions generated by `zcashd`
|
||||
/// in the `getblocktemplate` RPC.
|
||||
pub fn generate_coinbase_transaction(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
height: Height,
|
||||
miner_address: transparent::Address,
|
||||
miner_address: &transparent::Address,
|
||||
miner_fee: Amount<NonNegative>,
|
||||
like_zcashd: bool,
|
||||
extra_coinbase_data: Vec<u8>,
|
||||
|
@ -355,13 +355,13 @@ pub fn calculate_miner_fee(mempool_txs: &[VerifiedUnminedTx]) -> Amount<NonNegat
|
|||
/// If `like_zcashd` is true, try to match the coinbase transactions generated by `zcashd`
|
||||
/// in the `getblocktemplate` RPC.
|
||||
pub fn standard_coinbase_outputs(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
height: Height,
|
||||
miner_address: transparent::Address,
|
||||
miner_address: &transparent::Address,
|
||||
miner_fee: Amount<NonNegative>,
|
||||
like_zcashd: bool,
|
||||
) -> Vec<(Amount<NonNegative>, transparent::Script)> {
|
||||
let funding_streams = funding_stream_values(height, network)
|
||||
let funding_streams = funding_stream_values(height, &network)
|
||||
.expect("funding stream value calculations are valid for reasonable chain heights");
|
||||
|
||||
// Optional TODO: move this into a zebra_consensus function?
|
||||
|
@ -373,12 +373,12 @@ pub fn standard_coinbase_outputs(
|
|||
.map(|(receiver, amount)| {
|
||||
(
|
||||
receiver,
|
||||
(amount, funding_stream_address(height, network, receiver)),
|
||||
(amount, funding_stream_address(height, &network, receiver)),
|
||||
)
|
||||
})
|
||||
.collect();
|
||||
|
||||
let miner_reward = miner_subsidy(height, network)
|
||||
let miner_reward = miner_subsidy(height, &network)
|
||||
.expect("reward calculations are valid for reasonable chain heights")
|
||||
+ miner_fee;
|
||||
let miner_reward =
|
||||
|
@ -393,7 +393,7 @@ pub fn standard_coinbase_outputs(
|
|||
/// in the `getblocktemplate` RPC.
|
||||
fn combine_coinbase_outputs(
|
||||
funding_streams: HashMap<FundingStreamReceiver, (Amount<NonNegative>, transparent::Address)>,
|
||||
miner_address: transparent::Address,
|
||||
miner_address: &transparent::Address,
|
||||
miner_reward: Amount<NonNegative>,
|
||||
like_zcashd: bool,
|
||||
) -> Vec<(Amount<NonNegative>, transparent::Script)> {
|
||||
|
@ -402,7 +402,7 @@ fn combine_coinbase_outputs(
|
|||
.into_iter()
|
||||
.map(|(_receiver, (amount, address))| (amount, address))
|
||||
.collect();
|
||||
coinbase_outputs.push((miner_reward, miner_address));
|
||||
coinbase_outputs.push((miner_reward, miner_address.clone()));
|
||||
|
||||
let mut coinbase_outputs: Vec<(Amount<NonNegative>, transparent::Script)> = coinbase_outputs
|
||||
.iter()
|
||||
|
|
|
@ -223,8 +223,8 @@ impl GetBlockTemplate {
|
|||
/// in the `getblocktemplate` RPC.
|
||||
#[allow(clippy::too_many_arguments)]
|
||||
pub fn new(
|
||||
network: Network,
|
||||
miner_address: transparent::Address,
|
||||
network: &Network,
|
||||
miner_address: &transparent::Address,
|
||||
chain_tip_and_local_time: &GetBlockTemplateChainInfo,
|
||||
long_poll_id: LongPollId,
|
||||
mempool_txs: Vec<VerifiedUnminedTx>,
|
||||
|
|
|
@ -37,9 +37,9 @@ use crate::methods::get_block_template_rpcs::{
|
|||
///
|
||||
/// [ZIP-317]: https://zips.z.cash/zip-0317#block-production
|
||||
pub async fn select_mempool_transactions(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
next_block_height: Height,
|
||||
miner_address: transparent::Address,
|
||||
miner_address: &transparent::Address,
|
||||
mempool_txs: Vec<VerifiedUnminedTx>,
|
||||
like_zcashd: bool,
|
||||
extra_coinbase_data: Vec<u8>,
|
||||
|
@ -115,9 +115,9 @@ pub async fn select_mempool_transactions(
|
|||
/// If `like_zcashd` is true, try to match the coinbase transactions generated by `zcashd`
|
||||
/// in the `getblocktemplate` RPC.
|
||||
pub fn fake_coinbase_transaction(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
height: Height,
|
||||
miner_address: transparent::Address,
|
||||
miner_address: &transparent::Address,
|
||||
like_zcashd: bool,
|
||||
extra_coinbase_data: Vec<u8>,
|
||||
) -> TransactionTemplate<NegativeOrZero> {
|
||||
|
|
|
@ -596,7 +596,7 @@ proptest! {
|
|||
let (rpc, rpc_tx_queue_task_handle) = RpcImpl::new(
|
||||
"RPC test",
|
||||
"RPC test",
|
||||
network,
|
||||
network.clone(),
|
||||
false,
|
||||
true,
|
||||
mempool.clone(),
|
||||
|
|
|
@ -35,14 +35,14 @@ async fn test_rpc_response_data() {
|
|||
let _init_guard = zebra_test::init();
|
||||
|
||||
tokio::join!(
|
||||
test_rpc_response_data_for_network(Mainnet),
|
||||
test_rpc_response_data_for_network(Testnet),
|
||||
test_mocked_rpc_response_data_for_network(Mainnet),
|
||||
test_mocked_rpc_response_data_for_network(Testnet),
|
||||
test_rpc_response_data_for_network(&Mainnet),
|
||||
test_rpc_response_data_for_network(&Testnet),
|
||||
test_mocked_rpc_response_data_for_network(&Mainnet),
|
||||
test_mocked_rpc_response_data_for_network(&Testnet),
|
||||
);
|
||||
}
|
||||
|
||||
async fn test_rpc_response_data_for_network(network: Network) {
|
||||
async fn test_rpc_response_data_for_network(network: &Network) {
|
||||
// Create a continuous chain of mainnet and testnet blocks from genesis
|
||||
let block_data = network.blockchain_map();
|
||||
|
||||
|
@ -65,7 +65,7 @@ async fn test_rpc_response_data_for_network(network: Network) {
|
|||
// Test getblocktemplate-rpcs snapshots
|
||||
#[cfg(feature = "getblocktemplate-rpcs")]
|
||||
get_block_template_rpcs::test_responses(
|
||||
network,
|
||||
&network,
|
||||
mempool.clone(),
|
||||
state,
|
||||
read_state.clone(),
|
||||
|
@ -77,7 +77,7 @@ async fn test_rpc_response_data_for_network(network: Network) {
|
|||
let (rpc, _rpc_tx_queue_task_handle) = RpcImpl::new(
|
||||
"RPC test",
|
||||
"/Zebra:RPC test/",
|
||||
network,
|
||||
network.clone(),
|
||||
false,
|
||||
true,
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
|
@ -320,7 +320,7 @@ async fn test_rpc_response_data_for_network(network: Network) {
|
|||
snapshot_rpc_getaddressutxos(get_address_utxos, &settings);
|
||||
}
|
||||
|
||||
async fn test_mocked_rpc_response_data_for_network(network: Network) {
|
||||
async fn test_mocked_rpc_response_data_for_network(network: &Network) {
|
||||
// Prepare the test harness.
|
||||
|
||||
let mut settings = insta::Settings::clone_current();
|
||||
|
@ -333,7 +333,7 @@ async fn test_mocked_rpc_response_data_for_network(network: Network) {
|
|||
let (rpc, _) = RpcImpl::new(
|
||||
"RPC test",
|
||||
"/Zebra:RPC test/",
|
||||
network,
|
||||
network.clone(),
|
||||
false,
|
||||
true,
|
||||
mempool,
|
||||
|
@ -542,7 +542,7 @@ fn snapshot_rpc_getaddressutxos(utxos: Vec<GetAddressUtxos>, settings: &insta::S
|
|||
}
|
||||
|
||||
/// Utility function to convert a `Network` to a lowercase string.
|
||||
fn network_string(network: Network) -> String {
|
||||
fn network_string(network: &Network) -> String {
|
||||
let mut net_suffix = network.to_string();
|
||||
net_suffix.make_ascii_lowercase();
|
||||
net_suffix
|
||||
|
|
|
@ -51,7 +51,7 @@ use crate::methods::{
|
|||
};
|
||||
|
||||
pub async fn test_responses<State, ReadState>(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
mempool: MockService<
|
||||
mempool::Request,
|
||||
mempool::Response,
|
||||
|
|
|
@ -10,7 +10,7 @@ use zebra_chain::{
|
|||
};
|
||||
|
||||
/// Create a history tree with one single block for a network by using Zebra test vectors.
|
||||
pub fn fake_history_tree(network: Network) -> Arc<HistoryTree> {
|
||||
pub fn fake_history_tree(network: &Network) -> Arc<HistoryTree> {
|
||||
let (block, sapling_root) = network.test_block_sapling_roots(1046400, 1116000).unwrap();
|
||||
|
||||
let block = Arc::<Block>::zcash_deserialize(block).expect("block should deserialize");
|
||||
|
|
|
@ -683,7 +683,7 @@ async fn rpc_getaddresstxids_response() {
|
|||
for start in 1..=10 {
|
||||
for end in start..=10 {
|
||||
rpc_getaddresstxids_response_with(
|
||||
network,
|
||||
&network,
|
||||
start..=end,
|
||||
&address,
|
||||
&read_state,
|
||||
|
@ -695,7 +695,7 @@ async fn rpc_getaddresstxids_response() {
|
|||
} else {
|
||||
// Just test the full range for testnet.
|
||||
rpc_getaddresstxids_response_with(
|
||||
network,
|
||||
&network,
|
||||
1..=10,
|
||||
&address,
|
||||
&read_state,
|
||||
|
@ -707,7 +707,7 @@ async fn rpc_getaddresstxids_response() {
|
|||
}
|
||||
|
||||
async fn rpc_getaddresstxids_response_with(
|
||||
network: Network,
|
||||
network: &Network,
|
||||
range: RangeInclusive<u32>,
|
||||
address: &transparent::Address,
|
||||
read_state: &ReadStateService,
|
||||
|
@ -718,7 +718,7 @@ async fn rpc_getaddresstxids_response_with(
|
|||
let (rpc, rpc_tx_queue_task_handle) = RpcImpl::new(
|
||||
"RPC test",
|
||||
"RPC test",
|
||||
network,
|
||||
network.clone(),
|
||||
false,
|
||||
true,
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
|
@ -876,7 +876,7 @@ async fn rpc_getblockcount() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state,
|
||||
|
@ -921,7 +921,7 @@ async fn rpc_getblockcount_empty_state() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state,
|
||||
|
@ -982,7 +982,7 @@ async fn rpc_getpeerinfo() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
network,
|
||||
&network,
|
||||
Default::default(),
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state,
|
||||
|
@ -1038,7 +1038,7 @@ async fn rpc_getblockhash() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state,
|
||||
|
@ -1094,7 +1094,7 @@ async fn rpc_getmininginfo() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
MockService::build().for_unit_tests(),
|
||||
read_state,
|
||||
|
@ -1130,7 +1130,7 @@ async fn rpc_getnetworksolps() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
MockService::build().for_unit_tests(),
|
||||
read_state,
|
||||
|
@ -1259,7 +1259,7 @@ async fn rpc_getblocktemplate_mining_address(use_p2pkh: bool) {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
mining_config,
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state.clone(),
|
||||
|
@ -1284,7 +1284,7 @@ async fn rpc_getblocktemplate_mining_address(use_p2pkh: bool) {
|
|||
cur_time: fake_cur_time,
|
||||
min_time: fake_min_time,
|
||||
max_time: fake_max_time,
|
||||
history_tree: fake_history_tree(Mainnet),
|
||||
history_tree: fake_history_tree(&Mainnet),
|
||||
}));
|
||||
}
|
||||
};
|
||||
|
@ -1523,7 +1523,7 @@ async fn rpc_submitblock_errors() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state,
|
||||
|
@ -1575,7 +1575,7 @@ async fn rpc_validateaddress() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
MockService::build().for_unit_tests(),
|
||||
MockService::build().for_unit_tests(),
|
||||
|
@ -1620,7 +1620,7 @@ async fn rpc_z_validateaddress() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
MockService::build().for_unit_tests(),
|
||||
MockService::build().for_unit_tests(),
|
||||
|
@ -1707,7 +1707,7 @@ async fn rpc_getdifficulty() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
mining_config,
|
||||
Buffer::new(mempool.clone(), 1),
|
||||
read_state.clone(),
|
||||
|
@ -1732,7 +1732,7 @@ async fn rpc_getdifficulty() {
|
|||
cur_time: fake_cur_time,
|
||||
min_time: fake_min_time,
|
||||
max_time: fake_max_time,
|
||||
history_tree: fake_history_tree(Mainnet),
|
||||
history_tree: fake_history_tree(&Mainnet),
|
||||
}));
|
||||
};
|
||||
|
||||
|
@ -1758,7 +1758,7 @@ async fn rpc_getdifficulty() {
|
|||
cur_time: fake_cur_time,
|
||||
min_time: fake_min_time,
|
||||
max_time: fake_max_time,
|
||||
history_tree: fake_history_tree(Mainnet),
|
||||
history_tree: fake_history_tree(&Mainnet),
|
||||
}));
|
||||
};
|
||||
|
||||
|
@ -1781,7 +1781,7 @@ async fn rpc_getdifficulty() {
|
|||
cur_time: fake_cur_time,
|
||||
min_time: fake_min_time,
|
||||
max_time: fake_max_time,
|
||||
history_tree: fake_history_tree(Mainnet),
|
||||
history_tree: fake_history_tree(&Mainnet),
|
||||
}));
|
||||
};
|
||||
|
||||
|
@ -1804,7 +1804,7 @@ async fn rpc_getdifficulty() {
|
|||
cur_time: fake_cur_time,
|
||||
min_time: fake_min_time,
|
||||
max_time: fake_max_time,
|
||||
history_tree: fake_history_tree(Mainnet),
|
||||
history_tree: fake_history_tree(&Mainnet),
|
||||
}));
|
||||
};
|
||||
|
||||
|
@ -1828,7 +1828,7 @@ async fn rpc_z_listunifiedreceivers() {
|
|||
|
||||
// Init RPC
|
||||
let get_block_template_rpc = get_block_template_rpcs::GetBlockTemplateRpcImpl::new(
|
||||
Mainnet,
|
||||
&Mainnet,
|
||||
Default::default(),
|
||||
MockService::build().for_unit_tests(),
|
||||
MockService::build().for_unit_tests(),
|
||||
|
|
|
@ -154,7 +154,7 @@ impl RpcServer {
|
|||
{
|
||||
// Initialize the getblocktemplate rpc method handler
|
||||
let get_block_template_rpc_impl = GetBlockTemplateRpcImpl::new(
|
||||
network,
|
||||
&network,
|
||||
mining_config.clone(),
|
||||
mempool.clone(),
|
||||
state.clone(),
|
||||
|
@ -171,7 +171,7 @@ impl RpcServer {
|
|||
let (rpc_impl, rpc_tx_queue_task_handle) = RpcImpl::new(
|
||||
build_version.clone(),
|
||||
user_agent,
|
||||
network,
|
||||
network.clone(),
|
||||
config.debug_force_finished_sync,
|
||||
#[cfg(feature = "getblocktemplate-rpcs")]
|
||||
mining_config.debug_like_zcashd,
|
||||
|
|
|
@ -135,7 +135,7 @@ pub async fn show_block_chain_progress(
|
|||
let is_syncer_stopped = sync_status.is_close_to_tip();
|
||||
|
||||
if let Some(estimated_height) =
|
||||
latest_chain_tip.estimate_network_chain_tip_height(network, now)
|
||||
latest_chain_tip.estimate_network_chain_tip_height(&network, now)
|
||||
{
|
||||
// The estimate/actual race doesn't matter here,
|
||||
// because we're only using it for metrics and logging.
|
||||
|
|
Loading…
Reference in New Issue