1
0

new command: signtx (offline transaction signing)

This commit is contained in:
thomasv
2012-12-05 18:18:47 +01:00
parent c763445734
commit 4e070bda57
3 changed files with 39 additions and 16 deletions

View File

@@ -308,8 +308,7 @@ class ElectrumWindow(QMainWindow):
self.tabs = tabs = QTabWidget(self)
tabs.addTab(self.create_history_tab(), _('History') )
if self.wallet.seed:
tabs.addTab(self.create_send_tab(), _('Send') )
tabs.addTab(self.create_send_tab(), _('Send') )
tabs.addTab(self.create_receive_tab(), _('Receive') )
tabs.addTab(self.create_contacts_tab(), _('Contacts') )
tabs.addTab(self.create_wall_tab(), _('Wall') )
@@ -772,17 +771,23 @@ class ElectrumWindow(QMainWindow):
except BaseException, e:
self.show_message(str(e))
return
h = self.wallet.send_tx(tx)
waiting_dialog(lambda: False if self.wallet.tx_event.isSet() else _("Please wait..."))
status, msg = self.wallet.receive_tx( h )
if status:
QMessageBox.information(self, '', _('Payment sent.')+'\n'+msg, _('OK'))
self.do_clear()
self.update_contacts_tab()
if self.wallet.seed:
h = self.wallet.send_tx(tx)
waiting_dialog(lambda: False if self.wallet.tx_event.isSet() else _("Please wait..."))
status, msg = self.wallet.receive_tx( h )
if status:
QMessageBox.information(self, '', _('Payment sent.')+'\n'+msg, _('OK'))
self.do_clear()
self.update_contacts_tab()
else:
QMessageBox.warning(self, _('Error'), msg, _('OK'))
else:
QMessageBox.warning(self, _('Error'), msg, _('OK'))
filename = 'unsigned_tx'
f = open(filename,'w')
f.write(tx)
f.close()
QMessageBox.information(self, _('Unsigned transaction'), _("Unsigned transaction was saved to file:") + " " +filename, _('OK'))
def set_url(self, url):

View File

@@ -776,10 +776,11 @@ class Wallet:
change_addr = inputs[-1][0]
print_error( "Sending change to", change_addr )
outputs = self.add_tx_change(outputs, amount, fee, total, change_addr)
s_inputs = self.sign_inputs( inputs, outputs, password )
tx = filter( raw_tx( s_inputs, outputs ) )
if not self.seed:
return {'inputs':inputs, 'outputs':outputs}
tx = repr(self.signed_tx(inputs, outputs, password))
for address, x in outputs:
if address not in self.addressbook and not self.is_mine(address):
@@ -791,6 +792,11 @@ class Wallet:
return tx
def signed_tx(self, inputs, outputs, password):
s_inputs = self.sign_inputs( inputs, outputs, password )
tx = filter( raw_tx( s_inputs, outputs ) )
return tx
def sendtx(self, tx):
# synchronous
h = self.send_tx(tx)