Skip to content

Commit 1a37310

Browse files
guidiazaesedepece
authored andcommitted
fix(json_rpc): aggregate stake by withdrawer on getBalance2
1 parent 2fb85c5 commit 1a37310

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

data_structures/src/transaction_factory.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ impl NodeBalance2 {
9797
pub fn add_utxo_value(&mut self, utxo_value: u64, utxo_locked: bool) {
9898
if let NodeBalance2::One {
9999
unlocked, locked, ..
100-
} = self {
100+
} = self
101+
{
101102
if utxo_locked {
102103
locked.add_assign(utxo_value);
103104
} else {

node/src/actors/chain_manager/handlers.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1772,7 +1772,7 @@ impl Handler<GetBalance2> for ChainManager {
17721772
let stakes = self
17731773
.chain_state
17741774
.stakes
1775-
.query_stakes(QueryStakesKey::Validator(pkh));
1775+
.query_stakes(QueryStakesKey::Withdrawer(pkh));
17761776
if let Ok(stakes) = stakes {
17771777
balance.add_staked(stakes.iter().fold(0u64, |staked: u64, entry| {
17781778
staked.saturating_add(entry.value.coins.nanowits())

0 commit comments

Comments
 (0)