do not call BuildMerkleTree() unnecessarily twice
Merge pull request #2890 from cozz/cozz1

do not call BuildMerkleTree() unnecessarily twice