claim_id is hexlified before saving to sqlite

This commit is contained in:
Lex Berezhny 2018-07-15 00:41:49 -04:00 committed by Jack Robison
parent 0f90dee224
commit a1b4c9acd6
No known key found for this signature in database
GPG key ID: DF25C68FE0239BB2

View file

@ -1,4 +1,5 @@
import sqlite3 import sqlite3
from binascii import hexlify
from twisted.internet import defer from twisted.internet import defer
from torba.basedatabase import BaseDatabase from torba.basedatabase import BaseDatabase
from .certificate import Certificate from .certificate import Certificate
@ -41,9 +42,9 @@ class WalletDatabase(BaseDatabase):
if txo.script.is_claim_involved: if txo.script.is_claim_involved:
row['claim_name'] = txo.script.values['claim_name'] row['claim_name'] = txo.script.values['claim_name']
if txo.script.is_update_claim or txo.script.is_support_claim: if txo.script.is_update_claim or txo.script.is_support_claim:
row['claim_id'] = txo.script.values['claim_id'] row['claim_id'] = hexlify(txo.script.values['claim_id'][::-1])
elif txo.script.is_claim_name: elif txo.script.is_claim_name:
row['claim_id'] = tx.get_claim_id(txo.position) row['claim_id'] = hexlify(tx.get_claim_id(txo.position)[::-1])
return row return row
@defer.inlineCallbacks @defer.inlineCallbacks