Skip to content
Permalink
Browse files

Speed up payment validator

  • Loading branch information...
jkilpatr committed Aug 11, 2019
1 parent df6e755 commit 5e6fa28c8cbd118dd5e32b2ecbc3cef986519328
@@ -27,7 +27,7 @@ use web30::client::Web3;
use web30::types::TransactionResponse;

// How long we will wait for full node responses
const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(10);
const TRANSACTION_VERIFICATION_TIMEOUT: Duration = Duration::from_secs(1);
// Discard payments after 15 minutes of failing to find txid
pub const PAYMENT_TIMEOUT: Duration = Duration::from_secs(900u64);
// How many blocks before we assume finality
@@ -1,5 +1,6 @@
use crate::rita_common::debt_keeper::{DebtKeeper, SendUpdate};
use crate::rita_common::oracle::{Oracle, Update};
use crate::rita_common::payment_validator::{PaymentValidator, Validate};
use crate::rita_common::peer_listener::GetPeers;
use crate::rita_common::peer_listener::PeerListener;
use crate::rita_common::traffic_watcher::{TrafficWatcher, Watch};
@@ -87,6 +88,11 @@ impl Handler<Tick> for RitaFastLoop {
// hate it when their deposits take a while to show up
Oracle::from_registry().do_send(Update());

// Check on payments, only really needs to be run this quickly
// on large nodes where very high variation in throughput can result
// in blowing through the entire grace in less than a minute
PaymentValidator::from_registry().do_send(Validate());

// watch neighbors for billing
Arbiter::spawn(
TunnelManager::from_registry()
@@ -1,6 +1,5 @@
use crate::rita_common::dao_manager::DAOManager;
use crate::rita_common::dao_manager::Tick as DAOTick;
use crate::rita_common::payment_validator::{PaymentValidator, Validate};
use crate::rita_common::token_bridge::Tick as TokenBridgeTick;
use crate::rita_common::token_bridge::TokenBridge;
use crate::rita_common::tunnel_manager::{TriggerGC, TunnelManager};
@@ -80,9 +79,6 @@ impl Handler<Tick> for RitaSlowLoop {
// Check DAO payments
DAOManager::from_registry().do_send(DAOTick);

// Check payments
PaymentValidator::from_registry().do_send(Validate());

TunnelManager::from_registry().do_send(TriggerGC(Duration::from_secs(
SETTING.get_network().tunnel_timeout_seconds,
)));

0 comments on commit 5e6fa28

Please sign in to comment.
You can’t perform that action at this time.