def test_deserialize(self): mp = mempool.Mempool() with open_bs("test/files/mempool.dat", "r") as f: mp.deserialize(f) self.assertEqual(mp.version, 1) # Verify the correct number of txs and data on the first tx self.assertEqual(len(mp.txs), 12) self.assertEqual(mp.txs[0].tx.txid, '2e7d9174ff36ede49bce664a002bf9d0bd6d01da04f266de1fd1f3457f245bb0') self.assertEqual(mp.txs[0].time, 1515261281) self.assertEqual(mp.txs[0].fee_delta, 1000) # Verify the correct number of fee_deltas and data on the fee_delta. # Note that map_deltas only contains deltas for transactions which aren't included # in the tx list (ie that aren't currently in the mempool). self.assertEqual(len(mp.map_deltas), 1) self.assertEqual(mp.map_deltas['93ca570ba85fef02846a8dea878b9e82ea1e114a6b2b4206b8f64f3abc76ebfc'], -1001)
index_cursor.execute( "UPDATE staking SET balance = ? WHERE address = ?", (balance, address)) index.commit() app_log.warning( "staking balance updated from {} to {} for {}".format( balance_savings, balance, address)) if __name__ == "__main__": import options config = options.Get() config.read() app_log = log.log("solvency.log", "WARNING", True) mp.MEMPOOL = mp.Mempool(app_log, config, None, False) conn = sqlite3.connect('static/ledger_test.db') conn.text_factory = str c = conn.cursor() index = sqlite3.connect("static/index_test.db") index.text_factory = str index_cursor = index.cursor() address = "4edadac9093d9326ee4b17f869b14f1a2534f96f9c5d7b48dc9acaed" staking_update(conn, c, index, index_cursor, "normal", 736600, app_log) staking_payout(conn, c, index, index_cursor, 736600, 1525304875, app_log) staking_revalidate(conn, c, index, index_cursor, 736600, app_log)