detect txintype in keystore. fix #2912
This commit is contained in:
@@ -180,6 +180,9 @@ class Imported_KeyStore(Software_KeyStore):
|
||||
c = pw_encode(b, new_password)
|
||||
self.keypairs[k] = c
|
||||
|
||||
def txin_type(self):
|
||||
return 'standard'
|
||||
|
||||
|
||||
class Deterministic_KeyStore(Software_KeyStore):
|
||||
|
||||
@@ -274,6 +277,17 @@ class Xpub:
|
||||
return
|
||||
return derivation
|
||||
|
||||
def txin_type(self):
|
||||
xtype = deserialize_xpub(self.xpub)[0]
|
||||
if xtype == 'standard':
|
||||
return 'p2pkh'
|
||||
elif xtype == 'segwit':
|
||||
return 'p2wpkh'
|
||||
elif xtype == 'segwit_p2sh':
|
||||
return 'p2wpkh-p2sh'
|
||||
else:
|
||||
raise BaseException('unknown txin_type', xtype)
|
||||
|
||||
|
||||
class BIP32_KeyStore(Deterministic_KeyStore, Xpub):
|
||||
|
||||
@@ -477,6 +491,9 @@ class Old_KeyStore(Deterministic_KeyStore):
|
||||
decoded = pw_decode(self.seed, old_password)
|
||||
self.seed = pw_encode(decoded, new_password)
|
||||
|
||||
def txin_type(self):
|
||||
return 'standard'
|
||||
|
||||
|
||||
class Hardware_KeyStore(KeyStore, Xpub):
|
||||
# Derived classes must set:
|
||||
|
||||
Reference in New Issue
Block a user