コード例 #1
0
ファイル: formats.py プロジェクト: gitter-badger/txsc
def int_to_bytearray(value):
    """Encode an integer as a byte array or opcode value."""
    try:
        value = int(CScriptOp.encode_op_n(value))
    except ValueError:
        pass
    return _bignum.bn2vch(value)
コード例 #2
0
def int_to_bytearray(value, as_opcode=True):
    """Encode an integer as a byte array or opcode value."""
    if as_opcode:
        try:
            value = int(CScriptOp.encode_op_n(value))
        except ValueError:
            pass
    return _bignum.bn2vch(value)[::-1]