use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class PrecompiledContractsCallErrorHandlingTests method assertTransaction.
private void assertTransaction(String tx, String precompiledAddress, int expectedPrecompiledSuccessEventCount, int expectedPrecompiledFailureEventCount, boolean expectedTransactionStatus) throws IOException {
Transaction transaction = world.getTransactionByName(tx);
Assert.assertNotNull(transaction);
TransactionReceipt transactionReceipt = world.getTransactionReceiptByName(tx);
assertExpectedData(transactionReceipt.getTransaction(), precompiledAddress);
Assert.assertNotNull(transactionReceipt);
Assert.assertEquals(expectedTransactionStatus, transactionReceipt.isSuccessful());
assertEvents(transactionReceipt, "PrecompiledSuccess", expectedPrecompiledSuccessEventCount);
assertEvents(transactionReceipt, "PrecompiledFailure", expectedPrecompiledFailureEventCount);
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class ReceiptStoreImplFallbackTest method getOlderReceiptDataViaFallback.
@Test
public void getOlderReceiptDataViaFallback() {
HashMapDB hashMapDB = new HashMapDB();
ReceiptStore storeV1 = new ReceiptStoreImpl(hashMapDB);
ReceiptStore storeV2 = new ReceiptStoreImplV2(hashMapDB);
TransactionReceipt receipt = createReceipt();
byte[] blockHash = Hex.decode("0102030405060708");
storeV1.add(blockHash, 42, receipt);
TransactionInfo result = storeV2.get(receipt.getTransaction().getHash().getBytes(), blockHash).orElse(null);
Assert.assertNotNull(result);
Assert.assertNotNull(result.getBlockHash());
Assert.assertArrayEquals(blockHash, result.getBlockHash());
Assert.assertEquals(42, result.getIndex());
Assert.assertArrayEquals(receipt.getEncoded(), result.getReceipt().getEncoded());
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class ReceiptStoreImplFallbackTest method ignoreNewerReceiptDataByInitialImpl.
@Test
public void ignoreNewerReceiptDataByInitialImpl() {
HashMapDB hashMapDB = new HashMapDB();
ReceiptStore storeV1 = new ReceiptStoreImpl(hashMapDB);
ReceiptStore storeV2 = new ReceiptStoreImplV2(hashMapDB);
TransactionReceipt receipt = createReceipt();
byte[] blockHash = Hex.decode("0102030405060708");
storeV2.add(blockHash, 42, receipt);
TransactionInfo result = storeV1.get(receipt.getTransaction().getHash().getBytes(), blockHash).orElse(null);
Assert.assertNull(result);
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class ReceiptStoreImplTest method addTwoTransactionsAndGetLastTransaction.
@Test
public void addTwoTransactionsAndGetLastTransaction() {
TransactionReceipt receipt0 = createReceipt();
byte[] blockHash0 = Hex.decode("010203040506070809");
store.add(blockHash0, 3, receipt0);
TransactionReceipt receipt = createReceipt();
byte[] blockHash = Hex.decode("0102030405060708");
store.add(blockHash, 42, receipt);
TransactionInfo result = store.get(receipt.getTransaction().getHash().getBytes(), blockHash).orElse(null);
Assert.assertNotNull(result);
Assert.assertNotNull(result.getBlockHash());
Assert.assertArrayEquals(blockHash, result.getBlockHash());
Assert.assertEquals(42, result.getIndex());
Assert.assertArrayEquals(receipt.getEncoded(), result.getReceipt().getEncoded());
}
use of org.ethereum.core.TransactionReceipt in project rskj by rsksmart.
the class ReceiptStoreImplTest method addTwoTransactionsAndGetAllTransactions.
@Test
public void addTwoTransactionsAndGetAllTransactions() {
TransactionReceipt receipt0 = createReceipt();
byte[] blockHash0 = Hex.decode("010203040506070809");
store.add(blockHash0, 3, receipt0);
TransactionReceipt receipt = createReceipt();
byte[] blockHash = Hex.decode("0102030405060708");
store.add(blockHash, 42, receipt);
Optional<TransactionInfo> txInfo0 = store.get(receipt.getTransaction().getHash().getBytes(), blockHash0);
Assert.assertTrue(txInfo0.isPresent());
Assert.assertNotNull(txInfo0.get().getBlockHash());
Assert.assertArrayEquals(blockHash0, txInfo0.get().getBlockHash());
Assert.assertEquals(3, txInfo0.get().getIndex());
Assert.assertArrayEquals(receipt0.getEncoded(), txInfo0.get().getReceipt().getEncoded());
Optional<TransactionInfo> txInfo = store.get(receipt.getTransaction().getHash().getBytes(), blockHash);
Assert.assertTrue(txInfo.isPresent());
Assert.assertNotNull(txInfo.get().getBlockHash());
Assert.assertArrayEquals(blockHash, txInfo.get().getBlockHash());
Assert.assertEquals(42, txInfo.get().getIndex());
Assert.assertArrayEquals(receipt.getEncoded(), txInfo.get().getReceipt().getEncoded());
}
Aggregations