From 66e7b8373c74d0611569a41958974a60f88c1dcb Mon Sep 17 00:00:00 2001 From: Ran Mishael <106548467+ranlavanet@users.noreply.github.com> Date: Thu, 17 Oct 2024 17:56:20 +0200 Subject: [PATCH] fix: PRT - fixing total stake amount taking only stake size into consideration (#1746) --- protocol/statetracker/updaters/pairing_updater.go | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/protocol/statetracker/updaters/pairing_updater.go b/protocol/statetracker/updaters/pairing_updater.go index d180f56bbc..5b74d3db26 100644 --- a/protocol/statetracker/updaters/pairing_updater.go +++ b/protocol/statetracker/updaters/pairing_updater.go @@ -248,12 +248,17 @@ func (pu *PairingUpdater) filterPairingListByEndpoint(ctx context.Context, curre pairingEndpoints[idx] = endp } lavasession.SortByGeolocations(pairingEndpoints, currentGeo) + totalStakeAmount := provider.Stake.Amount + if !provider.DelegateTotal.Amount.IsNil() { + totalStakeAmount = totalStakeAmount.Add(provider.DelegateTotal.Amount) + } + totalStakeIncludingDelegation := sdk.Coin{Denom: provider.Stake.Denom, Amount: totalStakeAmount} pairing[uint64(providerIdx)] = lavasession.NewConsumerSessionWithProvider( provider.Address, pairingEndpoints, maxCu, epoch, - provider.Stake, + totalStakeIncludingDelegation, ) } if len(pairing) == 0 {