Add the option to pass scrypt hash to the submit block test
This commit is contained in:
parent
611ce67a0e
commit
1cf5e15e05
@ -186,3 +186,7 @@ NOTIFY_EMAIL_SERVER = 'localhost' # E-Mail Sender
|
|||||||
NOTIFY_EMAIL_USERNAME = '' # E-Mail server SMTP Logon
|
NOTIFY_EMAIL_USERNAME = '' # E-Mail server SMTP Logon
|
||||||
NOTIFY_EMAIL_PASSWORD = ''
|
NOTIFY_EMAIL_PASSWORD = ''
|
||||||
NOTIFY_EMAIL_USETLS = True
|
NOTIFY_EMAIL_USETLS = True
|
||||||
|
|
||||||
|
#Pass scrypt hash to submit block check.
|
||||||
|
#Use if submit block is returning errors and marking submitted blocks invaild upstream, but the submitted blocks are being a accepted by the coin daemon into the block chain.
|
||||||
|
BLOCK_CHECK_SCRYPT_HASH = False
|
||||||
|
|||||||
@ -40,7 +40,7 @@ class BitcoinRPC(object):
|
|||||||
}))
|
}))
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def submitblock(self, block_hex, block_hash_hex):
|
def submitblock(self, block_hex, hash_hex):
|
||||||
# Try submitblock if that fails, go to getblocktemplate
|
# Try submitblock if that fails, go to getblocktemplate
|
||||||
try:
|
try:
|
||||||
log.info("Submitting Block with Submit Block ")
|
log.info("Submitting Block with Submit Block ")
|
||||||
@ -57,7 +57,7 @@ class BitcoinRPC(object):
|
|||||||
|
|
||||||
if json.loads(resp)['result'] == None:
|
if json.loads(resp)['result'] == None:
|
||||||
# make sure the block was created.
|
# make sure the block was created.
|
||||||
defer.returnValue((yield self.blockexists(block_hash_hex)))
|
defer.returnValue((yield self.blockexists(hash_hex)))
|
||||||
else:
|
else:
|
||||||
defer.returnValue(False)
|
defer.returnValue(False)
|
||||||
|
|
||||||
@ -91,12 +91,12 @@ class BitcoinRPC(object):
|
|||||||
defer.returnValue(json.loads(resp)['result'])
|
defer.returnValue(json.loads(resp)['result'])
|
||||||
|
|
||||||
@defer.inlineCallbacks
|
@defer.inlineCallbacks
|
||||||
def blockexists(self, block_hash_hex):
|
def blockexists(self, hash_hex):
|
||||||
resp = (yield self._call('getblock', [block_hash_hex,]))
|
resp = (yield self._call('getblock', [hash_hex,]))
|
||||||
if "hash" in json.loads(resp)['result'] and json.loads(resp)['result']['hash'] == block_hash_hex:
|
if "hash" in json.loads(resp)['result'] and json.loads(resp)['result']['hash'] == hash_hex:
|
||||||
log.debug("Block Confirmed: %s" % block_hash_hex)
|
log.debug("Block Confirmed: %s" % hash_hex)
|
||||||
defer.returnValue(True)
|
defer.returnValue(True)
|
||||||
else:
|
else:
|
||||||
log.info("Cannot find block for %s" % block_hash_hex)
|
log.info("Cannot find block for %s" % hash_hex)
|
||||||
defer.returnValue(False)
|
defer.returnValue(False)
|
||||||
|
|
||||||
|
|||||||
@ -88,10 +88,10 @@ class BitcoinRPCManager(object):
|
|||||||
except:
|
except:
|
||||||
self.next_connection()
|
self.next_connection()
|
||||||
|
|
||||||
def submitblock(self, block_hex, block_hash_hex):
|
def submitblock(self, block_hex, hash_hex):
|
||||||
while True:
|
while True:
|
||||||
try:
|
try:
|
||||||
return self.conns[self.curr_conn].submitblock(block_hex, block_hash_hex)
|
return self.conns[self.curr_conn].submitblock(block_hex, hash_hex)
|
||||||
except:
|
except:
|
||||||
self.next_connection()
|
self.next_connection()
|
||||||
|
|
||||||
|
|||||||
@ -279,7 +279,11 @@ class TemplateRegistry(object):
|
|||||||
|
|
||||||
# 7. Submit block to the network
|
# 7. Submit block to the network
|
||||||
serialized = binascii.hexlify(job.serialize())
|
serialized = binascii.hexlify(job.serialize())
|
||||||
on_submit = self.bitcoin_rpc.submitblock(serialized, block_hash_hex)
|
if settings.BLOCK_CHECK_SCRYPT_HASH:
|
||||||
|
on_submit = self.bitcoin_rpc.submitblock(serialized, scrypt_hash_hex)
|
||||||
|
else:
|
||||||
|
on_submit = self.bitcoin_rpc.submitblock(serialized, block_hash_hex)
|
||||||
|
|
||||||
if on_submit:
|
if on_submit:
|
||||||
self.update_block()
|
self.update_block()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user