Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- diff -aur Electrum-1.9.5-old/lib/transaction.py Electrum-1.9.5/lib/transaction.py
- --- Electrum-1.9.5-old/lib/transaction.py 2013-11-12 11:12:10.000000000 +0000
- +++ Electrum-1.9.5/lib/transaction.py 2013-12-19 13:08:55.255383097 +0000
- @@ -453,7 +453,8 @@
- elif for_sig==i:
- if txin.get('redeemScript'):
- - script = txin['redeemScript'] # p2sh uses the inner script
- + # txin['redeemScript'] the hell it does # p2sh uses the inner script
- + script = txin['redeemScript']
- else:
- script = txin['scriptPubKey'] # scriptsig
- else:
- @@ -466,16 +467,16 @@
- for output in outputs:
- addr, amount = output
- s += int_to_hex( amount, 8) # amount
- - addrtype, hash_160 = bc_address_to_hash_160(addr)
- + addrtype, hash_160_value = bc_address_to_hash_160(addr)
- if addrtype == 0:
- script = '76a9' # op_dup, op_hash_160
- script += '14' # push 0x14 bytes
- - script += hash_160.encode('hex')
- + script += hash_160_value.encode('hex')
- script += '88ac' # op_equalverify, op_checksig
- elif addrtype == 5:
- script = 'a9' # op_hash_160
- script += '14' # push 0x14 bytes
- - script += hash_160.encode('hex')
- + script += hash_160_value.encode('hex')
- script += '87' # op_equal
- else:
- raise
- @@ -526,9 +527,14 @@
- secexp = pkey.secret
- private_key = ecdsa.SigningKey.from_secret_exponent( secexp, curve = SECP256k1 )
- public_key = private_key.get_verifying_key()
- + #print ( "using transaction:" )
- + #print ( tx_for_sig );
- + #print ( "now hashing" )
- + #print Hash( tx_for_sig.decode('hex') )[::-1].encode( 'hex' )
- + #print private_key.to_string().encode( 'hex' )
- sig = private_key.sign_digest_deterministic( Hash( tx_for_sig.decode('hex') ), hashfunc=hashlib.sha256, sigencode = ecdsa.util.sigencode_der )
- assert public_key.verify_digest( sig, Hash( tx_for_sig.decode('hex') ), sigdecode = ecdsa.util.sigdecode_der)
- - signatures.append( sig.encode('hex') )
- + signatures.insert( 0, sig.encode('hex') )
- print_error("adding signature for", pubkey)
- txin["signatures"] = signatures
- @@ -721,9 +727,12 @@
- def add_input_info(self, input_info):
- for i, txin in enumerate(self.inputs):
- item = input_info[i]
- - txin['address'] = item['address']
- - txin['signatures'] = item['signatures']
- + txin['address'] = item.get('address')
- + if( 'signatures' in item ) :
- + txin['signatures'] = item.get['signatures']
- txin['scriptPubKey'] = item['scriptPubKey']
- - txin['redeemScript'] = item.get('redeemScript')
- + if 'redeemScript' in item :
- + txin['redeemScript'] = item['redeemScript']
- + txin['address'] = hash_160_to_bc_address(hash_160(item['redeemScript']) )
- txin['redeemPubkey'] = item.get('redeemPubkey')
- txin['KeyID'] = item.get('KeyID')
- diff -aur Electrum-1.9.5-old/lib/wallet.py Electrum-1.9.5/lib/wallet.py
- --- Electrum-1.9.5-old/lib/wallet.py 2013-11-22 16:49:54.000000000 +0000
- +++ Electrum-1.9.5/lib/wallet.py 2013-12-19 04:05:11.584964217 +0000
- @@ -711,21 +711,25 @@
- if address in self.imported_keys.keys():
- out.append( pw_decode( self.imported_keys[address], password ) )
- else:
- - account, sequence = self.get_address_index(address)
- - if account == 0:
- - pk = self.accounts[account].get_private_key(seed, sequence)
- - out.append(pk)
- - return out
- -
- - # assert address == self.accounts[account].get_address(*sequence)
- - rs = self.rebase_sequence( account, sequence)
- - for root, public_sequence in rs:
- -
- - if root not in self.master_private_keys.keys(): continue
- - master_k = self.get_master_private_key(root, password)
- - master_c, _, _ = self.master_public_keys[root]
- - pk = bip32_private_key( public_sequence, master_k.decode('hex'), master_c.decode('hex'))
- - out.append(pk)
- + try :
- + account, sequence = self.get_address_index(address)
- + if account == 0:
- + pk = self.accounts[account].get_private_key(seed, sequence)
- + out.append(pk)
- + return out
- +
- + # assert address == self.accounts[account].get_address(*sequence)
- + rs = self.rebase_sequence( account, sequence)
- + for root, public_sequence in rs:
- +
- + if root not in self.master_private_keys.keys(): continue
- + master_k = self.get_master_private_key(root, password)
- + master_c, _, _ = self.master_public_keys[root]
- + pk = bip32_private_key( public_sequence, master_k.decode('hex'), master_c.decode('hex'))
- + out.append(pk)
- + except:
- + #ignore all errors in here
- + return []
- return out
- @@ -740,6 +744,8 @@
- if address in self.imported_keys.keys():
- txin['redeemPubkey'] = pubkey
- +
- +
- def add_keypairs_from_KeyID(self, tx, keypairs, password):
- for txin in tx.inputs:
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement