Skip to content

Commit

Permalink
WIP on development
Browse files Browse the repository at this point in the history
improvments on validation
imporovements on UI feedback
  • Loading branch information
SWvheerden committed Aug 14, 2024
1 parent 131225c commit b74b1d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -407,9 +407,17 @@ impl TransactionsTab {
);

let confirmation_count = app_state.get_confirmations(tx.tx_id);
let confirmations_msg = if tx.status == TransactionStatus::MinedConfirmed && tx.cancelled.is_none() {
let confirmations_msg = if (tx.status == TransactionStatus::MinedConfirmed ||
tx.status == TransactionStatus::OneSidedConfirmed ||
tx.status == TransactionStatus::CoinbaseConfirmed) &&
tx.cancelled.is_none()
{
format!("{} required confirmations met", required_confirmations)
} else if tx.status == TransactionStatus::MinedUnconfirmed && tx.cancelled.is_none() {
} else if (tx.status == TransactionStatus::MinedUnconfirmed ||
tx.status == TransactionStatus::OneSidedUnconfirmed ||
tx.status == TransactionStatus::CoinbaseUnconfirmed) &&
tx.cancelled.is_none()
{
if let Some(count) = confirmation_count {
format!("{} of {} required confirmations met", count, required_confirmations)
} else {
Expand Down
2 changes: 1 addition & 1 deletion base_layer/wallet/src/base_node_service/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub struct BaseNodeServiceConfig {
impl Default for BaseNodeServiceConfig {
fn default() -> Self {
Self {
base_node_monitor_max_refresh_interval: Duration::from_secs(90),
base_node_monitor_max_refresh_interval: Duration::from_secs(30),
base_node_rpc_pool_size: 10,
event_channel_size: 250,
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ use crate::{
database::{OutputManagerBackend, OutputManagerDatabase},
models::DbWalletOutput,
sqlite_db::{ReceivedOutputInfoForBatch, SpentOutputInfoForBatch},
OutputStatus,
},
},
};
Expand Down Expand Up @@ -351,7 +350,6 @@ where

let unmined_and_invalid: Vec<_> = unmined
.iter()
.filter(|uo| uo.status == OutputStatus::UnspentMinedUnconfirmed)
.map(|uo| {
info!(
target: LOG_TARGET,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
// WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE
// USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

const SAFETY_HEIGHT_MARGIN: u64 = 1000;
const SAFETY_HEIGHT_MARGIN: u64 = 3000;

use std::sync::Arc;

Expand Down Expand Up @@ -52,11 +52,12 @@ pub async fn check_detected_transactions<TBackend: 'static + TransactionBackend>
// height or current tip height with safety margin to determine if these should be returned
let last_mined_transaction = db.fetch_last_mined_transaction().unwrap_or_default();

let height_with_margin = tip_height.saturating_sub(SAFETY_HEIGHT_MARGIN);
let check_height = if let Some(tx) = last_mined_transaction {
tx.mined_height.unwrap_or(height_with_margin)
tx.mined_height
.unwrap_or(tip_height)
.saturating_sub(SAFETY_HEIGHT_MARGIN)
} else {
height_with_margin
tip_height.saturating_sub(SAFETY_HEIGHT_MARGIN)
};

let mut all_detected_transactions: Vec<CompletedTransaction> = match db.get_imported_transactions() {
Expand All @@ -78,7 +79,7 @@ pub async fn check_detected_transactions<TBackend: 'static + TransactionBackend>
};
all_detected_transactions.append(&mut unconfirmed_detected);

let mut unmined_coinbases_detected = match db.get_unmined_coinbase_transactions(height_with_margin) {
let mut unmined_coinbases_detected = match db.get_unmined_coinbase_transactions(check_height) {
Ok(txs) => txs,
Err(e) => {
error!(
Expand Down

0 comments on commit b74b1d3

Please sign in to comment.