Esempio n. 1
0
 def test_offline(self):
     bts = Steem(node=self.nodelist.get_nodes(),
                 offline=True,
                 data_refresh_time_seconds=900,
                 keys={
                     "active": wif,
                     "owner": wif,
                     "memo": wif
                 })
     bts.refresh_data()
     self.assertTrue(bts.get_feed_history(use_stored_data=False) is None)
     self.assertTrue(bts.get_feed_history(use_stored_data=True) is None)
     self.assertTrue(bts.get_reward_funds(use_stored_data=False) is None)
     self.assertTrue(bts.get_reward_funds(use_stored_data=True) is None)
     self.assertTrue(
         bts.get_current_median_history(use_stored_data=False) is None)
     self.assertTrue(
         bts.get_current_median_history(use_stored_data=True) is None)
     self.assertTrue(
         bts.get_hardfork_properties(use_stored_data=False) is None)
     self.assertTrue(
         bts.get_hardfork_properties(use_stored_data=True) is None)
     self.assertTrue(bts.get_network(use_stored_data=False) is None)
     self.assertTrue(bts.get_network(use_stored_data=True) is None)
     self.assertTrue(
         bts.get_witness_schedule(use_stored_data=False) is None)
     self.assertTrue(bts.get_witness_schedule(use_stored_data=True) is None)
     self.assertTrue(bts.get_config(use_stored_data=False) is None)
     self.assertTrue(bts.get_config(use_stored_data=True) is None)
     self.assertEqual(bts.get_block_interval(), 3)
     self.assertEqual(bts.get_blockchain_version(), '0.0.0')
Esempio n. 2
0
 def test_properties(self, node_param):
     if node_param == "normal":
         bts = Steem(node=self.nodelist.get_nodes(),
                     nobroadcast=True,
                     data_refresh_time_seconds=900,
                     keys={
                         "active": wif,
                         "owner": wif,
                         "memo": wif
                     },
                     num_retries=10)
     elif node_param == "testnet":
         bts = Steem(node="https://testnet.steemitdev.com",
                     nobroadcast=True,
                     data_refresh_time_seconds=900,
                     keys={
                         "active": wif,
                         "owner": wif,
                         "memo": wif
                     },
                     num_retries=10)
     self.assertTrue(
         bts.get_feed_history(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_reward_funds(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_current_median_history(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_hardfork_properties(use_stored_data=False) is not None)
     self.assertTrue(bts.get_network(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_witness_schedule(use_stored_data=False) is not None)
     self.assertTrue(bts.get_config(use_stored_data=False) is not None)
     self.assertTrue(bts.get_block_interval() is not None)
     self.assertTrue(bts.get_blockchain_version() is not None)
Esempio n. 3
0
 def test_properties(self):
     bts = Steem(node=self.nodelist.get_steem_nodes(),
                 nobroadcast=True,
                 data_refresh_time_seconds=900,
                 keys={
                     "active": wif,
                     "owner": wif,
                     "memo": wif
                 },
                 num_retries=10)
     self.assertTrue(
         bts.get_feed_history(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_reward_funds(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_current_median_history(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_hardfork_properties(use_stored_data=False) is not None)
     self.assertTrue(bts.get_network(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_witness_schedule(use_stored_data=False) is not None)
     self.assertTrue(bts.get_config(use_stored_data=False) is not None)
     self.assertTrue(bts.get_block_interval() is not None)
     self.assertTrue(bts.get_blockchain_version() is not None)
     self.assertTrue(bts.get_blockchain_name() == "steem")
     self.assertFalse(bts.is_hive)
     self.assertTrue(bts.is_steem)
Esempio n. 4
0
 def test_properties(self, node_param):
     nodelist = NodeList()
     if node_param == "non_appbase":
         bts = Steem(node=nodelist.get_nodes(appbase=False),
                     nobroadcast=True,
                     data_refresh_time_seconds=900,
                     keys={
                         "active": wif,
                         "owner": wif,
                         "memo": wif
                     },
                     num_retries=10)
     elif node_param == "appbase":
         bts = Steem(node=nodelist.get_nodes(normal=False, appbase=True),
                     nobroadcast=True,
                     data_refresh_time_seconds=900,
                     keys={
                         "active": wif,
                         "owner": wif,
                         "memo": wif
                     },
                     num_retries=10)
     self.assertTrue(
         bts.get_reserve_ratio(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_feed_history(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_reward_funds(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_current_median_history(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_hardfork_properties(use_stored_data=False) is not None)
     self.assertTrue(bts.get_network(use_stored_data=False) is not None)
     self.assertTrue(
         bts.get_witness_schedule(use_stored_data=False) is not None)
     self.assertTrue(bts.get_config(use_stored_data=False) is not None)
     self.assertTrue(bts.get_block_interval() is not None)
     self.assertTrue(bts.get_blockchain_version() is not None)
Esempio n. 5
0
    elif next_block_min > 1:
        time_diff_est = "%.2f minutes" % next_block_min
    else:
        time_diff_est = "%.2f seconds" % next_block_s
    return time_diff_est


if __name__ == "__main__":
    if len(sys.argv) != 2:
        witness = "holger80"
    else:
        witness = sys.argv[1]
    stm = Steem()
    witness = Witness(witness, steem_instance=stm)

    witness_schedule = stm.get_witness_schedule()
    config = stm.get_config()
    if "VIRTUAL_SCHEDULE_LAP_LENGTH2" in config:
        lap_length = int(config["VIRTUAL_SCHEDULE_LAP_LENGTH2"])
    else:
        lap_length = int(config["STEEM_VIRTUAL_SCHEDULE_LAP_LENGTH2"])
    witnesses = WitnessesRankedByVote(limit=250, steem_instance=stm)
    vote_sum = witnesses.get_votes_sum()

    virtual_time_to_block_num = int(
        witness_schedule["num_scheduled_witnesses"]) / (lap_length /
                                                        (vote_sum + 1))
    while True:
        witness.refresh()
        witness_schedule = stm.get_witness_schedule(use_stored_data=False)