Skip to content

Commit 0a5461d

Browse files
committed
Merge branch 'master' of github.com:aspectron/rusty-kaspa
2 parents 5c01bd2 + b251c95 commit 0a5461d

File tree

54 files changed

+248
-84
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+248
-84
lines changed

README.md

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
1+
[![DeepWiki](https://img.shields.io/badge/DeepWiki-kaspanet%2Frusty--kaspa-blue.svg?logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACwAAAAyCAYAAAAnWDnqAAAAAXNSR0IArs4c6QAAA05JREFUaEPtmUtyEzEQhtWTQyQLHNak2AB7ZnyXZMEjXMGeK/AIi+QuHrMnbChYY7MIh8g01fJoopFb0uhhEqqcbWTp06/uv1saEDv4O3n3dV60RfP947Mm9/SQc0ICFQgzfc4CYZoTPAswgSJCCUJUnAAoRHOAUOcATwbmVLWdGoH//PB8mnKqScAhsD0kYP3j/Yt5LPQe2KvcXmGvRHcDnpxfL2zOYJ1mFwrryWTz0advv1Ut4CJgf5uhDuDj5eUcAUoahrdY/56ebRWeraTjMt/00Sh3UDtjgHtQNHwcRGOC98BJEAEymycmYcWwOprTgcB6VZ5JK5TAJ+fXGLBm3FDAmn6oPPjR4rKCAoJCal2eAiQp2x0vxTPB3ALO2CRkwmDy5WohzBDwSEFKRwPbknEggCPB/imwrycgxX2NzoMCHhPkDwqYMr9tRcP5qNrMZHkVnOjRMWwLCcr8ohBVb1OMjxLwGCvjTikrsBOiA6fNyCrm8V1rP93iVPpwaE+gO0SsWmPiXB+jikdf6SizrT5qKasx5j8ABbHpFTx+vFXp9EnYQmLx02h1QTTrl6eDqxLnGjporxl3NL3agEvXdT0WmEost648sQOYAeJS9Q7bfUVoMGnjo4AZdUMQku50McDcMWcBPvr0SzbTAFDfvJqwLzgxwATnCgnp4wDl6Aa+Ax283gghmj+vj7feE2KBBRMW3FzOpLOADl0Isb5587h/U4gGvkt5v60Z1VLG8BhYjbzRwyQZemwAd6cCR5/XFWLYZRIMpX39AR0tjaGGiGzLVyhse5C9RKC6ai42ppWPKiBagOvaYk8lO7DajerabOZP46Lby5wKjw1HCRx7p9sVMOWGzb/vA1hwiWc6jm3MvQDTogQkiqIhJV0nBQBTU+3okKCFDy9WwferkHjtxib7t3xIUQtHxnIwtx4mpg26/HfwVNVDb4oI9RHmx5WGelRVlrtiw43zboCLaxv46AZeB3IlTkwouebTr1y2NjSpHz68WNFjHvupy3q8TFn3Hos2IAk4Ju5dCo8B3wP7VPr/FGaKiG+T+v+TQqIrOqMTL1VdWV1DdmcbO8KXBz6esmYWYKPwDL5b5FA1a0hwapHiom0r/cKaoqr+27/XcrS5UwSMbQAAAABJRU5ErkJggg==)](https://deepwiki.com/kaspanet/rusty-kaspa)
2+
<!-- DeepWiki badge generated by https://deepwiki.ryoppippi.com/ -->
23
<h1>Kaspa On Rust</h1>
34

45
Welcome to the Rust-based implementation of the Kaspa full-node and its ancillary libraries. The contained node release serves as a drop-in replacement to the established <a href="https://github.com/kaspanet/kaspad">Golang node</a> and to date is the recommended node software for the Kaspa network, introducing developers to the possibilities of Rust in the Kaspa network's context.
@@ -11,9 +12,7 @@ The default branch of this repository is `master` and new contributions are cons
1112

1213
## The Crescendo Hardfork
1314

14-
The Crescendo Hardfork, which will transition the network to 10 BPS, is scheduled to activate on mainnet at DAA Score **110,165,000**, projected to occur on **May 5, 2025, at approximately 15:00 UTC**. Note that 24 hours before activation, nodes will connect only to upgraded peers which are using the new P2P protocol version 7.
15-
16-
You are encouraged to verify your client software against this mainnet version ahead of or after the hardfork. For a more controlled environment, consider using **Testnet 10**, where the Crescendo changes are already active. Refer to the [Crescendo guide](docs/crescendo-guide.md) for detailed instructions.
15+
The [Crescendo Hardfork](docs/crescendo-guide.md) took place on May 5, 2025, at approximately 15:00 UTC. The fork has transitioned the network from a blockrate of 1 BPS to that of 10 BPS, and incorporated several major KIPs.
1716

1817

1918

@@ -287,16 +286,16 @@ wRPC
287286
288287
JSON protocol:
289288
```bash
290-
--rpclisten-json = <interface:port>
289+
--rpclisten-json=<interface:port>
291290
# or use the defaults for current network
292-
--rpclisten-json = default
291+
--rpclisten-json=default
293292
```
294293
295294
Borsh protocol:
296295
```bash
297-
--rpclisten-borsh = <interface:port>
296+
--rpclisten-borsh=<interface:port>
298297
# or use the defaults for current network
299-
--rpclisten-borsh = default
298+
--rpclisten-borsh=default
300299
```
301300
302301
**Sidenote:**
@@ -422,4 +421,4 @@ Logging in `kaspad` and `simpa` can be [filtered](https://docs.rs/env_logger/0.1
422421
```
423422
In this command we set the `loglevel` to `INFO`.
424423
425-
</details>
424+
</details>

cli/src/modules/rpc.rs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,10 +128,16 @@ impl Rpc {
128128
};
129129
let start_hash = RpcHash::from_hex(argv.remove(0).as_str())?;
130130
let include_accepted_transaction_ids = argv.first().and_then(|x| x.parse::<bool>().ok()).unwrap_or_default();
131+
let min_confirmation_count = argv.get(1).and_then(|x| x.parse::<u64>().ok()).unwrap_or_default();
132+
131133
let result = rpc
132134
.get_virtual_chain_from_block_call(
133135
None,
134-
GetVirtualChainFromBlockRequest { start_hash, include_accepted_transaction_ids },
136+
GetVirtualChainFromBlockRequest {
137+
start_hash,
138+
include_accepted_transaction_ids,
139+
min_confirmation_count: Some(min_confirmation_count),
140+
},
135141
)
136142
.await?;
137143
self.println(&ctx, result);

components/consensusmanager/src/session.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,11 @@ impl SessionLock {
5959
SessionOwnedReadGuard(Arc::new(self.0.clone().read_owned().await))
6060
}
6161

62-
pub async fn read(&self) -> SessionReadGuard {
62+
pub async fn read(&self) -> SessionReadGuard<'_> {
6363
SessionReadGuard(self.0.read().await)
6464
}
6565

66-
pub fn blocking_read(&self) -> SessionReadGuard {
66+
pub fn blocking_read(&self) -> SessionReadGuard<'_> {
6767
SessionReadGuard(self.0.blocking_read())
6868
}
6969

@@ -86,7 +86,7 @@ impl ConsensusInstance {
8686
/// Returns a blocking session to be used in **non async** environments.
8787
/// Users would usually need to call something like `futures::executor::block_on` in order
8888
/// to acquire the session, but we prefer leaving this decision to the caller
89-
pub async fn session_blocking(&self) -> ConsensusSessionBlocking {
89+
pub async fn session_blocking(&self) -> ConsensusSessionBlocking<'_> {
9090
let g = self.session_lock.read().await;
9191
ConsensusSessionBlocking::new(g, self.consensus.clone())
9292
}
@@ -250,6 +250,10 @@ impl ConsensusSessionOwned {
250250
self.clone().spawn_blocking(|c| c.get_sink_timestamp()).await
251251
}
252252

253+
pub async fn async_get_sink_blue_score(&self) -> u64 {
254+
self.clone().spawn_blocking(|c| c.get_sink_blue_score()).await
255+
}
256+
253257
pub async fn async_get_sink_daa_score_timestamp(&self) -> DaaScoreTimestamp {
254258
self.clone().spawn_blocking(|c| c.get_sink_daa_score_timestamp()).await
255259
}

consensus/client/src/utxo.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ impl Ord for UtxoEntryReference {
272272

273273
impl PartialOrd for UtxoEntryReference {
274274
fn partial_cmp(&self, other: &Self) -> Option<std::cmp::Ordering> {
275-
Some(self.id().cmp(&other.id()))
275+
Some(self.cmp(other))
276276
}
277277
}
278278

consensus/core/src/api/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,10 @@ pub trait ConsensusApi: Send + Sync {
135135
unimplemented!()
136136
}
137137

138+
fn get_sink_blue_score(&self) -> u64 {
139+
unimplemented!()
140+
}
141+
138142
fn get_sink_daa_score_timestamp(&self) -> DaaScoreTimestamp {
139143
unimplemented!()
140144
}

consensus/core/src/config/params.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -487,8 +487,6 @@ pub const MAINNET_PARAMS: Params = Params {
487487
"n-mainnet.kaspa.ws",
488488
// This DNS seeder is run by -gerri-
489489
"dnsseeder-kaspa-mainnet.x-con.at",
490-
// This DNS seeder is run by H@H
491-
"ns-mainnet.kaspa-dnsseeder.net",
492490
],
493491
net: NetworkId::new(NetworkType::Mainnet),
494492
genesis: GENESIS,
@@ -547,8 +545,6 @@ pub const TESTNET_PARAMS: Params = Params {
547545
"seeder1-testnet.kaspad.net",
548546
// This DNS seeder is run by -gerri-
549547
"dnsseeder-kaspa-testnet.x-con.at",
550-
// This DNS seeder is run by H@H
551-
"ns-testnet10.kaspa-dnsseeder.net",
552548
// This DNS seeder is run by supertypo
553549
"n-testnet-10.kaspa.ws",
554550
],

consensus/src/consensus/mod.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ impl Consensus {
408408
}
409409

410410
/// Acquires a consensus session, blocking data-pruning from occurring until released
411-
pub fn acquire_session(&self) -> SessionReadGuard {
411+
pub fn acquire_session(&self) -> SessionReadGuard<'_> {
412412
self.pruning_lock.blocking_read()
413413
}
414414

@@ -588,6 +588,10 @@ impl ConsensusApi for Consensus {
588588
self.headers_store.get_timestamp(self.get_sink()).unwrap()
589589
}
590590

591+
fn get_sink_blue_score(&self) -> u64 {
592+
self.headers_store.get_blue_score(self.get_sink()).unwrap()
593+
}
594+
591595
fn get_sink_daa_score_timestamp(&self) -> DaaScoreTimestamp {
592596
let sink = self.get_sink();
593597
let compact = self.headers_store.get_compact_header_data(sink).unwrap();

consensus/src/model/stores/selected_chain.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ pub trait SelectedChainStoreBatchExtensions {
5858
batch: &mut WriteBatch,
5959
hash: Hash,
6060
status: BlockStatus,
61-
) -> Result<RwLockWriteGuard<DbSelectedChainStore>, StoreError>;
61+
) -> Result<RwLockWriteGuard<'_, DbSelectedChainStore>, StoreError>;
6262
}
6363

6464
impl SelectedChainStoreReader for DbSelectedChainStore {

consensus/src/model/stores/statuses.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ pub trait StatusesStoreBatchExtensions {
5454
batch: &mut WriteBatch,
5555
hash: Hash,
5656
status: BlockStatus,
57-
) -> Result<RwLockWriteGuard<DbStatusesStore>, StoreError>;
57+
) -> Result<RwLockWriteGuard<'_, DbStatusesStore>, StoreError>;
5858
}
5959

6060
impl StatusesStoreBatchExtensions for Arc<RwLock<DbStatusesStore>> {
@@ -63,7 +63,7 @@ impl StatusesStoreBatchExtensions for Arc<RwLock<DbStatusesStore>> {
6363
batch: &mut WriteBatch,
6464
hash: Hash,
6565
status: BlockStatus,
66-
) -> Result<RwLockWriteGuard<DbStatusesStore>, StoreError> {
66+
) -> Result<RwLockWriteGuard<'_, DbStatusesStore>, StoreError> {
6767
let write_guard = self.write();
6868
write_guard.access.write(BatchDbWriter::new(batch), hash, status)?;
6969
Ok(write_guard)

consensus/src/model/stores/utxo_set.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ type UtxoCollectionIterator<'a> = Box<dyn Iterator<Item = Result<(TransactionOut
1717

1818
pub trait UtxoSetStoreReader {
1919
fn get(&self, outpoint: &TransactionOutpoint) -> Result<Arc<UtxoEntry>, StoreError>;
20-
fn seek_iterator(&self, from_outpoint: Option<TransactionOutpoint>, limit: usize, skip_first: bool) -> UtxoCollectionIterator;
20+
fn seek_iterator(&self, from_outpoint: Option<TransactionOutpoint>, limit: usize, skip_first: bool) -> UtxoCollectionIterator<'_>;
2121
}
2222

2323
pub trait UtxoSetStore: UtxoSetStoreReader {
@@ -151,7 +151,7 @@ impl UtxoSetStoreReader for DbUtxoSetStore {
151151
self.access.read((*outpoint).into())
152152
}
153153

154-
fn seek_iterator(&self, from_outpoint: Option<TransactionOutpoint>, limit: usize, skip_first: bool) -> UtxoCollectionIterator {
154+
fn seek_iterator(&self, from_outpoint: Option<TransactionOutpoint>, limit: usize, skip_first: bool) -> UtxoCollectionIterator<'_> {
155155
let seek_key = from_outpoint.map(UtxoKey::from);
156156
Box::new(self.access.seek_iterator(None, seek_key, limit, skip_first).map(|res| {
157157
let (key, entry) = res?;

0 commit comments

Comments
 (0)