From c0daef265795f9ea5c9cca18c944a73fb65472c6 Mon Sep 17 00:00:00 2001 From: Vivek Teega Date: Tue, 14 Aug 2018 15:10:19 +0530 Subject: [PATCH] More changes to for save_chunk() save_chunk() required more changes to save the block header chunks properly locally. --- electrum/blockchain.py | 12 ++++++------ electrum/transaction.py | 4 ++++ 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/electrum/blockchain.py b/electrum/blockchain.py index ee70478c..742c10db 100644 --- a/electrum/blockchain.py +++ b/electrum/blockchain.py @@ -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: diff --git a/electrum/transaction.py b/electrum/transaction.py index c19f6829..9e637e83 100644 --- a/electrum/transaction.py +++ b/electrum/transaction.py @@ -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