diff --git a/grin/src/seed.rs b/grin/src/seed.rs index 509239723..8b0f8751d 100644 --- a/grin/src/seed.rs +++ b/grin/src/seed.rs @@ -65,6 +65,8 @@ pub fn connect_and_monitor( // monitor additional peers if we need to add more monitor_peers(peers.clone(), capabilities, tx.clone()); + update_dandelion_relay(peers.clone()); + prev = current_time; } @@ -93,21 +95,6 @@ fn monitor_peers( total_count, ); - // Dandelion Relay Updater - let dandelion_relay = peers.get_dandelion_relay(); - if dandelion_relay.is_empty() { - debug!(LOGGER, "monitor_peers: no dandelion relay updating"); - peers.update_dandelion_relay(); - } else { - for last_added in dandelion_relay.keys() { - let dandelion_interval = now_utc().to_timespec().sec - last_added; - if dandelion_interval >= DANDELION_RELAY_TIME { - debug!(LOGGER, "monitor_peers: updating expired dandelion relay"); - peers.update_dandelion_relay(); - } - } - } - let mut healthy_count = 0; let mut banned_count = 0; let mut defunct_count = 0; @@ -168,6 +155,23 @@ fn monitor_peers( } } +fn update_dandelion_relay(peers: Arc) { + // Dandelion Relay Updater + let dandelion_relay = peers.get_dandelion_relay(); + if dandelion_relay.is_empty() { + debug!(LOGGER, "monitor_peers: no dandelion relay updating"); + peers.update_dandelion_relay(); + } else { + for last_added in dandelion_relay.keys() { + let dandelion_interval = now_utc().to_timespec().sec - last_added; + if dandelion_interval >= DANDELION_RELAY_TIME { + debug!(LOGGER, "monitor_peers: updating expired dandelion relay"); + peers.update_dandelion_relay(); + } + } + } +} + // Check if we have any pre-existing peer in db. If so, start with those, // otherwise use the seeds provided. fn connect_to_seeds( diff --git a/p2p/src/peers.rs b/p2p/src/peers.rs index 047dfe5de..392fdcdc8 100644 --- a/p2p/src/peers.rs +++ b/p2p/src/peers.rs @@ -92,7 +92,7 @@ impl Peers { peer.try_read().unwrap().info.addr ); } - None => error!(LOGGER, "Could not update dandelion relay"), + None => debug!(LOGGER, "Could not update dandelion relay"), }; } // Get the dandelion relay diff --git a/pool/src/pool.rs b/pool/src/pool.rs index 38ad77248..1243b6cea 100644 --- a/pool/src/pool.rs +++ b/pool/src/pool.rs @@ -271,7 +271,7 @@ where Parent::StemPoolTransaction { tx_ref: x } => { if will_stem { // Going to stem this transaction if parent is in stempool it's ok. - debug!(LOGGER, "Going is in stempool"); + debug!(LOGGER, "Going in stempool"); pool_refs.push(base.with_source(Some(x))); } else { will_stem = true; @@ -1711,14 +1711,7 @@ mod tests { let keychain = keychain_for_tests(); let key_id = keychain.derive_key_id(value as u32).unwrap(); let commit = keychain.commit(value, &key_id).unwrap(); - let proof = keychain - .range_proof( - value, - &key_id, - commit, - None, - ) - .unwrap(); + let proof = keychain.range_proof(value, &key_id, commit, None).unwrap(); transaction::Output { features: transaction::OutputFeatures::DEFAULT_OUTPUT, @@ -1732,14 +1725,7 @@ mod tests { let keychain = keychain_for_tests(); let key_id = keychain.derive_key_id(value as u32).unwrap(); let commit = keychain.commit(value, &key_id).unwrap(); - let proof = keychain - .range_proof( - value, - &key_id, - commit, - None, - ) - .unwrap(); + let proof = keychain.range_proof(value, &key_id, commit, None).unwrap(); transaction::Output { features: transaction::OutputFeatures::COINBASE_OUTPUT,