def testAddForkToChain(self):
     chain = BU.generateChain("me", 5)
     b3 = chain.top.prev.prev
     fork = BU.growBlock(b3, "me", 3)
     fChain = BU.addForkToChain(chain, fork)
     self.assertEqual(fChain.top.height, 6)
     self.assertEqual(BU.isValidChain(fChain), True)
     self.assertEqual(len(fChain.orphans), 1)
     fChain = BU.addForkToChain(fChain,
                                BU.growBlock(fChain.orphans[0], "me", 2))
     self.assertEqual(BU.isValidChain(fChain), True)
     self.assertEqual(len(fChain.orphans), 1)
 def testMineNewBlock(self):
     chain = BU.generateChain("me", 5)
     newChain = BU.mineNewBlock(chain, "me")
     self.assertEqual(BU.isValidChain(newChain), True)
     self.assertEqual(len(newChain.orphans), 0)
 def testGenerateChain(self):
     self.assertEqual(BU.isValidChain(BU.generateChain("me", 34)), True)
     self.assertEqual(BU.generateChain("me", -5), None)