chris45 integration test passing

This commit is contained in:
Lex Berezhny 2019-05-04 23:24:41 -04:00
parent a459ee34be
commit 93d2173fad
2 changed files with 10 additions and 3 deletions

View file

@ -172,7 +172,7 @@ class JSONResponseEncoder(JSONEncoder):
'normalized': txo.normalized_name, 'normalized': txo.normalized_name,
'claim_id': txo.claim_id, 'claim_id': txo.claim_id,
'permanent_url': txo.permanent_url, 'permanent_url': txo.permanent_url,
'meta': txo.meta 'meta': self.encode_claim_meta(txo.meta)
}) })
if txo.script.is_claim_name or txo.script.is_update_claim: if txo.script.is_claim_name or txo.script.is_update_claim:
try: try:
@ -186,7 +186,7 @@ class JSONResponseEncoder(JSONEncoder):
'normalized': txo.channel.normalized_name, 'normalized': txo.channel.normalized_name,
'claim_id': txo.channel.claim_id, 'claim_id': txo.channel.claim_id,
'value': txo.channel.claim, 'value': txo.channel.claim,
'meta': txo.channel.meta 'meta': self.encode_claim_meta(txo.channel.meta)
} }
if check_signature and txo.claim.is_signed: if check_signature and txo.claim.is_signed:
output['is_channel_signature_valid'] = False output['is_channel_signature_valid'] = False
@ -196,6 +196,13 @@ class JSONResponseEncoder(JSONEncoder):
pass pass
return output return output
def encode_claim_meta(self, meta):
if isinstance(meta.get('effective_amount'), int):
meta['effective_amount'] = dewies_to_lbc(meta['effective_amount'])
if isinstance(meta.get('trending_amount'), int):
meta['trending_amount'] = dewies_to_lbc(meta['trending_amount'])
return meta
def encode_input(self, txi): def encode_input(self, txi):
return self.encode_output(txi.txo_ref.txo, False) if txi.txo_ref.txo is not None else { return self.encode_output(txi.txo_ref.txo, False) if txi.txo_ref.txo is not None else {
'txid': txi.txo_ref.tx_ref.id, 'txid': txi.txo_ref.tx_ref.id,

View file

@ -64,7 +64,7 @@ class MainNetLedger(BaseLedger):
assert len(urls) == len(txos), "Mismatch between urls requested for resolve and responses received." assert len(urls) == len(txos), "Mismatch between urls requested for resolve and responses received."
result = {} result = {}
for url, txo in zip(urls, txos): for url, txo in zip(urls, txos):
if txo and URL.parse(url).has_channel: if txo and URL.parse(url).has_stream_in_channel:
if not txo.channel or not txo.is_signed_by(txo.channel, self): if not txo.channel or not txo.is_signed_by(txo.channel, self):
txo = None txo = None
if txo: if txo: