stratum-mining-litecoin
stratum-mining-litecoin copied to clipboard
strTxComment
About FLO, CMC, NEC, etc. 500 error, view their source code and found that they added a parameter (strTxComment), how to deal with this? https://github.com/pascalguru/florincoin/blob/master/src/main.h#L420 https://github.com/cosmoscoin/cosmoscoin/blob/master/src/main.h#L458
I try to modify halfnode.py, but still wrong, please help me
class CTransaction(object):
def __init__(self):
self.nVersion = 1
self.vin = []
self.vout = []
self.nLockTime = 0
self.strTxComment = "botpool"
self.sha256 = None
def deserialize(self, f):
self.nVersion = 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.strTxComment = deser_string(f.read(8))[0]
self.sha256 = None
def serialize(self):
r = ""
r += struct.pack("<i", self.nVersion)
r += ser_vector(self.vin)
r += ser_vector(self.vout)
r += struct.pack("<I", self.nLockTime)
r += ser_string(self.strTxComment)
log.info("serialize OK: %s" % self.strTxComment)
return r
def calc_sha256(self):
if self.sha256 is None:
self.sha256 = uint256_from_str(SHA256.new(SHA256.new(self.serialize()).digest()).digest())
return self.sha256
def is_valid(self):
self.calc_sha256()
for tout in self.vout:
if tout.nValue < 0 or tout.nValue > 21000000L * 100000000L:
return False
return True
def __repr__(self):
return "CTransaction(nVersion=%i vin=%s vout=%s nLockTime=%i strTxComment=%s)" % (self.nVersion, repr(self.vin), repr(self.vout), self.nLockTime, self.strTxComment)
added support in https://github.com/ahmedbodi/stratum-mining