Skip to content

Commit

Permalink
Support merged mining via CAuxPow structure.
Browse files Browse the repository at this point in the history
  • Loading branch information
John Tobey authored and John Tobey committed Aug 5, 2011
1 parent 2982ef1 commit 1b37eda
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion deserialize.py
Expand Up @@ -146,7 +146,15 @@ def deserialize_WalletTx(d, transaction_index=None, owner_keys=None):
result += " fromMe:"+str(d['fromMe'])+" spent:"+str(d['spent'])
return result

def parse_Block(vds):
def parse_AuxPow(vds):
d = parse_MerkleTx(vds)
n_chainMerkleBranch = vds.read_compact_size()
d['chainMerkleBranch'] = vds.read_bytes(32*n_chainMerkleBranch)
d['chainIndex'] = vds.read_int32()
d['parentBlock'] = parse_BlockHeader(vds)
return d

def parse_BlockHeader(vds):
d = {}
header_start = vds.read_cursor
d['version'] = vds.read_int32()
Expand All @@ -157,6 +165,12 @@ def parse_Block(vds):
d['nNonce'] = vds.read_uint32()
header_end = vds.read_cursor
d['__header__'] = vds.input[header_start:header_end]
return d

def parse_Block(vds):
d = parse_BlockHeader(vds)
if d['version'] & (1 << 8):
d['auxpow'] = parse_AuxPow(vds)
d['transactions'] = []
nTransactions = vds.read_compact_size()
for i in xrange(nTransactions):
Expand Down

0 comments on commit 1b37eda

Please sign in to comment.