feedback
This commit is contained in:
parent
911f483ce3
commit
9b3618f73e
3 changed files with 10 additions and 10 deletions
10
hub/db/db.py
10
hub/db/db.py
|
@ -499,9 +499,9 @@ class SecondaryDB:
|
||||||
if not v:
|
if not v:
|
||||||
amount = 0
|
amount = 0
|
||||||
elif txo_type is ACTIVATED_SUPPORT_TXO_TYPE:
|
elif txo_type is ACTIVATED_SUPPORT_TXO_TYPE:
|
||||||
amount = v.support_sum
|
amount = v.activated_support_sum
|
||||||
else:
|
else:
|
||||||
amount = v.effective_amount - v.support_sum
|
amount = v.activated_sum - v.activated_support_sum
|
||||||
if height == self.db_height + 1:
|
if height == self.db_height + 1:
|
||||||
return amount
|
return amount
|
||||||
return amount + sum(
|
return amount + sum(
|
||||||
|
@ -521,7 +521,7 @@ class SecondaryDB:
|
||||||
v = self.prefix_db.effective_amount.get(claim_hash)
|
v = self.prefix_db.effective_amount.get(claim_hash)
|
||||||
if not v:
|
if not v:
|
||||||
return 0
|
return 0
|
||||||
return v.effective_amount - v.support_sum
|
return v.activated_sum - v.activated_support_sum
|
||||||
for v in self.prefix_db.active_amount.iterate(
|
for v in self.prefix_db.active_amount.iterate(
|
||||||
start=(claim_hash, ACTIVATED_CLAIM_TXO_TYPE, 0), stop=(claim_hash, ACTIVATED_CLAIM_TXO_TYPE, height),
|
start=(claim_hash, ACTIVATED_CLAIM_TXO_TYPE, 0), stop=(claim_hash, ACTIVATED_CLAIM_TXO_TYPE, height),
|
||||||
include_key=False, reverse=True):
|
include_key=False, reverse=True):
|
||||||
|
@ -531,7 +531,7 @@ class SecondaryDB:
|
||||||
def get_effective_amount(self, claim_hash: bytes) -> int:
|
def get_effective_amount(self, claim_hash: bytes) -> int:
|
||||||
v = self.prefix_db.effective_amount.get(claim_hash)
|
v = self.prefix_db.effective_amount.get(claim_hash)
|
||||||
if v:
|
if v:
|
||||||
return v.effective_amount
|
return v.activated_sum
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
def get_url_effective_amount(self, name: str, claim_hash: bytes) -> Optional['BidOrderKey']:
|
def get_url_effective_amount(self, name: str, claim_hash: bytes) -> Optional['BidOrderKey']:
|
||||||
|
@ -665,7 +665,7 @@ class SecondaryDB:
|
||||||
|
|
||||||
# collect all of the effective amounts
|
# collect all of the effective amounts
|
||||||
effective_amounts = {
|
effective_amounts = {
|
||||||
claim_hash: 0 if not v else v.effective_amount
|
claim_hash: 0 if not v else v.activated_sum
|
||||||
async for (claim_hash, ), v in self.prefix_db.effective_amount.multi_get_async_gen(
|
async for (claim_hash, ), v in self.prefix_db.effective_amount.multi_get_async_gen(
|
||||||
self._executor, [(claim_hash,) for claim_hash in claims]
|
self._executor, [(claim_hash,) for claim_hash in claims]
|
||||||
)
|
)
|
||||||
|
|
|
@ -1775,8 +1775,8 @@ class EffectiveAmountKey(NamedTuple):
|
||||||
|
|
||||||
|
|
||||||
class EffectiveAmountValue(NamedTuple):
|
class EffectiveAmountValue(NamedTuple):
|
||||||
effective_amount: int
|
activated_sum: int
|
||||||
support_sum: int
|
activated_support_sum: int
|
||||||
|
|
||||||
|
|
||||||
class EffectiveAmountPrefixRow(PrefixRow):
|
class EffectiveAmountPrefixRow(PrefixRow):
|
||||||
|
|
|
@ -1305,15 +1305,15 @@ class BlockchainProcessorService(BlockchainService):
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
current_effective_amounts = {
|
current_effective_amounts = {
|
||||||
claim_hash: 0 if not v else v.effective_amount
|
claim_hash: 0 if not v else v.activated_sum
|
||||||
for claim_hash, v in current_effective_amount_values.items()
|
for claim_hash, v in current_effective_amount_values.items()
|
||||||
}
|
}
|
||||||
current_supports_amount = {
|
current_supports_amount = {
|
||||||
claim_hash: 0 if not v else v.support_sum
|
claim_hash: 0 if not v else v.activated_support_sum
|
||||||
for claim_hash, v in current_effective_amount_values.items()
|
for claim_hash, v in current_effective_amount_values.items()
|
||||||
}
|
}
|
||||||
delete_effective_amounts = [
|
delete_effective_amounts = [
|
||||||
self.db.prefix_db.effective_amount.pack_item(claim_hash, v.effective_amount, v.support_sum)
|
self.db.prefix_db.effective_amount.pack_item(claim_hash, v.activated_sum, v.activated_support_sum)
|
||||||
for claim_hash, v in current_effective_amount_values.items() if v is not None
|
for claim_hash, v in current_effective_amount_values.items() if v is not None
|
||||||
]
|
]
|
||||||
claims = set(self.effective_amount_delta.keys()).union(self.active_support_amount_delta.keys())
|
claims = set(self.effective_amount_delta.keys()).union(self.active_support_amount_delta.keys())
|
||||||
|
|
Loading…
Reference in a new issue