dont validate inputs in json_response_encoder

This commit is contained in:
Lex Berezhny 2019-03-24 17:44:46 -04:00
parent d47575e8e0
commit c1fbb02bfe

View file

@ -49,7 +49,7 @@ class JSONResponseEncoder(JSONEncoder):
'hex': hexlify(tx.raw).decode(), 'hex': hexlify(tx.raw).decode(),
} }
def encode_output(self, txo): def encode_output(self, txo, check_signature=True):
tx_height = txo.tx_ref.height tx_height = txo.tx_ref.height
best_height = self.ledger.headers.height best_height = self.ledger.headers.height
output = { output = {
@ -77,7 +77,7 @@ class JSONResponseEncoder(JSONEncoder):
output['value'] = claim output['value'] = claim
if claim.is_signed: if claim.is_signed:
output['valid_signature'] = None output['valid_signature'] = None
if txo.channel is not None: if check_signature and txo.channel is not None:
output['channel_name'] = txo.channel.claim_name output['channel_name'] = txo.channel.claim_name
try: try:
output['valid_signature'] = txo.is_signed_by(txo.channel, self.ledger) output['valid_signature'] = txo.is_signed_by(txo.channel, self.ledger)
@ -102,7 +102,7 @@ class JSONResponseEncoder(JSONEncoder):
return output return output
def encode_input(self, txi): def encode_input(self, txi):
return self.encode_output(txi.txo_ref.txo) 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,
'nout': txi.txo_ref.position 'nout': txi.txo_ref.position
} }