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);
}
Aggregations