From 18584387bfd68873c8f21996d42471c492e2004d Mon Sep 17 00:00:00 2001 From: Aliaksandr Tsurko Date: Thu, 31 Oct 2024 17:42:42 +0100 Subject: [PATCH] Fix NeuronInfoLite::stake returns Stake --- pallets/subtensor/src/rpc_info/neuron_info.rs | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/pallets/subtensor/src/rpc_info/neuron_info.rs b/pallets/subtensor/src/rpc_info/neuron_info.rs index 26f222d9c..b20fda26d 100644 --- a/pallets/subtensor/src/rpc_info/neuron_info.rs +++ b/pallets/subtensor/src/rpc_info/neuron_info.rs @@ -1,6 +1,5 @@ use super::*; use frame_support::pallet_prelude::{Decode, Encode}; -use frame_support::storage::IterableStorageDoubleMap; extern crate alloc; use codec::Compact; @@ -177,13 +176,8 @@ impl Pallet { 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)> = - as IterableStorageDoubleMap>::iter_prefix( - hotkey.clone(), - ) - .map(|(coldkey, stake)| (coldkey, stake.into())) - .collect(); - + let stake_weight: u64 = Self::get_stake_weight(netuid, uid) as u64; + let stake: Vec<(T::AccountId, Compact)> = vec![(coldkey.clone(), stake_weight.into())]; let neuron = NeuronInfoLite { hotkey: hotkey.clone(), coldkey: coldkey.clone(),