From page https://en.bitcoin.it/wiki/Protocol_specification , I understand the merkle tree works like
merkle([a,b,c,d]) = h( h(a,b), h(c,d) )
But when I do the stratum protocol http://mining.bitcoin.cz/stratum-mining/ , it works something like this
merkle([a,b,c,d]) = h(h(h(a,b),c),d)
And here is the code
def build_merkle_root(self, merkle_branch, coinbase_hash_bin):
merkle_root = coinbase_hash_bin
for h in self.merkle_branch:
merkle_root = doublesha(merkle_root + binascii.unhexlify(h))
return binascii.hexlify(merkle_root)
Do I miss anything?