Пример #1
0
def input_check_multisig_fingerprint(
    txi: TxInputType, multisig_fp: multisig.MultisigFingerprint
) -> None:
    if multisig_fp.mismatch is False:
        # All inputs in Phase 1 had matching multisig fingerprints, allowing a multisig change-output.
        if not txi.multisig or not multisig_fp.matches(txi.multisig):
            # This input no longer has a matching multisig fingerprint.
            raise SigningError(
                FailureType.ProcessError, "Transaction has changed during signing"
            )
Пример #2
0
def output_is_change(
    o: TxOutputType, wallet_path: list, multisig_fp: multisig.MultisigFingerprint,
) -> bool:
    if o.script_type not in helpers.CHANGE_OUTPUT_SCRIPT_TYPES:
        return False
    if o.multisig and not multisig_fp.matches(o.multisig):
        return False
    return (
        wallet_path is not None
        and wallet_path == o.address_n[:-_BIP32_WALLET_DEPTH]
        and o.address_n[-2] <= _BIP32_CHANGE_CHAIN
        and o.address_n[-1] <= _BIP32_MAX_LAST_ELEMENT
    )
Пример #3
0
def output_is_change(
    o: TxOutputType,
    wallet_path: list,
    segwit_in: int,
    multifp: multisig.MultisigFingerprint,
) -> bool:
    if o.multisig and not multifp.matches(o.multisig):
        return False
    if output_is_segwit(o) and o.amount > segwit_in:
        # if the output is segwit, make sure it doesn't spend more than what the
        # segwit inputs paid.  this is to prevent user being tricked into
        # creating ANYONECANSPEND outputs before full segwit activation.
        return False
    return (wallet_path is not None
            and wallet_path == o.address_n[:-_BIP32_WALLET_DEPTH]
            and o.address_n[-2] <= _BIP32_CHANGE_CHAIN
            and o.address_n[-1] <= _BIP32_MAX_LAST_ELEMENT)