@ -332,14 +332,19 @@ class BTC_Timelocked_P2WSH(BTCEngine):
return btc . bin_to_b58check ( priv , cls . WIF_PREFIX )
@classmethod
def sign_transaction ( cls , tx , index , privkey , amount ,
def sign_transaction ( cls , tx , index , privkey_locktime , amount ,
hashcode = btc . SIGHASH_ALL , * * kwargs ) :
raise Exception ( " not implemented yet " )
assert amount is not None
@classmethod
def sign_transaction ( cls , tx , index , privkey , amount ,
hashcode = btc . SIGHASH_ALL , * * kwargs ) :
raise RuntimeError ( " Cannot spend from watch-only wallets " )
privkey , locktime = privkey_locktime
privkey = hexlify ( privkey ) . decode ( )
pubkey = btc . privkey_to_pubkey ( privkey )
pubkey = unhexlify ( pubkey )
redeem_script = cls . pubkey_to_script_code ( ( pubkey , locktime ) )
tx = btc . serialize ( tx )
sig = btc . get_p2sh_signature ( tx , index , redeem_script , privkey ,
amount )
return btc . apply_freeze_signature ( tx , index , redeem_script , sig )
class BTC_Watchonly_Timelocked_P2WSH ( BTC_Timelocked_P2WSH ) :
@ -368,7 +373,7 @@ class BTC_Watchonly_Timelocked_P2WSH(BTC_Timelocked_P2WSH):
@classmethod
def sign_transaction ( cls , tx , index , privkey , amount ,
hashcode = btc . SIGHASH_ALL , * * kwargs ) :
raise Exception ( " not implemented yet " )
raise RuntimeError ( " Cannot spend from watch-only wallets " )
class BTC_Watchonly_P2SH_P2WPKH ( BTC_P2SH_P2WPKH ) :
@ -392,6 +397,11 @@ class BTC_Watchonly_P2SH_P2WPKH(BTC_P2SH_P2WPKH):
return super ( BTC_Watchonly_P2SH_P2WPKH , cls ) . derive_bip32_pub_export (
master_key , BTC_Watchonly_Timelocked_P2WSH . get_watchonly_path ( path ) )
@classmethod
def sign_transaction ( cls , tx , index , privkey , amount ,
hashcode = btc . SIGHASH_ALL , * * kwargs ) :
raise RuntimeError ( " Cannot spend from watch-only wallets " )
ENGINES = {
TYPE_P2PKH : BTC_P2PKH ,
TYPE_P2SH_P2WPKH : BTC_P2SH_P2WPKH ,