fix offline signing with key>5
This commit is contained in:
parent
8858ac249e
commit
1004fbd8f8
|
@ -742,24 +742,26 @@ class Wallet:
|
||||||
|
|
||||||
|
|
||||||
def add_keypairs_from_KeyID(self, tx, keypairs, password):
|
def add_keypairs_from_KeyID(self, tx, keypairs, password):
|
||||||
|
# first check the provided password
|
||||||
|
seed = self.get_seed(password)
|
||||||
|
|
||||||
for txin in tx.inputs:
|
for txin in tx.inputs:
|
||||||
keyid = txin.get('KeyID')
|
keyid = txin.get('KeyID')
|
||||||
if keyid:
|
if keyid:
|
||||||
|
|
||||||
if self.seed_version==4:
|
if self.seed_version == 4:
|
||||||
m = re.match("old\(([0-9a-f]+),(\d+),(\d+)", keyid)
|
m = re.match("old\(([0-9a-f]+),(\d+),(\d+)", keyid)
|
||||||
if not m: continue
|
if not m: continue
|
||||||
mpk = m.group(1)
|
mpk = m.group(1)
|
||||||
if mpk != self.storage.get('master_public_key'): continue
|
if mpk != self.storage.get('master_public_key'): continue
|
||||||
index = int(m.group(2))
|
for_change = int(m.group(2))
|
||||||
num = int(m.group(3))
|
num = int(m.group(3))
|
||||||
account = self.accounts[0]
|
account = self.accounts[0]
|
||||||
addr = account.get_address(index, num)
|
addr = account.get_address(for_change, num)
|
||||||
txin['address'] = addr # fixme: side effect
|
txin['address'] = addr # fixme: side effect
|
||||||
pk = self.get_private_key(addr, password)
|
pk = account.get_private_key(seed, (for_change, num))
|
||||||
for sec in pk:
|
pubkey = public_key_from_private_key(pk)
|
||||||
pubkey = public_key_from_private_key(sec)
|
keypairs[pubkey] = pk
|
||||||
keypairs[pubkey] = sec
|
|
||||||
continue
|
continue
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue