Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use chk for neuron info lite stake #936

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 4 additions & 7 deletions pallets/subtensor/src/rpc_info/neuron_info.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use super::*;
use frame_support::pallet_prelude::{Decode, Encode};
use frame_support::storage::IterableStorageDoubleMap;
extern crate alloc;
use codec::Compact;

Expand Down Expand Up @@ -179,12 +178,10 @@ impl<T: Config> Pallet<T> {
let last_update = Self::get_last_update_for_uid(netuid, uid);
let validator_permit = Self::get_validator_permit_for_uid(netuid, uid);

let stake: Vec<(T::AccountId, Compact<u64>)> =
<Stake<T> as IterableStorageDoubleMap<T::AccountId, T::AccountId, u64>>::iter_prefix(
hotkey.clone(),
)
.map(|(coldkey, stake)| (coldkey, stake.into()))
.collect();
let stake: Vec<(T::AccountId, Compact<u64>)> = vec![(
coldkey.clone(),
Self::get_stake_for_hotkey_on_subnet(&hotkey, netuid).into(),
)];

let neuron = NeuronInfoLite {
hotkey: hotkey.clone(),
Expand Down
Loading