Skip to content

Commit

Permalink
merklemaker: Refactor txnobjs list creation before gentx creation
Browse files Browse the repository at this point in the history
  • Loading branch information
luke-jr committed Jan 29, 2016
1 parent c355da4 commit 662f2d8
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions merklemaker.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,20 +398,19 @@ def _ProcessGBT(self, MP, TS = None):

self._makeBlockSafe(MP, txnlist, txninfo)

cbtxn = self.makeCoinbaseTxn(MP['coinbasevalue'], prevBlockHex = MP['previousblockhash'])
cbtxn.setCoinbase(b'\0\0')
cbtxn.assemble()
txnlist.insert(0, cbtxn.data)
txninfo.insert(0, {
})

txnobjs = [cbtxn]
for i in range(1, len(txnlist)):
txnobjs = [None]
for i in range(len(txnlist)):
iinfo = txninfo[i]
ka = {}
if 'txid' in iinfo:
ka['txid'] = iinfo['txid']
txnobjs.append(Txn(data=txnlist[i], **ka))

cbtxn = self.makeCoinbaseTxn(MP['coinbasevalue'], prevBlockHex = MP['previousblockhash'])
cbtxn.setCoinbase(b'\0\0')
cbtxn.assemble()
txnobjs[0] = cbtxn

txnobjs = list(txnobjs)
newMerkleTree = MerkleTree(txnobjs)
newMerkleTree.POTInfo = MP.get('POTInfo')
Expand Down

0 comments on commit 662f2d8

Please sign in to comment.