Search in sources :

Example 61 with Address

use of org.aion.base.type.Address in project aion by aionnetwork.

the class AionTransactionTest method testClone.

@Test
public void testClone() {
    byte[] nonce = RandomUtils.nextBytes(16);
    Address to = Address.wrap(RandomUtils.nextBytes(32));
    byte[] value = RandomUtils.nextBytes(16);
    byte[] data = RandomUtils.nextBytes(64);
    long nrg = RandomUtils.nextLong(0, Long.MAX_VALUE);
    long nrgPrice = RandomUtils.nextLong(0, Long.MAX_VALUE);
    byte type = 1;
    AionTransaction tx = new AionTransaction(nonce, to, value, data, nrg, nrgPrice, type);
    tx.sign(ECKeyFac.inst().create());
    AionTransaction tx2 = tx.clone();
    assertTransactionEquals(tx, tx2);
}
Also used : Address(org.aion.base.type.Address) AionTransaction(org.aion.zero.types.AionTransaction) Test(org.junit.Test)

Aggregations

Address (org.aion.base.type.Address)61 Test (org.junit.Test)34 BigInteger (java.math.BigInteger)29 AionTransaction (org.aion.zero.types.AionTransaction)23 ITransaction (org.aion.base.type.ITransaction)14 ECKey (org.aion.crypto.ECKey)13 DataWord (org.aion.mcf.vm.types.DataWord)11 AionRepositoryImpl (org.aion.zero.impl.db.AionRepositoryImpl)10 TxPoolA0 (org.aion.txpool.zero.TxPoolA0)9 IRepositoryCache (org.aion.base.db.IRepositoryCache)8 HashMap (java.util.HashMap)6 ByteArrayWrapper (org.aion.base.util.ByteArrayWrapper)5 ByteUtil.toHexString (org.aion.base.util.ByteUtil.toHexString)5 AccountState (org.aion.mcf.core.AccountState)5 AionBlock (org.aion.zero.impl.types.AionBlock)5 ArrayList (java.util.ArrayList)4 ImportResult (org.aion.mcf.core.ImportResult)4 IByteArrayKeyValueDatabase (org.aion.base.db.IByteArrayKeyValueDatabase)3 IRepository (org.aion.base.db.IRepository)3 AionContractDetailsImpl (org.aion.zero.db.AionContractDetailsImpl)3