mirror of
https://github.com/LBRYFoundation/LBRY-Vault.git
synced 2025-09-03 12:30:07 +00:00
Fix p2wpkh-p2sh support per issue #4729
This commit is contained in:
parent
1526fd3722
commit
14b4955a6f
1 changed files with 11 additions and 7 deletions
|
@ -423,13 +423,10 @@ class Coldcard_KeyStore(Hardware_KeyStore):
|
|||
|
||||
for txin in inputs:
|
||||
if txin['type'] == 'coinbase':
|
||||
self.give_error("Coinbase not supported") # but why not?
|
||||
self.give_error("Coinbase not supported")
|
||||
|
||||
if txin['type'] in ['p2sh']:
|
||||
self.give_error('Not ready for multisig transactions yet')
|
||||
|
||||
#if txin['type'] in ['p2wpkh-p2sh', 'p2wsh-p2sh']:
|
||||
#if txin['type'] in ['p2wpkh', 'p2wsh']:
|
||||
if txin['type'] in ['p2sh', 'p2wsh-p2sh', 'p2wsh']:
|
||||
self.give_error('No support yet for inputs of type: ' + txin['type'])
|
||||
|
||||
# Construct PSBT from start to finish.
|
||||
out_fd = io.BytesIO()
|
||||
|
@ -452,6 +449,7 @@ class Coldcard_KeyStore(Hardware_KeyStore):
|
|||
@classmethod
|
||||
def input_script(cls, txin, estimate_size=False):
|
||||
return ''
|
||||
|
||||
unsigned = bfh(CustomTXSerialization(tx.serialize()).serialize_to_network(witness=False))
|
||||
write_kv(PSBT_GLOBAL_UNSIGNED_TX, unsigned)
|
||||
|
||||
|
@ -471,6 +469,12 @@ class Coldcard_KeyStore(Hardware_KeyStore):
|
|||
for k in pubkeys:
|
||||
write_kv(PSBT_IN_BIP32_DERIVATION, subkeys[k], k)
|
||||
|
||||
if txin['type'] == 'p2wpkh-p2sh':
|
||||
assert len(pubkeys) == 1, 'can be only one redeem script per input'
|
||||
pa = hash_160(k)
|
||||
assert len(pa) == 20
|
||||
write_kv(PSBT_IN_REDEEM_SCRIPT, b'\x00\x14'+pa)
|
||||
|
||||
out_fd.write(b'\x00')
|
||||
|
||||
# outputs section
|
||||
|
@ -595,7 +599,7 @@ class ColdcardPlugin(HW_PluginBase):
|
|||
]
|
||||
|
||||
#SUPPORTED_XTYPES = ('standard', 'p2wpkh-p2sh', 'p2wpkh', 'p2wsh-p2sh', 'p2wsh')
|
||||
SUPPORTED_XTYPES = ('standard', 'p2wpkh')
|
||||
SUPPORTED_XTYPES = ('standard', 'p2wpkh', 'p2wpkh-p2sh')
|
||||
|
||||
def __init__(self, parent, config, name):
|
||||
HW_PluginBase.__init__(self, parent, config, name)
|
||||
|
|
Loading…
Add table
Reference in a new issue