Skip to content

Commit

Permalink
Added a mainnet dnsseeder (kaspanet#224)
Browse files Browse the repository at this point in the history
* Added a mainnet dnsseeder

* fix a bunch of new clippy warnings (rust 1.71)

---------

Co-authored-by: Michael Sutton <msutton@cs.huji.ac.il>
  • Loading branch information
supertypo and michaelsutton committed Jul 16, 2023
1 parent 04ac056 commit d39f5f8
Show file tree
Hide file tree
Showing 7 changed files with 11 additions and 12 deletions.
2 changes: 2 additions & 0 deletions consensus/core/src/config/params.rs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,8 @@ pub const MAINNET_PARAMS: Params = Params {
"seeder4.kaspad.net",
// This DNS seeder is run by Tim
"kaspadns.kaspacalc.net",
// This DNS seeder is run by supertypo
"n-mainnet.kaspa.ws",
],
net: NetworkId::new(NetworkType::Mainnet),
genesis: GENESIS,
Expand Down
4 changes: 2 additions & 2 deletions consensus/src/model/stores/relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ impl RelationsStore for StagingRelationsStore<'_> {
type DefaultWriter = MemoryWriter;

fn default_writer(&self) -> Self::DefaultWriter {
MemoryWriter::default()
MemoryWriter
}

fn set_parents(&mut self, _writer: impl DbWriter, hash: Hash, parents: BlockHashes) -> Result<(), StoreError> {
Expand Down Expand Up @@ -267,7 +267,7 @@ impl RelationsStore for MemoryRelationsStore {
type DefaultWriter = MemoryWriter;

fn default_writer(&self) -> Self::DefaultWriter {
MemoryWriter::default()
MemoryWriter
}

fn set_parents(&mut self, _writer: impl DbWriter, hash: Hash, parents: BlockHashes) -> Result<(), StoreError> {
Expand Down
5 changes: 2 additions & 3 deletions consensus/src/pipeline/pruning_processor/processor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ impl PruningProcessor {
counter += 1;
// Prune data related to headers: relations, reachability, ghostdag
let mergeset = relations::delete_reachability_relations(
MemoryWriter::default(), // Both stores are staging so we just pass a dummy writer
MemoryWriter, // Both stores are staging so we just pass a dummy writer
&mut staging_relations,
&staging_reachability,
current,
Expand All @@ -372,8 +372,7 @@ impl PruningProcessor {
let block_level = self.headers_store.get_header_with_block_level(current).unwrap().block_level;
(0..=block_level as usize).for_each(|level| {
let mut staging_level_relations = StagingRelationsStore::new(&mut level_relations_write[level]);
relations::delete_level_relations(MemoryWriter::default(), &mut staging_level_relations, current)
.unwrap_option();
relations::delete_level_relations(MemoryWriter, &mut staging_level_relations, current).unwrap_option();
staging_level_relations.commit(&mut batch).unwrap();
self.ghostdag_stores[level].delete_batch(&mut batch, current).unwrap_option();
});
Expand Down
4 changes: 2 additions & 2 deletions consensus/src/processes/relations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ mod tests {

let mut batch = WriteBatch::default();
let mut staging_relations = StagingRelationsStore::new(&mut relations);
delete_level_relations(MemoryWriter::default(), &mut staging_relations, 1.into()).unwrap();
delete_level_relations(MemoryWriter, &mut staging_relations, 1.into()).unwrap();
staging_relations.commit(&mut batch).unwrap();
db.write(batch).unwrap();

Expand All @@ -199,7 +199,7 @@ mod tests {

let mut batch = WriteBatch::default();
let mut staging_relations = StagingRelationsStore::new(&mut relations);
delete_level_relations(MemoryWriter::default(), &mut staging_relations, 2.into()).unwrap();
delete_level_relations(MemoryWriter, &mut staging_relations, 2.into()).unwrap();
staging_relations.commit(&mut batch).unwrap();
db.write(batch).unwrap();

Expand Down
2 changes: 1 addition & 1 deletion mining/src/block_template/selector.rs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ impl TransactionsSelector {
if subnetwork_id < self.transactions[transaction_index].tx.subnetwork_id {
break;
}
let mut current = candidate_list.candidates.get_mut(i).unwrap();
let current = candidate_list.candidates.get_mut(i).unwrap();

// Mark for deletion
current.is_marked_for_deletion = true;
Expand Down
3 changes: 1 addition & 2 deletions mining/src/mempool/model/pool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,8 +66,7 @@ pub(crate) trait Pool {
let mut redeemers = TransactionIdSet::new();
if let Some(transaction) = self.get(transaction_id) {
let mut stack = vec![transaction];
while !stack.is_empty() {
let transaction = stack.pop().unwrap();
while let Some(transaction) = stack.pop() {
if let Some(chains) = self.chained().get(&transaction.id()) {
for redeemer_id in chains {
if let Some(redeemer) = self.get(redeemer_id) {
Expand Down
3 changes: 1 addition & 2 deletions mining/src/model/topological_index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ where
}
stack.push(key.clone());

while !stack.is_empty() {
let current = stack.pop().unwrap();
while let Some(current) = stack.pop() {
let current_color = color.get_mut(&current).unwrap();
match *current_color {
Color::White => {
Expand Down

0 comments on commit d39f5f8

Please sign in to comment.