def test_known_2pow28(self): tree = MerkleTree(2<<28) item_a = 3703141493535563179657531719960160174296085208671919316200479060314459804651 tree.append(item_a) item_b = 134551314051432487569247388144051420116740427803855572138106146683954151557 tree.append(item_b) self.assertEqual(tree.root, 14972246236048249827985830600768475898195156734731557762844426864943654467818) proof_a = tree.proof(0) self.assertTrue(proof_a.verify(tree.root)) proof_b = tree.proof(1) self.assertTrue(proof_b.verify(tree.root)) self.assertEqual(tree.leaf(0, 0), 3703141493535563179657531719960160174296085208671919316200479060314459804651) self.assertEqual(tree.leaf(1, 0), 3075442268020138823380831368198734873612490112867968717790651410945045657947) self.assertEqual(tree.leaf(2, 0), 10399465128272526817755257959020023025563587559350936053132523411421423507430) self.assertEqual(tree.leaf(1, 1), 17296471688945713021042054900108821045192859417413320566181654591511652308323) self.assertEqual(tree.leaf(2, 1), 4832852105446597958495745596582249246190817345027389430471458078394903639834) self.assertEqual(tree.leaf(13, 1), 14116139569958633576637617144876714429777518811711593939929091541932333542283) self.assertEqual(tree.leaf(22, 1), 16077039334695461958102978289003547153551663194787878097275872631374489043531)
def test_known_2pow28(self): tree = MerkleTree(2 << 28) item_a = 3703141493535563179657531719960160174296085208671919316200479060314459804651 tree.append(item_a) item_b = 134551314051432487569247388144051420116740427803855572138106146683954151557 tree.append(item_b) self.assertEqual( tree.root, 12880293998234311228895747943713504338160238149993004139365982527556885579681 ) proof_a = tree.proof(0) self.assertTrue(proof_a.verify(tree.root)) proof_b = tree.proof(1) self.assertTrue(proof_b.verify(tree.root)) self.assertEqual( tree.leaf(0, 0), 3703141493535563179657531719960160174296085208671919316200479060314459804651 ) self.assertEqual( tree.leaf(1, 0), 13981856331482487152452149678096232821987624395720231314895268163963385035507 ) self.assertEqual( tree.leaf(2, 0), 4008582766686307301250960594183893449903725811265984514032955228389672705119 ) self.assertEqual( tree.leaf(1, 1), 17296471688945713021042054900108821045192859417413320566181654591511652308323 ) self.assertEqual( tree.leaf(2, 1), 4832852105446597958495745596582249246190817345027389430471458078394903639834 ) self.assertEqual( tree.leaf(13, 1), 14116139569958633576637617144876714429777518811711593939929091541932333542283 ) self.assertEqual( tree.leaf(22, 1), 16077039334695461958102978289003547153551663194787878097275872631374489043531 )