faster active amount as of height
This commit is contained in:
parent
f2f0f426aa
commit
97a0d00bfd
1 changed files with 7 additions and 2 deletions
|
@ -524,11 +524,16 @@ class SecondaryDB:
|
||||||
if not v:
|
if not v:
|
||||||
return 0
|
return 0
|
||||||
return v.activated_sum - v.activated_support_sum
|
return v.activated_sum - v.activated_support_sum
|
||||||
|
amount = 0
|
||||||
|
v = self.prefix_db.effective_amount.get(claim_hash)
|
||||||
|
if v:
|
||||||
|
amount = 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, self.db_height + 1),
|
||||||
|
stop=(claim_hash, ACTIVATED_CLAIM_TXO_TYPE, height),
|
||||||
include_key=False, reverse=True):
|
include_key=False, reverse=True):
|
||||||
return v.amount
|
return v.amount
|
||||||
return 0
|
return amount
|
||||||
|
|
||||||
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)
|
||||||
|
|
Loading…
Reference in a new issue