Search in sources :

Example 1 with TxnIdRecentHistory

use of com.hedera.services.records.TxnIdRecentHistory in project hedera-services by hashgraph.

the class ExpiryManagerTest method rebuildsExpectedRecordsFromState.

@Test
void rebuildsExpectedRecordsFromState() {
    subject = new ExpiryManager(mockScheduleStore, nums, sigImpactHistorian, liveTxnHistories, () -> liveAccounts, () -> mockSchedules);
    final var newTxnId = recordWith(aGrpcId, start).getTxnId().toGrpc();
    final var leftoverTxnId = recordWith(bGrpcId, now).getTxnId().toGrpc();
    liveTxnHistories.put(leftoverTxnId, new TxnIdRecentHistory());
    anAccount.records().offer(expiring(recordWith(aGrpcId, start), firstThen));
    anAccount.records().offer(expiring(recordWith(aGrpcId, start), secondThen));
    liveAccounts.put(aKey, anAccount);
    subject.reviewExistingPayerRecords();
    // then:
    assertFalse(liveTxnHistories.containsKey(leftoverTxnId));
    assertEquals(firstThen, liveTxnHistories.get(newTxnId).priorityRecord().getExpiry());
    assertEquals(secondThen, liveTxnHistories.get(newTxnId).allDuplicateRecords().get(0).getExpiry());
}
Also used : TxnIdRecentHistory(com.hedera.services.records.TxnIdRecentHistory) Test(org.junit.jupiter.api.Test)

Aggregations

TxnIdRecentHistory (com.hedera.services.records.TxnIdRecentHistory)1 Test (org.junit.jupiter.api.Test)1