This commit is contained in:
Jack Robison 2021-05-04 22:40:06 -04:00
parent 8b59223e32
commit 771eeb7563
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -406,7 +406,9 @@ class SQLDB:
if isinstance(fee.currency, str): if isinstance(fee.currency, str):
claim_record['fee_currency'] = fee.currency.lower() claim_record['fee_currency'] = fee.currency.lower()
if isinstance(fee.amount, Decimal): if isinstance(fee.amount, Decimal):
if fee.amount >= 0 and int(fee.amount*1000) < 9223372036854775807:
claim_record['fee_amount'] = int(fee.amount*1000) claim_record['fee_amount'] = int(fee.amount*1000)
elif claim.is_repost: elif claim.is_repost:
claim_record['claim_type'] = CLAIM_TYPES['repost'] claim_record['claim_type'] = CLAIM_TYPES['repost']
claim_record['reposted_claim_hash'] = claim.repost.reference.claim_hash claim_record['reposted_claim_hash'] = claim.repost.reference.claim_hash
@ -459,6 +461,7 @@ class SQLDB:
def update_claims(self, txos: List[Output], header): def update_claims(self, txos: List[Output], header):
claims = self._upsertable_claims(txos, header, clear_first=True) claims = self._upsertable_claims(txos, header, clear_first=True)
if claims: if claims:
try:
self.executemany(""" self.executemany("""
UPDATE claim SET UPDATE claim SET
txo_hash=:txo_hash, tx_position=:tx_position, amount=:amount, height=:height, txo_hash=:txo_hash, tx_position=:tx_position, amount=:amount, height=:height,
@ -468,6 +471,9 @@ class SQLDB:
release_time=CASE WHEN :release_time IS NOT NULL THEN :release_time ELSE release_time END release_time=CASE WHEN :release_time IS NOT NULL THEN :release_time ELSE release_time END
WHERE claim_hash=:claim_hash; WHERE claim_hash=:claim_hash;
""", claims) """, claims)
except:
self.logger.exception("boom %s", claims)
raise
def delete_claims(self, claim_hashes: Set[bytes]): def delete_claims(self, claim_hashes: Set[bytes]):
""" Deletes claim supports and from claimtrie in case of an abandon. """ """ Deletes claim supports and from claimtrie in case of an abandon. """