x
This commit is contained in:
parent
8b59223e32
commit
771eeb7563
1 changed files with 16 additions and 10 deletions
|
@ -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):
|
||||||
claim_record['fee_amount'] = int(fee.amount*1000)
|
if fee.amount >= 0 and int(fee.amount*1000) < 9223372036854775807:
|
||||||
|
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,15 +461,19 @@ 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:
|
||||||
self.executemany("""
|
try:
|
||||||
UPDATE claim SET
|
self.executemany("""
|
||||||
txo_hash=:txo_hash, tx_position=:tx_position, amount=:amount, height=:height,
|
UPDATE claim SET
|
||||||
claim_type=:claim_type, media_type=:media_type, stream_type=:stream_type,
|
txo_hash=:txo_hash, tx_position=:tx_position, amount=:amount, height=:height,
|
||||||
timestamp=:timestamp, fee_amount=:fee_amount, fee_currency=:fee_currency, has_source=:has_source,
|
claim_type=:claim_type, media_type=:media_type, stream_type=:stream_type,
|
||||||
title=:title, duration=:duration, description=:description, author=:author, reposted_claim_hash=:reposted_claim_hash,
|
timestamp=:timestamp, fee_amount=:fee_amount, fee_currency=:fee_currency, has_source=:has_source,
|
||||||
release_time=CASE WHEN :release_time IS NOT NULL THEN :release_time ELSE release_time END
|
title=:title, duration=:duration, description=:description, author=:author, reposted_claim_hash=:reposted_claim_hash,
|
||||||
WHERE claim_hash=:claim_hash;
|
release_time=CASE WHEN :release_time IS NOT NULL THEN :release_time ELSE release_time END
|
||||||
""", claims)
|
WHERE claim_hash=:claim_hash;
|
||||||
|
""", 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. """
|
||||||
|
|
Loading…
Add table
Reference in a new issue