def test_deterministic_masternode_elections(current_block_hash, mn_list):
    from terracoinlib import elect_mn

    winner = elect_mn(block_hash=current_block_hash, mnlist=mn_list)
    assert winner == 'f68a2e5d64f4a9be7ff8d0fbd9059dcd3ce98ad7a19a9260d1d6709127ffac56-1'

    winner = elect_mn(block_hash='00000056bcd579fa3dc9a1ee41e8124a4891dcf2661aa3c07cc582bfb63b52b9', mnlist=mn_list)
    assert winner == '656695ed867e193490261bea74783f0a39329ff634a10a9fb6f131807eeca744-1'
Esempio n. 2
0
    def we_are_the_winner(self):
        import terracoinlib
        # find the elected MN vin for superblock creation...
        current_block_hash = self.current_block_hash()
        mn_list = self.get_masternodes()
        winner = terracoinlib.elect_mn(block_hash=current_block_hash, mnlist=mn_list)
        my_vin = self.get_current_masternode_vin()

        # print "current_block_hash: [%s]" % current_block_hash
        # print "MN election winner: [%s]" % winner
        # print "current masternode VIN: [%s]" % my_vin

        return (winner == my_vin)