Search in sources :

Example 1 with LedgerTransactionData

use of com.jd.blockchain.ledger.core.LedgerTransactionData in project jdchain-core by blockchain-jd-com.

the class LedgerTransactionDataTest method initLedgerTransactionImpl.

@Before
public void initLedgerTransactionImpl() throws Exception {
    DataContractRegistry.register(LedgerTransaction.class);
    DataContractRegistry.register(LedgerDataSnapshot.class);
    DataContractRegistry.register(HashObject.class);
    DataContractRegistry.register(DataAccountKVSetOperation.class);
    txRequest = initTxRequestMessage(ClassicAlgorithm.SHA256);
    long blockHeight = 9986L;
    TransactionStagedSnapshot snapshot = initTransactionStagedSnapshot();
    data = new TransactionResultData(txRequest.getTransactionHash(), blockHeight, TransactionState.SUCCESS, snapshot, null);
    HashDigest hash = ClassicCryptoService.SHA256.hash("zhangsan".getBytes());
    HashDigest adminAccountHash = ClassicCryptoService.SHA256.hash("lisi".getBytes());
    HashDigest userAccountSetHash = ClassicCryptoService.SHA256.hash("wangwu".getBytes());
    HashDigest dataAccountSetHash = ClassicCryptoService.SHA256.hash("zhaoliu".getBytes());
    HashDigest contractAccountSetHash = ClassicCryptoService.SHA256.hash("sunqi".getBytes());
    snapshot.setAdminAccountHash(adminAccountHash);
    snapshot.setUserAccountSetHash(userAccountSetHash);
    snapshot.setDataAccountSetHash(dataAccountSetHash);
    snapshot.setContractAccountSetHash(contractAccountSetHash);
    ledgerTransactionData = new LedgerTransactionData(txRequest, data);
}
Also used : LedgerTransactionData(com.jd.blockchain.ledger.core.LedgerTransactionData) TransactionStagedSnapshot(com.jd.blockchain.ledger.core.TransactionStagedSnapshot) HashDigest(com.jd.blockchain.crypto.HashDigest) TransactionResultData(com.jd.blockchain.ledger.core.TransactionResultData) Before(org.junit.Before)

Aggregations

HashDigest (com.jd.blockchain.crypto.HashDigest)1 LedgerTransactionData (com.jd.blockchain.ledger.core.LedgerTransactionData)1 TransactionResultData (com.jd.blockchain.ledger.core.TransactionResultData)1 TransactionStagedSnapshot (com.jd.blockchain.ledger.core.TransactionStagedSnapshot)1 Before (org.junit.Before)1