More changes to for save_chunk()
save_chunk() required more changes to save the block header chunks properly locally.
This commit is contained in:
parent
a64228ba2c
commit
c0daef2657
@ -215,15 +215,15 @@ class Blockchain(util.PrintError):
|
|||||||
|
|
||||||
@with_lock
|
@with_lock
|
||||||
def save_chunk(self, index, chunk):
|
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'
|
# chunks in checkpoint region are the responsibility of the 'main chain'
|
||||||
if chunk_within_checkpoint_region and self.parent_id is not None:
|
#if chunk_within_checkpoint_region and self.parent_id is not None:
|
||||||
main_chain = blockchains[0]
|
# main_chain = blockchains[0]
|
||||||
main_chain.save_chunk(index, chunk)
|
# main_chain.save_chunk(index, chunk)
|
||||||
return
|
# return
|
||||||
|
|
||||||
#delta_height = (index * 2016 - self.forkpoint)
|
#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
|
# if this chunk contains our forkpoint, only save the part after forkpoint
|
||||||
# (the part before is the responsibility of the parent)
|
# (the part before is the responsibility of the parent)
|
||||||
#if delta_bytes < 0:
|
#if delta_bytes < 0:
|
||||||
|
|||||||
@ -1020,6 +1020,8 @@ class Transaction:
|
|||||||
txouts = var_int(len(outputs)) + ''.join(self.serialize_output(o) for o in outputs)
|
txouts = var_int(len(outputs)) + ''.join(self.serialize_output(o) for o in outputs)
|
||||||
if self.version >= 2:
|
if self.version >= 2:
|
||||||
preimage = nVersion + txins + txouts + nLocktime + nTxComment + nHashType
|
preimage = nVersion + txins + txouts + nLocktime + nTxComment + nHashType
|
||||||
|
print("preimage")
|
||||||
|
print(preimage)
|
||||||
else:
|
else:
|
||||||
preimage = nVersion + txins + txouts + nLocktime + nHashType
|
preimage = nVersion + txins + txouts + nLocktime + nHashType
|
||||||
return preimage
|
return preimage
|
||||||
@ -1061,6 +1063,8 @@ class Transaction:
|
|||||||
return nVersion + marker + flag + txins + txouts + witness + nLocktime
|
return nVersion + marker + flag + txins + txouts + witness + nLocktime
|
||||||
else:
|
else:
|
||||||
if self.version >= 2:
|
if self.version >= 2:
|
||||||
|
print("Before serialize to network ")
|
||||||
|
print(nVersion + txins + txouts + nLocktime + nTxComment)
|
||||||
return nVersion + txins + txouts + nLocktime + nTxComment
|
return nVersion + txins + txouts + nLocktime + nTxComment
|
||||||
else:
|
else:
|
||||||
return nVersion + txins + txouts + nLocktime
|
return nVersion + txins + txouts + nLocktime
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user