Beispiel #1
0
    def __init__(self, block_template_class, coinbaser, bitcoin_rpc, aux_rpc,
                 instance_id, on_template_callback, on_block_callback):
        self.prevhashes = {}
        self.jobs = weakref.WeakValueDictionary()

        self.extranonce_counter = ExtranonceCounter(instance_id)
        self.extranonce2_size = block_template_class.coinbase_transaction_class.extranonce_size \
                - self.extranonce_counter.get_size()
        self.coinbaser = coinbaser
        self.block_template_class = block_template_class
        self.bitcoin_rpc = bitcoin_rpc
        self.on_block_callback = on_block_callback
        self.on_template_callback = on_template_callback

        self.last_block = None
        self.update_in_progress = False
        self.last_update = 0
        self.last_height = None

        self.aux_rpc = aux_rpc
        self.aux_update_in_progress = False
        self.aux_new_block = False
        self.aux_last_update = 0
        self.aux_update_counter = 0
        self.aux_data = []

        # Create first block template on startup
        self.update_auxs()
Beispiel #2
0
    def __init__(self, block_template_class, coinbaser, bitcoin_rpc, mm_rpc,
                 instance_id, on_template_callback, on_block_callback):
        self.prevhashes = {}
        self.jobs = weakref.WeakValueDictionary()

        self.extranonce_counter = ExtranonceCounter(instance_id)
        self.extranonce2_size = block_template_class.coinbase_transaction_class.extranonce_size \
                - self.extranonce_counter.get_size()
        log.debug("Got to Template Registry")
        self.coinbaser = coinbaser
        self.block_template_class = block_template_class
        self.bitcoin_rpc = bitcoin_rpc
        self.mm_rpc = mm_rpc
        self.on_block_callback = on_block_callback
        self.on_template_callback = on_template_callback

        self.last_block = None
        self.update_in_progress = False
        self.update_mm_in_progress = False
        self.last_update = None
        self.last_update_mm = None

        self.mm_hash = ""
        self.mm_script = ""
        self.mm_target = None
        self.last_height = None

        if settings.COINDAEMON_ALGO == 'scrypt':
            self.algo = 1
        else:
            self.algo = 0

        # Create first block template on startup
        self.update_block()
        self.update_mm_block()
Beispiel #3
0
    def __init__(self,
                 block_template_class,
                 coinbaser,
                 bitcoin_rpc,
                 instance_id,
                 on_template_callback,
                 on_block_callback,
                 rootstock_rpc=None):
        self.prevhashes = {}
        self.jobs = weakref.WeakValueDictionary()

        self.extranonce_counter = ExtranonceCounter(instance_id)
        self.extranonce2_size = block_template_class.coinbase_transaction_class.extranonce_size \
                - self.extranonce_counter.get_size()

        self.coinbaser = coinbaser
        self.block_template_class = block_template_class
        self.bitcoin_rpc = bitcoin_rpc
        self.rootstock_rpc = rootstock_rpc
        self.on_block_callback = on_block_callback
        self.on_template_callback = on_template_callback

        self.last_block = None
        self.update_in_progress = False
        self.last_update = None
        self.rsk_last_update = 0
        self.rsk_update_in_progress = False
        self.last_data = dict()
        self.last_rsk_hash = ""

        # Create first block template on startup
        self.update_block()
        if self.rootstock_rpc is not None:
            self.rsk_timeout_counter = 0
 def __init__(self, block_template_class, coinbaser, bitcoin_rpc, instance_id,
              on_template_callback, on_block_callback):
     self.prevhashes = {}
     self.jobs = weakref.WeakValueDictionary()
     
     self.extranonce_counter = ExtranonceCounter(instance_id)
     self.extranonce2_size = block_template_class.coinbase_transaction_class.extranonce_size \
             - self.extranonce_counter.get_size()
     log.debug("Got to Template Registry")
     self.coinbaser = coinbaser
     self.block_template_class = block_template_class
     self.bitcoin_rpc = bitcoin_rpc
     self.on_block_callback = on_block_callback
     self.on_template_callback = on_template_callback
     
     self.last_block = None
     self.update_in_progress = False
     self.last_update = None
     
     # Create first block template on startup
     self.update_block()
Beispiel #5
0
    def __init__(self, block_template_class, bitcoin_rpc, instance_id,
                 on_template_callback, on_block_callback):
        self.prevhashes = {}
        self.jobs = weakref.WeakValueDictionary()

        self.extranonce_counter = ExtranonceCounter(instance_id)
        self.extranonce2_size = block_template_class.coinbase_transaction_class.extranonce_size \
                - self.extranonce_counter.get_size()

        self.coinbasers_value = []

        for address, percent in settings.BITCOIN_ADDRESSES.iteritems():
            coinbaser = SimpleCoinbaser(address, bitcoin_rpc)
            self.coinbasers_value.append((coinbaser, percent))
        self.block_template_class = block_template_class
        self.bitcoin_rpc = bitcoin_rpc
        self.on_block_callback = on_block_callback
        self.on_template_callback = on_template_callback

        self.last_block = None
        self.last_update = None
    def __init__(self, block_template_class, coinbaser, bitcoin_rpc, instance_id,
                 on_template_callback, on_block_callback):
        self.current_prevhash = ''
        self.jobs = weakref.WeakValueDictionary()
        self.minimal_job_id = 0

        self.extranonce_counter = ExtranonceCounter(instance_id)
        self.extranonce2_size = block_template_class.coinbase_transaction_class.extranonce_size \
                - self.extranonce_counter.get_size()

        self.coinbaser = coinbaser
        self.block_template_class = block_template_class
        self.bitcoin_rpc = bitcoin_rpc
        self.on_block_callback = on_block_callback
        self.on_template_callback = on_template_callback

        self._last_template = None
        self.update_in_progress = False
        self.last_update = None

        # Create first block template on startup
        self.update_block()
Beispiel #7
0
    def __init__(self, template_generator, bitcoin_rpc, instance_id,
                 on_template_callback, on_block_callback):
        log.debug("Got to Template Registry")

        self.prevhashes = {}
        self.jobs = weakref.WeakValueDictionary()

        self.template_generator = template_generator

        self.extranonce_counter = ExtranonceCounter(instance_id)
        self.extranonce2_size = template_generator.get_extranonce_size(
        ) - self.extranonce_counter.get_size()

        self.bitcoin_rpc = bitcoin_rpc
        self.on_block_callback = on_block_callback
        self.on_template_callback = on_template_callback

        self.last_template = None
        self.update_in_progress = False
        self.GBT_RPC_ATTEMPT = None
        self.last_block_update_start_time = None

        # Create first block template on startup
        self.update_block()