fix fee amount overflow in es
This commit is contained in:
parent
fd7bfbea78
commit
b856e2120a
1 changed files with 7 additions and 5 deletions
|
@ -469,7 +469,12 @@ class LevelDB:
|
||||||
metadata = self.get_claim_metadata(claim.tx_hash, claim.position)
|
metadata = self.get_claim_metadata(claim.tx_hash, claim.position)
|
||||||
if not metadata:
|
if not metadata:
|
||||||
return
|
return
|
||||||
|
if not metadata.is_stream or not metadata.stream.has_fee:
|
||||||
|
fee_amount = None
|
||||||
|
else:
|
||||||
|
fee_amount = int(max(metadata.stream.fee.amount or 0, 0) * 1000)
|
||||||
|
if fee_amount >= 9223372036854775807:
|
||||||
|
return
|
||||||
reposted_claim_hash = None if not metadata.is_repost else metadata.repost.reference.claim_hash[::-1]
|
reposted_claim_hash = None if not metadata.is_repost else metadata.repost.reference.claim_hash[::-1]
|
||||||
reposted_claim = None
|
reposted_claim = None
|
||||||
reposted_metadata = None
|
reposted_metadata = None
|
||||||
|
@ -529,7 +534,6 @@ class LevelDB:
|
||||||
channel = self.get_claim_txo(metadata.signing_channel_hash[::-1])
|
channel = self.get_claim_txo(metadata.signing_channel_hash[::-1])
|
||||||
if channel:
|
if channel:
|
||||||
canonical_url = f'{channel.name}#{metadata.signing_channel_hash[::-1].hex()}/{canonical_url}'
|
canonical_url = f'{channel.name}#{metadata.signing_channel_hash[::-1].hex()}/{canonical_url}'
|
||||||
|
|
||||||
value = {
|
value = {
|
||||||
'claim_hash': claim_hash[::-1],
|
'claim_hash': claim_hash[::-1],
|
||||||
# 'claim_id': claim_hash.hex(),
|
# 'claim_id': claim_hash.hex(),
|
||||||
|
@ -561,9 +565,7 @@ class LevelDB:
|
||||||
'stream_type': None if not metadata.is_stream else STREAM_TYPES[
|
'stream_type': None if not metadata.is_stream else STREAM_TYPES[
|
||||||
guess_stream_type(metadata.stream.source.media_type)],
|
guess_stream_type(metadata.stream.source.media_type)],
|
||||||
'media_type': None if not metadata.is_stream else metadata.stream.source.media_type,
|
'media_type': None if not metadata.is_stream else metadata.stream.source.media_type,
|
||||||
'fee_amount': None if not metadata.is_stream or not metadata.stream.has_fee else int(
|
'fee_amount': fee_amount,
|
||||||
max(metadata.stream.fee.amount or 0, 0) * 1000
|
|
||||||
),
|
|
||||||
'fee_currency': None if not metadata.is_stream else metadata.stream.fee.currency,
|
'fee_currency': None if not metadata.is_stream else metadata.stream.fee.currency,
|
||||||
|
|
||||||
'reposted': self.get_reposted_count(claim_hash),
|
'reposted': self.get_reposted_count(claim_hash),
|
||||||
|
|
Loading…
Reference in a new issue