ledger/btc.py
def _signable(
        key: bytes,
        prevout_info: PrevoutInfo) -> bool:
    '''
    Determines if the key or its hash is in the PrevoutInfo
    We use this to determine whether we should get a signature for an input

    Args:
        key                (bytes): the public key
        prevout_info (PrevoutInfo): dict of script and value for the prevout
    Returns:
        (bool): True if signable, false otherwise
    '''
    if len(key) in [64, 65]:
        key = utils.compress_pubkey(key)  # enforce compression

    # if there's no script, it's not signable
    if prevout_info['witness_script'] is None:
        return False

    # if the key is anywhere in the script, it is signable
    script = cast(bytes, prevout_info['witness_script'])
    if (key in script or rutils.hash160(key) in script):
        return True

    return False

    Determines if the key or its hash is in the PrevoutInfo
    We use this to determine whether we should get a signature for an input

    Args:
        key                (bytes): the public key
        prevout_info (PrevoutInfo): dict of script and value for the prevout
    Returns:
        (bool): True if signable, false otherwise
    
Determines if the key or its hash is in the PrevoutInfo
We use this to determine whether we should get a signature for an input
Determines if the key or its hash is in the PrevoutInfo We use this to determine whether we should get a signature for an input
def _signable(
        key: bytes,
        prevout_info: PrevoutInfo) -> bool:
    if len(key) in [64, 65]:
        key = utils.compress_pubkey(key)  
    if prevout_info['witness_script'] is None:
        return False
    script = cast(bytes, prevout_info['witness_script'])
    if (key in script or rutils.hash160(key) in script):
        return True
    return False
def _signable ( key : bytes , prevout_info : PrevoutInfo ) -> bool : if len ( key ) in [ 64 , 65 ] : key = utils . compress_pubkey ( key ) if prevout_info [ 'witness_script' ] is None : return False script = cast ( bytes , prevout_info [ 'witness_script' ] ) if ( key in script or rutils . hash160 ( key ) in script ) : return True return False
Determines if the key or its hash is in the PrevoutInfo
We use this to determine whether we should get a signature for an input
Determines if the key or its hash is in the PrevoutInfo We use this to determine whether we should get a signature for an input
'''
    Determines if the key or its hash is in the PrevoutInfo
    We use this to determine whether we should get a signature for an input

    Args:
        key                (bytes): the public key
        prevout_info (PrevoutInfo): dict of script and value for the prevout
    Returns:
        (bool): True if signable, false otherwise
    ''' # enforce compression # if there's no script, it's not signable # if the key is anywhere in the script, it is signable
True if signable, false otherwise
True if signable false otherwise
(bool)
key
bytes
the public key
the public key
prevout_info
PrevoutInfo
dict of script and value for the prevout
dict of script and value for the prevout