Search in sources :

Example 1 with AionTxExecSummary

use of org.aion.zero.types.AionTxExecSummary in project aion by aionnetwork.

the class AionTxExecSummaryTest method testRLPEncoding.

@Test
public void testRLPEncoding() {
    AionTransaction mockTx = new AionTransaction(BigInteger.ONE.toByteArray(), defaultAddress, defaultAddress, BigInteger.ONE.toByteArray(), HashUtil.EMPTY_DATA_HASH, 1L, 1L);
    AionTxReceipt txReceipt = new AionTxReceipt(HashUtil.EMPTY_TRIE_HASH, new Bloom(), Collections.EMPTY_LIST);
    txReceipt.setNrgUsed(1);
    txReceipt.setTransaction(mockTx);
    AionTxExecSummary.Builder builder = AionTxExecSummary.builderFor(txReceipt);
    builder.markAsFailed().result(new byte[0]);
    AionTxExecSummary summary = builder.build();
    byte[] encodedSummary = summary.getEncoded();
    AionTxExecSummary newSummary = new AionTxExecSummary(encodedSummary);
    newSummary.getReceipt().setTransaction(mockTx);
    assertThat(newSummary.getFee()).isEqualTo(BigInteger.ONE);
}
Also used : Bloom(org.aion.mcf.vm.types.Bloom) AionTxExecSummary(org.aion.zero.types.AionTxExecSummary) AionTransaction(org.aion.zero.types.AionTransaction) AionTxReceipt(org.aion.zero.types.AionTxReceipt) Test(org.junit.Test)

Aggregations

Bloom (org.aion.mcf.vm.types.Bloom)1 AionTransaction (org.aion.zero.types.AionTransaction)1 AionTxExecSummary (org.aion.zero.types.AionTxExecSummary)1 AionTxReceipt (org.aion.zero.types.AionTxReceipt)1 Test (org.junit.Test)1