forked from LBRYCommunity/lbry-sdk
several minor wallet server fixes
This commit is contained in:
parent
b2b3509b61
commit
baed974be0
3 changed files with 6 additions and 5 deletions
|
@ -193,7 +193,7 @@ class JSONResponseEncoder(JSONEncoder):
|
||||||
|
|
||||||
def encode_claim_meta(self, meta):
|
def encode_claim_meta(self, meta):
|
||||||
for key, value in meta.items():
|
for key, value in meta.items():
|
||||||
if key.endswith('_amount') or key.startswith('trending_'):
|
if key.endswith('_amount'):
|
||||||
if isinstance(value, int):
|
if isinstance(value, int):
|
||||||
meta[key] = dewies_to_lbc(value)
|
meta[key] = dewies_to_lbc(value)
|
||||||
return meta
|
return meta
|
||||||
|
|
|
@ -15,8 +15,10 @@ def from_old_json_schema(claim, payload: bytes):
|
||||||
raise DecodeError('Could not parse JSON.')
|
raise DecodeError('Could not parse JSON.')
|
||||||
stream = claim.stream
|
stream = claim.stream
|
||||||
stream.source.sd_hash = value['sources']['lbry_sd_hash']
|
stream.source.sd_hash = value['sources']['lbry_sd_hash']
|
||||||
stream.source.media_type = value.get(
|
stream.source.media_type = (
|
||||||
'content_type', value.get('content-type', 'application/octet-stream'))
|
value.get('content_type', value.get('content-type')) or
|
||||||
|
'application/octet-stream'
|
||||||
|
)
|
||||||
stream.title = value.get('title', '')
|
stream.title = value.get('title', '')
|
||||||
stream.description = value.get('description', '')
|
stream.description = value.get('description', '')
|
||||||
if value.get('thumbnail', ''):
|
if value.get('thumbnail', ''):
|
||||||
|
|
|
@ -488,10 +488,9 @@ class SQLDB:
|
||||||
postfix, value = ops[value[0]], int(value[1:])
|
postfix, value = ops[value[0]], int(value[1:])
|
||||||
constraints[f'claim.{constraint}{postfix}'] = value
|
constraints[f'claim.{constraint}{postfix}'] = value
|
||||||
|
|
||||||
if 'is_controlling' in constraints:
|
if constraints.pop('is_controlling', False):
|
||||||
if {'sequence', 'amount_order'}.isdisjoint(constraints):
|
if {'sequence', 'amount_order'}.isdisjoint(constraints):
|
||||||
constraints['claimtrie.claim_hash__is_not_null'] = ''
|
constraints['claimtrie.claim_hash__is_not_null'] = ''
|
||||||
del constraints['is_controlling']
|
|
||||||
if 'sequence' in constraints:
|
if 'sequence' in constraints:
|
||||||
constraints['order_by'] = 'claim.activation_height ASC'
|
constraints['order_by'] = 'claim.activation_height ASC'
|
||||||
constraints['offset'] = int(constraints.pop('sequence')) - 1
|
constraints['offset'] = int(constraints.pop('sequence')) - 1
|
||||||
|
|
Loading…
Reference in a new issue