MultiAlgo Support TX comments OSC, B0C, TEK
This commit is contained in:
parent
b19af3e9ac
commit
fb6ce0187a
@ -20,8 +20,12 @@ COINDAEMON_TRUSTED_PASSWORD = 'somepassword'
|
||||
# This currently only works with POW SHA256 and Scrypt Coins
|
||||
# The available options are scrypt and sha256d.
|
||||
# If the option does not meet either of these criteria stratum defaults to scrypt
|
||||
# Until AutoReward Selecting Code has been implemented the below options are used to select the type of coin
|
||||
# For Reward type there is POW and POS. please ensure you choose the currect type.
|
||||
# For SHA256 PoS Coins which support TX Messages please enter yes in the TX selection
|
||||
COINDAEMON_ALGO = 'scrypt'
|
||||
|
||||
COINDAEMON_Reward = 'POW'
|
||||
COINDAEMON_SHA256_TX = 'no'
|
||||
# ******************** BASIC SETTINGS ***************
|
||||
# Backup Coin Daemon address's (consider having at least 1 backup)
|
||||
# You can have up to 99
|
||||
|
||||
@ -42,6 +42,53 @@ if settings.COINDAEMON_Reward == 'POW':
|
||||
# Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
|
||||
self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
|
||||
|
||||
def set_extranonce(self, extranonce):
|
||||
if len(extranonce) != self.extranonce_size:
|
||||
raise Exception("Incorrect extranonce size")
|
||||
|
||||
(part1, part2) = self.vin[0]._scriptSig_template
|
||||
self.vin[0].scriptSig = part1 + extranonce + part2
|
||||
elif settings.COINDAEMON_Reward == 'POS' and settings.COINDAEMON_SHA256_TX == 'yes':
|
||||
class CoinbaseTransaction(halfnode.CTransaction):
|
||||
'''Construct special transaction used for coinbase tx.
|
||||
It also implements quick serialization using pre-cached
|
||||
scriptSig template.'''
|
||||
|
||||
extranonce_type = '>Q'
|
||||
extranonce_placeholder = struct.pack(extranonce_type, int('f000000ff111111f', 16))
|
||||
extranonce_size = struct.calcsize(extranonce_type)
|
||||
|
||||
def __init__(self, timestamper, coinbaser, value, flags, height, data, ntime):
|
||||
super(CoinbaseTransaction, self).__init__()
|
||||
|
||||
#self.extranonce = 0
|
||||
|
||||
if len(self.extranonce_placeholder) != self.extranonce_size:
|
||||
raise Exception("Extranonce placeholder don't match expected length!")
|
||||
|
||||
tx_in = halfnode.CTxIn()
|
||||
tx_in.prevout.hash = 0L
|
||||
tx_in.prevout.n = 2**32-1
|
||||
tx_in._scriptSig_template = (
|
||||
util.ser_number(height) + binascii.unhexlify(flags) + util.ser_number(int(timestamper.time())) + \
|
||||
chr(self.extranonce_size),
|
||||
util.ser_string(coinbaser.get_coinbase_data() + data)
|
||||
)
|
||||
|
||||
tx_in.scriptSig = tx_in._scriptSig_template[0] + self.extranonce_placeholder + tx_in._scriptSig_template[1]
|
||||
|
||||
tx_out = halfnode.CTxOut()
|
||||
tx_out.nValue = value
|
||||
tx_out.scriptPubKey = coinbaser.get_script_pubkey()
|
||||
|
||||
self.nTime = ntime
|
||||
self.strTxComment = "Mined By AhmedBodi's CryptoExpert Pools"
|
||||
self.vin.append(tx_in)
|
||||
self.vout.append(tx_out)
|
||||
|
||||
# Two parts of serialized coinbase, just put part1 + extranonce + part2 to have final serialized tx
|
||||
self._serialized = super(CoinbaseTransaction, self).serialize().split(self.extranonce_placeholder)
|
||||
|
||||
def set_extranonce(self, extranonce):
|
||||
if len(extranonce) != self.extranonce_size:
|
||||
raise Exception("Incorrect extranonce size")
|
||||
|
||||
@ -111,11 +111,17 @@ COINDAEMON_TRUSTED_PORT = 8332 # RPC port
|
||||
COINDAEMON_TRUSTED_USER = 'stratum'
|
||||
COINDAEMON_TRUSTED_PASSWORD = '***somepassword***'
|
||||
|
||||
|
||||
# Coin Algorithm is the option used to determine the algortithm used by stratum
|
||||
# This currently only works with POW SHA256 and Scrypt Coins
|
||||
# The available options are scrypt and sha256d.
|
||||
# If the option does not meet either of these criteria stratum defaults to scrypt
|
||||
# If the option does not meet either of these criteria stratum defaults to scry$
|
||||
# Until AutoReward Selecting Code has been implemented the below options are us$
|
||||
# For Reward type there is POW and POS. please ensure you choose the currect ty$
|
||||
# For SHA256 PoS Coins which support TX Messages please enter yes in the TX sel$
|
||||
COINDAEMON_ALGO = 'scrypt'
|
||||
COINDAEMON_Reward = 'POW'
|
||||
COINDAEMON_SHA256_TX = 'yes'
|
||||
|
||||
# ******************** OTHER CORE SETTINGS *********************
|
||||
# Use "echo -n '<yourpassword>' | sha256sum | cut -f1 -d' ' "
|
||||
|
||||
@ -144,6 +144,14 @@ class CTransaction(object):
|
||||
self.vout = []
|
||||
self.nLockTime = 0
|
||||
self.sha256 = None
|
||||
elif settings.COINDAEMON_Reward == 'POS' and settings.COINDAEMON_SHA256_TX == 'yes':
|
||||
self.nVersion = 1
|
||||
self.nTime = 0
|
||||
self.vin = []
|
||||
self.vout = []
|
||||
self.nLockTime = 0
|
||||
self.sha256 = None
|
||||
self.strTxComment = ""
|
||||
else:
|
||||
self.nVersion = 1
|
||||
self.nTime = 0
|
||||
@ -158,7 +166,15 @@ class CTransaction(object):
|
||||
self.vout = deser_vector(f, CTxOut)
|
||||
self.nLockTime = struct.unpack("<I", f.read(4))[0]
|
||||
self.sha256 = None
|
||||
else:
|
||||
elif settings.COINDAEMON_Reward == 'POS' and settings.COINDAEMON_SHA256_TX == 'yes':
|
||||
self.nVersion = struct.unpack("<i", f.read(4))[0]
|
||||
self.nTime = struct.unpack("<i", f.read(4))[0]
|
||||
self.vin = deser_vector(f, CTxIn)
|
||||
self.vout = deser_vector(f, CTxOut)
|
||||
self.nLockTime = struct.unpack("<I", f.read(4))[0]
|
||||
self.sha256 = None
|
||||
self.strTxComment = deser_string(f)
|
||||
else:
|
||||
self.nVersion = struct.unpack("<i", f.read(4))[0]
|
||||
self.nTime = struct.unpack("<i", f.read(4))[0]
|
||||
self.vin = deser_vector(f, CTxIn)
|
||||
@ -173,6 +189,15 @@ class CTransaction(object):
|
||||
r += ser_vector(self.vout)
|
||||
r += struct.pack("<I", self.nLockTime)
|
||||
return r
|
||||
elif settings.COINDAEMON_Reward == 'POS' and settings.COINDAEMON_SHA256_TX == 'yes':
|
||||
r = ""
|
||||
r += struct.pack("<i", self.nVersion)
|
||||
r += struct.pack("<i", self.nTime)
|
||||
r += ser_vector(self.vin)
|
||||
r += ser_vector(self.vout)
|
||||
r += struct.pack("<I", self.nLockTime)
|
||||
r += ser_string(self.strTxComment)
|
||||
return r
|
||||
else:
|
||||
r = ""
|
||||
r += struct.pack("<i", self.nVersion)
|
||||
|
||||
Loading…
Reference in New Issue
Block a user