More changes to for save_chunk()

save_chunk() required more changes to save the block header chunks properly locally.
This commit is contained in:
Vivek Teega 2018-08-14 15:10:19 +05:30
parent a64228ba2c
commit c0daef2657
2 changed files with 10 additions and 6 deletions

View File

@ -215,15 +215,15 @@ class Blockchain(util.PrintError):
@with_lock
def save_chunk(self, index, chunk):
chunk_within_checkpoint_region = index < len(self.checkpoints)
#chunk_within_checkpoint_region = index < len(self.checkpoints)
# chunks in checkpoint region are the responsibility of the 'main chain'
if chunk_within_checkpoint_region and self.parent_id is not None:
main_chain = blockchains[0]
main_chain.save_chunk(index, chunk)
return
#if chunk_within_checkpoint_region and self.parent_id is not None:
# main_chain = blockchains[0]
# main_chain.save_chunk(index, chunk)
# return
#delta_height = (index * 2016 - self.forkpoint)
delta_bytes = delta_height * 80
#delta_bytes = delta_height * 80
# if this chunk contains our forkpoint, only save the part after forkpoint
# (the part before is the responsibility of the parent)
#if delta_bytes < 0:

View File

@ -1020,6 +1020,8 @@ class Transaction:
txouts = var_int(len(outputs)) + ''.join(self.serialize_output(o) for o in outputs)
if self.version >= 2:
preimage = nVersion + txins + txouts + nLocktime + nTxComment + nHashType
print("preimage")
print(preimage)
else:
preimage = nVersion + txins + txouts + nLocktime + nHashType
return preimage
@ -1061,6 +1063,8 @@ class Transaction:
return nVersion + marker + flag + txins + txouts + witness + nLocktime
else:
if self.version >= 2:
print("Before serialize to network ")
print(nVersion + txins + txouts + nLocktime + nTxComment)
return nVersion + txins + txouts + nLocktime + nTxComment
else:
return nVersion + txins + txouts + nLocktime