Beispiel #1
0
 def _a2b_hex(a):
     return __a2b_hex(a.encode('ascii'))
Beispiel #2
0
# Copyright 2012-2016 Luke Dashjr
#
# This program is free software; you can redistribute it and/or modify it
# under the terms of the standard MIT license.  See COPYING for more details.

from binascii import a2b_hex as __a2b_hex
from . import blkmaker as _blkmaker
from time import time as _time

try:
    __a2b_hex('aa')
    _a2b_hex = __a2b_hex
except TypeError:

    def _a2b_hex(a):
        return __a2b_hex(a.encode('ascii'))


def request(jcaps, lpid=None):
    params = {
        'capabilities': jcaps,
        'maxversion': _blkmaker.MAX_BLOCK_VERSION,
    }
    if lpid:
        params['longpollid'] = lpid
    req = {
        'id': 0,
        'method': 'getblocktemplate',
        'params': [params],
    }
    return req