Skip to content

Commit

Permalink
Support for "op_return" parameters in bitcoincash: style URI's on Qt … (
Browse files Browse the repository at this point in the history
#952)

* Support for "op_return" parameters in bitcoincash: style URI's on Qt client

* If OP_RETURN is present, send OP_RETURN regardless of whether 'enable_opreturn' is enabled in config
On do_clear method, hide OP_RETURN field/label if 'enable_opreturn' is not enabled

* Hide OP_RETURN when pasting new address - if 'enable_opreturn' config param is disabled
  • Loading branch information
jimtendo authored and cculianu committed Nov 19, 2018
1 parent 7b66ca7 commit 530b84e
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions gui/qt/main_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ def read_send_tab(self):

try:
# handle op_return if specified and enabled
opreturn_message = self.message_opreturn_e.text() if self.config.get('enable_opreturn') else None
opreturn_message = self.message_opreturn_e.text()
if opreturn_message:
outputs.append(self.output_for_opreturn_stringdata(opreturn_message))
except OPReturnTooLarge as e:
Expand Down Expand Up @@ -1698,6 +1698,7 @@ def pay_to_URI(self, URI):
amount = out.get('amount')
label = out.get('label')
message = out.get('message')
op_return = out.get('op_return')
# use label as description (not BIP21 compliant)
if label and not message:
message = label
Expand All @@ -1708,7 +1709,14 @@ def pay_to_URI(self, URI):
if amount:
self.amount_e.setAmount(amount)
self.amount_e.textEdited.emit("")

if op_return:
self.message_opreturn_e.setText(op_return)
self.message_opreturn_e.setHidden(False)
self.opreturn_label.setHidden(False)
elif not self.config.get('enable_opreturn'):
self.message_opreturn_e.setText('')
self.message_opreturn_e.setHidden(True)
self.opreturn_label.setHidden(True)

def do_clear(self):
self.is_max = False
Expand All @@ -1722,6 +1730,8 @@ def do_clear(self):
self.max_button.setDisabled(False)
self.set_pay_from([])
self.tx_external_keypairs = {}
self.message_opreturn_e.setVisible(self.config.get('enable_opreturn'))
self.opreturn_label.setVisible(self.config.get('enable_opreturn'))
self.update_status()
run_hook('do_clear', self)

Expand Down

0 comments on commit 530b84e

Please sign in to comment.