Ejemplo n.º 1
0
def make_witness_input(outpoint, sequence):  # noqa: F811
    '''Make a witness input'''
    if 'decred' in riemann.get_current_network_name():
        return decred.DecredTxIn(outpoint=outpoint,
                                 sequence=utils.i2le_padded(sequence, 4))
    return tx.TxIn(outpoint=outpoint,
                   stack_script=b'',
                   redeem_script=b'',
                   sequence=utils.i2le_padded(sequence, 4))
Ejemplo n.º 2
0
def make_legacy_input(  # noqa: F811
        outpoint, stack_script, redeem_script, sequence):
    '''Make a legacy input'''
    if 'decred' in riemann.get_current_network_name():
        return decred.DecredTxIn(outpoint=outpoint,
                                 sequence=utils.i2le_padded(sequence, 4))
    return tx.TxIn(outpoint=outpoint,
                   stack_script=stack_script,
                   redeem_script=redeem_script,
                   sequence=utils.i2le_padded(sequence, 4))
Ejemplo n.º 3
0
def make_witness_input(outpoint, sequence):  # noqa: F811
    '''
    Make a Segwit input. This is clearly superior to `make_legacy_input` and
    you should use witness always.

    Args:
        outpoint: The Outpoint object
        sequence: The 4-byte LE-encoded sequence number
    Returns:
        A Segwit TxIn object.
    '''
    if 'decred' in riemann.get_current_network_name():
        return decred.DecredTxIn(outpoint=outpoint,
                                 sequence=utils.i2le_padded(sequence, 4))
    return tx.TxIn(outpoint=outpoint,
                   stack_script=b'',
                   redeem_script=b'',
                   sequence=utils.i2le_padded(sequence, 4))
Ejemplo n.º 4
0
def make_legacy_input(  # noqa: F811
        outpoint, stack_script, redeem_script, sequence):
    '''
    Make a legacy input. This supports creating Compatibility inputs by passing
    the witness program to `redeem_script` while passing an empty bytestring
    for `stack_script`.

    Args:
        outpoint: The Outpoint object
        stack_script: A serialized Script program that sets the initial stack
        redeem_script: A serialized Script program that is run on the stack
        sequence: The 4-byte LE-encoded sequence number
    Returns:
        A Legacy TxIn object.
    '''
    if 'decred' in riemann.get_current_network_name():
        return decred.DecredTxIn(outpoint=outpoint,
                                 sequence=utils.i2le_padded(sequence, 4))
    return tx.TxIn(outpoint=outpoint,
                   stack_script=stack_script,
                   redeem_script=redeem_script,
                   sequence=utils.i2le_padded(sequence, 4))
Ejemplo n.º 5
0
def make_decred_input(outpoint: decred.DecredOutpoint,
                      sequence: int) -> decred.DecredTxIn:
    return decred.DecredTxIn(outpoint=outpoint,
                             sequence=utils.i2le_padded(sequence, 4))