Search in sources :

Example 6 with TransactionCapsule

use of org.tron.core.capsule.TransactionCapsule in project java-tron by tronprotocol.

the class TransactionStoreTest method init.

@BeforeClass
public static void init() {
    Args.setParam(new String[] { "-d", dbPath, "-w" }, Configuration.getByPath(Constant.TEST_CONF));
    transactionStore = TransactionStore.create(dbPath);
    TransactionCapsule transactionCapsule = new TransactionCapsule(key, value);
    transactionStore.put(data, transactionCapsule);
}
Also used : TransactionCapsule(org.tron.core.capsule.TransactionCapsule) BeforeClass(org.junit.BeforeClass)

Example 7 with TransactionCapsule

use of org.tron.core.capsule.TransactionCapsule in project java-tron by tronprotocol.

the class TransactionStoreTest method findTransactionByHash.

@Test
public void findTransactionByHash() {
    // test findTransactionByHash method
    TransactionCapsule transactionCapsuleByHash = new TransactionCapsule(transactionStore.findTransactionByHash(data));
    Assert.assertEquals(key, ByteArray.toHexString(transactionCapsuleByHash.getInstance().getRawData().getVoutList().get(0).getPubKeyHash().toByteArray()));
    Assert.assertEquals(value, transactionCapsuleByHash.getInstance().getRawData().getVoutList().get(0).getValue());
}
Also used : TransactionCapsule(org.tron.core.capsule.TransactionCapsule) Test(org.junit.Test)

Aggregations

TransactionCapsule (org.tron.core.capsule.TransactionCapsule)7 ContractExeException (org.tron.core.exception.ContractExeException)3 ContractValidateException (org.tron.core.exception.ContractValidateException)3 Test (org.junit.Test)2 BlockCapsule (org.tron.core.capsule.BlockCapsule)2 RevokingStoreIllegalStateException (org.tron.core.exception.RevokingStoreIllegalStateException)2 ValidateSignatureException (org.tron.core.exception.ValidateSignatureException)2 ByteString (com.google.protobuf.ByteString)1 Iterator (java.util.Iterator)1 BeforeClass (org.junit.BeforeClass)1 NumberMessage (org.tron.api.GrpcAPI.NumberMessage)1 Message (org.tron.common.overlay.message.Message)1 Dialog (org.tron.core.db.AbstractRevokingStore.Dialog)1 UnLinkedBlockException (org.tron.core.exception.UnLinkedBlockException)1 TransactionMessage (org.tron.core.net.message.TransactionMessage)1