Search in sources :

Example 1 with OperationResult

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

the class TransactionDecorator method initOperationResults.

private OperationResult[] initOperationResults(OperationResult[] opResults) {
    OperationResult[] operationResults = null;
    if (opResults != null && opResults.length > 0) {
        operationResults = new OperationResult[opResults.length];
        for (int i = 0; i < opResults.length; i++) {
            OperationResult opResult = opResults[i];
            TypedValue value = TypedValue.wrap(opResult.getResult());
            operationResults[i] = new OperationResultData(opResult.getIndex(), value);
        }
    }
    return operationResults;
}
Also used : OperationResult(com.jd.blockchain.ledger.OperationResult) OperationResultData(com.jd.blockchain.ledger.OperationResultData) TypedValue(com.jd.blockchain.ledger.TypedValue)

Example 2 with OperationResult

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

the class TransactionSetTest method buildTransactionResult.

private TransactionResult buildTransactionResult(TransactionRequest txReq, long blockHeight, TransactionState txState) {
    TransactionStagedSnapshot txSnapshot = new TransactionStagedSnapshot();
    HashDigest adminAccountHash = LedgerTestUtils.generateRandomHash();
    txSnapshot.setAdminAccountHash(adminAccountHash);
    HashDigest userAccountSetHash = LedgerTestUtils.generateRandomHash();
    txSnapshot.setUserAccountSetHash(userAccountSetHash);
    HashDigest dataAccountSetHash = LedgerTestUtils.generateRandomHash();
    txSnapshot.setDataAccountSetHash(dataAccountSetHash);
    HashDigest contractAccountSetHash = LedgerTestUtils.generateRandomHash();
    txSnapshot.setContractAccountSetHash(contractAccountSetHash);
    OperationResult[] opResults = new OperationResult[0];
    TransactionResultData txResult = new TransactionResultData(txReq.getTransactionHash(), blockHeight, txState, txSnapshot, opResults);
    return txResult;
}
Also used : TransactionStagedSnapshot(com.jd.blockchain.ledger.core.TransactionStagedSnapshot) HashDigest(com.jd.blockchain.crypto.HashDigest) OperationResult(com.jd.blockchain.ledger.OperationResult) TransactionResultData(com.jd.blockchain.ledger.core.TransactionResultData)

Aggregations

OperationResult (com.jd.blockchain.ledger.OperationResult)2 HashDigest (com.jd.blockchain.crypto.HashDigest)1 OperationResultData (com.jd.blockchain.ledger.OperationResultData)1 TypedValue (com.jd.blockchain.ledger.TypedValue)1 TransactionResultData (com.jd.blockchain.ledger.core.TransactionResultData)1 TransactionStagedSnapshot (com.jd.blockchain.ledger.core.TransactionStagedSnapshot)1