Skip to content

Commit 1858438

Browse files
committed
Fix NeuronInfoLite::stake returns Stake
1 parent a3efc24 commit 1858438

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

pallets/subtensor/src/rpc_info/neuron_info.rs

+2-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
use super::*;
22
use frame_support::pallet_prelude::{Decode, Encode};
3-
use frame_support::storage::IterableStorageDoubleMap;
43
extern crate alloc;
54
use codec::Compact;
65

@@ -177,13 +176,8 @@ impl<T: Config> Pallet<T> {
177176
let last_update = Self::get_last_update_for_uid(netuid, uid);
178177
let validator_permit = Self::get_validator_permit_for_uid(netuid, uid);
179178

180-
let stake: Vec<(T::AccountId, Compact<u64>)> =
181-
<Stake<T> as IterableStorageDoubleMap<T::AccountId, T::AccountId, u64>>::iter_prefix(
182-
hotkey.clone(),
183-
)
184-
.map(|(coldkey, stake)| (coldkey, stake.into()))
185-
.collect();
186-
179+
let stake_weight: u64 = Self::get_stake_weight(netuid, uid) as u64;
180+
let stake: Vec<(T::AccountId, Compact<u64>)> = vec![(coldkey.clone(), stake_weight.into())];
187181
let neuron = NeuronInfoLite {
188182
hotkey: hotkey.clone(),
189183
coldkey: coldkey.clone(),

0 commit comments

Comments
 (0)