public async Task AddMempoolEntriesToMempool_WithNull_ThrowsNoException() { MempoolManager manager = this.TxExpiryManager; Assert.NotNull(manager); await manager.AddMempoolEntriesToMempool(null); }
public async Task AddMempoolEntriesToMempool_WithExpiredTx_PurgesTx() { MempoolManager manager = this.TxExpiryManager; Assert.NotNull(manager); long expiryInSeconds = MempoolValidator.DefaultMempoolExpiry * 60 * 60; // tx with expiry twice as long as default expiry List <MempoolPersistenceEntry> txs = new List <MempoolPersistenceEntry> { new MempoolPersistenceEntry { Tx = new Transaction(), Time = manager.DateTimeProvider.GetTime() - expiryInSeconds * 2 } }; await manager.AddMempoolEntriesToMempool(txs); long entries = await manager.MempoolSize(); // Should not add it because it's expired Assert.Equal(0L, entries); }
public async Task AddMempoolEntriesToMempool_WithUnexpiredTx_AddsTx() { MempoolManager manager = this.TxExpiryManager; Assert.NotNull(manager); long expiryInSeconds = MempoolValidator.DefaultMempoolExpiry * 60 * 60; // tx with expiry half as long as default expiry List <MempoolPersistenceEntry> txs = new List <MempoolPersistenceEntry> { new MempoolPersistenceEntry { Tx = new Transaction(), Time = manager.DateTimeProvider.GetTime() - expiryInSeconds / 2 } }; await manager.AddMempoolEntriesToMempool(txs); long entries = await manager.MempoolSize(); // Not expired so should have been added Assert.Equal(1L, entries); }