extend trait with network existence check

Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
Uncle Stinky 2026-02-22 13:14:58 +03:00
parent 4e1a3de6de
commit 63c03ad6ce
Signed by: st1nky
GPG Key ID: 016064BD97603B40
4 changed files with 7 additions and 2 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-networks"
version = "0.1.23"
version = "0.1.24"
license.workspace = true
authors.workspace = true
edition.workspace = true

View File

@ -733,6 +733,10 @@ impl<T: Config> NetworkDataInspectHandler<NetworkData> for Pallet<T> {
NetworkIndexes::<T>::get().len() as u32
}
fn contains_key(n: &Self::NetworkId) -> bool {
Networks::<T>::contains_key(n)
}
fn get(n: &Self::NetworkId) -> Option<NetworkData> {
Networks::<T>::get(n)
}

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-traits"
version = "0.3.29"
version = "0.3.30"
license.workspace = true
authors.workspace = true
edition.workspace = true

View File

@ -17,6 +17,7 @@ pub trait NetworkDataBasicHandler {
pub trait NetworkDataInspectHandler<Network>: NetworkDataBasicHandler {
fn count() -> u32;
fn contains_key(n: &Self::NetworkId) -> bool;
fn network_for_block(b: impl Into<usize>) -> Option<(Self::NetworkId, Network)>;
fn get(n: &Self::NetworkId) -> Option<Network>;
fn iter() -> PrefixIterator<(Self::NetworkId, Network)>;