mirror of
https://github.com/mimblewimble/grin-wallet.git
synced 2025-01-21 03:21:08 +03:00
Bits and Pieces for 3.0.0 beta (#271)
* deprecate the V2 Owner API * rustfmt * fix output from scan * fix scan output to be more consistent * rustfmt * updater thread test
This commit is contained in:
parent
29b9222212
commit
7db55592d0
5 changed files with 16 additions and 15 deletions
|
@ -1226,12 +1226,16 @@ where
|
||||||
start_height: Option<u64>,
|
start_height: Option<u64>,
|
||||||
delete_unconfirmed: bool,
|
delete_unconfirmed: bool,
|
||||||
) -> Result<(), Error> {
|
) -> Result<(), Error> {
|
||||||
|
let tx = {
|
||||||
|
let t = self.status_tx.lock();
|
||||||
|
t.clone()
|
||||||
|
};
|
||||||
owner::scan(
|
owner::scan(
|
||||||
self.wallet_inst.clone(),
|
self.wallet_inst.clone(),
|
||||||
keychain_mask,
|
keychain_mask,
|
||||||
start_height,
|
start_height,
|
||||||
delete_unconfirmed,
|
delete_unconfirmed,
|
||||||
&None,
|
&tx,
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,10 @@ pub trait OwnerRpc: Sync + Send {
|
||||||
# , false, 4, false, false, false);
|
# , false, 4, false, false, false);
|
||||||
```
|
```
|
||||||
*/
|
*/
|
||||||
|
#[deprecated(
|
||||||
|
since = "3.0.0",
|
||||||
|
note = "The V2 Owner API (OwnerRpc) will be removed in grin-wallet 4.0.0. Please migrate to the V3 (OwnerRpcS) API as soon as possible."
|
||||||
|
)]
|
||||||
fn accounts(&self) -> Result<Vec<AcctPathMapping>, ErrorKind>;
|
fn accounts(&self) -> Result<Vec<AcctPathMapping>, ErrorKind>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -98,7 +98,7 @@ fn updater_thread_test_impl(test_dir: &'static str) -> Result<(), libwallet::Err
|
||||||
thread::sleep(Duration::from_secs(10));
|
thread::sleep(Duration::from_secs(10));
|
||||||
|
|
||||||
let messages = owner_api.get_updater_messages(1000)?;
|
let messages = owner_api.get_updater_messages(1000)?;
|
||||||
assert_eq!(messages.len(), 34);
|
assert_eq!(messages.len(), 32);
|
||||||
|
|
||||||
owner_api.stop_updater()?;
|
owner_api.stop_updater()?;
|
||||||
thread::sleep(Duration::from_secs(2));
|
thread::sleep(Duration::from_secs(2));
|
||||||
|
|
|
@ -722,8 +722,7 @@ where
|
||||||
let start_index = last_scanned_block.height.saturating_sub(100);
|
let start_index = last_scanned_block.height.saturating_sub(100);
|
||||||
|
|
||||||
if last_scanned_block.height == 0 {
|
if last_scanned_block.height == 0 {
|
||||||
let msg = format!("This wallet's contents has not been initialized with a full chain scan, performing scan now.
|
let msg = format!("This wallet has not been scanned against the current chain. Beginning full scan... (this first scan may take a while, but subsequent scans will be much quicker)");
|
||||||
This operation may take a while for the first scan, but should be much quicker once the initial scan is done.");
|
|
||||||
if let Some(ref s) = status_send_channel {
|
if let Some(ref s) = status_send_channel {
|
||||||
let _ = s.send(StatusMessage::FullScanWarn(msg));
|
let _ = s.send(StatusMessage::FullScanWarn(msg));
|
||||||
}
|
}
|
||||||
|
|
|
@ -73,13 +73,6 @@ where
|
||||||
K: Keychain + 'a,
|
K: Keychain + 'a,
|
||||||
{
|
{
|
||||||
let mut wallet_outputs: Vec<OutputResult> = Vec::new();
|
let mut wallet_outputs: Vec<OutputResult> = Vec::new();
|
||||||
let msg = format!(
|
|
||||||
"Scanning {} outputs in the current Grin utxo set",
|
|
||||||
outputs.len(),
|
|
||||||
);
|
|
||||||
if let Some(ref s) = status_send_channel {
|
|
||||||
let _ = s.send(StatusMessage::Scanning(msg, percentage_complete));
|
|
||||||
}
|
|
||||||
|
|
||||||
let legacy_builder = proof::LegacyProofBuilder::new(keychain);
|
let legacy_builder = proof::LegacyProofBuilder::new(keychain);
|
||||||
let builder = proof::ProofBuilder::new(keychain);
|
let builder = proof::ProofBuilder::new(keychain);
|
||||||
|
@ -161,16 +154,17 @@ where
|
||||||
K: Keychain + 'a,
|
K: Keychain + 'a,
|
||||||
{
|
{
|
||||||
let batch_size = 1000;
|
let batch_size = 1000;
|
||||||
|
let start_index_stat = start_index;
|
||||||
let mut start_index = start_index;
|
let mut start_index = start_index;
|
||||||
let mut result_vec: Vec<OutputResult> = vec![];
|
let mut result_vec: Vec<OutputResult> = vec![];
|
||||||
let last_retrieved_return_index;
|
let last_retrieved_return_index;
|
||||||
loop {
|
loop {
|
||||||
let (highest_index, last_retrieved_index, outputs) =
|
let (highest_index, last_retrieved_index, outputs) =
|
||||||
client.get_outputs_by_pmmr_index(start_index, end_index, batch_size)?;
|
client.get_outputs_by_pmmr_index(start_index, end_index, batch_size)?;
|
||||||
let perc_complete = cmp::min(
|
|
||||||
((last_retrieved_index as f64 / highest_index as f64) * 100.0) as u8,
|
let range = highest_index as f64 - start_index_stat as f64;
|
||||||
99,
|
let progress = last_retrieved_index as f64 - start_index_stat as f64;
|
||||||
);
|
let perc_complete = cmp::min(((progress / range) * 100.0) as u8, 99);
|
||||||
|
|
||||||
let msg = format!(
|
let msg = format!(
|
||||||
"Checking {} outputs, up to index {}. (Highest index: {})",
|
"Checking {} outputs, up to index {}. (Highest index: {})",
|
||||||
|
|
Loading…
Reference in a new issue