forked from LBRYCommunity/lbry-sdk
simplify save from resolve, deduplicate items
This commit is contained in:
parent
76dea9e89b
commit
665dba62c7
1 changed files with 6 additions and 7 deletions
|
@ -638,17 +638,16 @@ class SQLiteStorage(SQLiteMixin):
|
||||||
await self.save_supports(claim_id_to_supports)
|
await self.save_supports(claim_id_to_supports)
|
||||||
|
|
||||||
def save_claims_for_resolve(self, claim_infos):
|
def save_claims_for_resolve(self, claim_infos):
|
||||||
to_save = []
|
to_save = {}
|
||||||
for info in claim_infos:
|
for info in claim_infos:
|
||||||
if 'value' in info:
|
if 'value' in info:
|
||||||
if info['value']:
|
if info['value']:
|
||||||
to_save.append(info)
|
to_save[info['claim_id']] = info
|
||||||
else:
|
else:
|
||||||
if 'certificate' in info and info['certificate']['value']:
|
for key in ('certificate', 'claim'):
|
||||||
to_save.append(info['certificate'])
|
if info.get(key, {}).get('value'):
|
||||||
if 'claim' in info and info['claim']['value']:
|
to_save[info[key]['claim_id']] = info[key]
|
||||||
to_save.append(info['claim'])
|
return self.save_claims(to_save.values())
|
||||||
return self.save_claims(to_save)
|
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _save_content_claim(transaction, claim_outpoint, stream_hash):
|
def _save_content_claim(transaction, claim_outpoint, stream_hash):
|
||||||
|
|
Loading…
Reference in a new issue