Browse Source

bugfix + verifymessage

283
thomasv 13 years ago
parent
commit
58d73c66e0
  1. 9
      client/electrum
  2. 14
      client/wallet.py

9
client/electrum

@ -66,15 +66,20 @@ if __name__ == '__main__':
else: else:
params = [] params = []
cmd = 'gui' cmd = 'gui'
amount = '' amount = label = signature = signer = ''
label = ''
for p in params: for p in params:
k,v = p.split('=') k,v = p.split('=')
v = urldecode(v) v = urldecode(v)
if k=='amount': amount = v if k=='amount': amount = v
elif k=='label': label = v elif k=='label': label = v
elif k =='signature': signature = v
elif k =='signer': signer = v
else: print k,v else: print k,v
if signature:
message = p.replace('signer=%s'%signer,'').replace('signature=%s'%signature,'')
wallet.verify_message(signer, signature,message)
gui.set_send_tab(address, amount, label) gui.set_send_tab(address, amount, label)
gui.main() gui.main()

14
client/wallet.py

@ -345,6 +345,10 @@ class Wallet:
return pk return pk
def verify_message(self, signing_address, signature, message):
""" recover public key from signature; """
pass
def create_new_address2(self, for_change): def create_new_address2(self, for_change):
""" Publickey(type,n) = Master_public_key + H(n|S|type)*point """ """ Publickey(type,n) = Master_public_key + H(n|S|type)*point """
@ -631,19 +635,19 @@ class Wallet:
def mktx(self, to_address, amount, label, password, fee=None): def mktx(self, to_address, amount, label, password, fee=None):
if not self.is_valid(to_address): if not self.is_valid(to_address):
raise BaseException("Invalid address") raise BaseException("Invalid address")
inputs, total, fee = wallet.choose_tx_inputs( amount, fee ) inputs, total, fee = self.choose_tx_inputs( amount, fee )
if not inputs: if not inputs:
raise BaseException("Not enough funds") raise BaseException("Not enough funds")
outputs = wallet.choose_tx_outputs( to_address, amount, fee, total ) outputs = self.choose_tx_outputs( to_address, amount, fee, total )
s_inputs = wallet.sign_inputs( inputs, outputs, password ) s_inputs = self.sign_inputs( inputs, outputs, password )
tx = filter( raw_tx( s_inputs, outputs ) ) tx = filter( raw_tx( s_inputs, outputs ) )
if to_address not in self.addressbook: if to_address not in self.addressbook:
self.addressbook.append(to_address) self.addressbook.append(to_address)
if label: if label:
tx_hash = Hash(tx.decode('hex') )[::-1].encode('hex') tx_hash = Hash(tx.decode('hex') )[::-1].encode('hex')
wallet.labels[tx_hash] = label self.labels[tx_hash] = label
wallet.save() self.save()
return tx return tx
def sendtx(self, tx): def sendtx(self, tx):

Loading…
Cancel
Save