use of io.nuls.kernel.model.Result in project nuls by nuls-io.
the class AgentStorageServiceImpl method save.
@Override
public boolean save(AgentPo agentPo) {
if (agentPo == null || agentPo.getHash() == null) {
return false;
}
byte[] hash;
try {
hash = agentPo.getHash().serialize();
} catch (IOException e) {
Log.error(e);
throw new NulsRuntimeException(e);
}
Result result = null;
try {
result = dbService.put(ConsensusStorageConstant.DB_NAME_CONSENSUS_AGENT, hash, agentPo.serialize());
} catch (IOException e) {
Log.error(e);
return false;
}
return result.isSuccess();
}
use of io.nuls.kernel.model.Result in project nuls by nuls-io.
the class TransactionCacheStorageServiceImpl method putTx.
@Override
public boolean putTx(Transaction tx) {
if (tx == null) {
return false;
}
byte[] txHashBytes = null;
try {
txHashBytes = tx.getHash().serialize();
} catch (IOException e) {
Log.error(e);
return false;
}
// 保存交易
Result result = null;
try {
result = dbService.put(TRANSACTION_CACHE_KEY_NAME, txHashBytes, tx.serialize());
} catch (IOException e) {
Log.error(e);
return false;
}
// result = dbService.put(TRANSACTION_CACHE_KEY_NAME, LAST_KEY, lastIndexBytes);
return result.isSuccess();
}
use of io.nuls.kernel.model.Result in project nuls by nuls-io.
the class UtxoAccountsStorageServiceImpl method saveHadSynBlockHeight.
@Override
public Result saveHadSynBlockHeight(long height) {
UtxoAccountsSynInfo utxoAccountsSynInfo = new UtxoAccountsSynInfo(height);
utxoAccountsSynInfo.setUpdateTimeMillion(System.currentTimeMillis());
Result result = dbService.putModel(UtxoAccountsStorageConstant.DB_NAME_UTXO_ACCOUNTS_BLOCK_CACHE, UtxoAccountsStorageConstant.DB_NAME_UTXO_ACCOUNTS_BLOCK_SYN_KEY, utxoAccountsSynInfo);
return result;
}
use of io.nuls.kernel.model.Result in project nuls by nuls-io.
the class RegisterAgentProcessTest method testOnRollback.
@Test
public void testOnRollback() {
assertNotNull(tx);
assertNotNull(registerAgentProcess);
testOnCommit();
Result result = registerAgentProcess.onRollback(tx, null);
assert (result.isSuccess());
}
use of io.nuls.kernel.model.Result in project nuls by nuls-io.
the class DepositStorageServiceImpl method save.
@Override
public boolean save(DepositPo depositPo) {
if (depositPo == null || depositPo.getTxHash() == null) {
return false;
}
byte[] hash;
try {
hash = depositPo.getTxHash().serialize();
} catch (IOException e) {
Log.error(e);
throw new NulsRuntimeException(e);
}
Result result = null;
try {
result = dbService.put(ConsensusStorageConstant.DB_NAME_CONSENSUS_DEPOSIT, hash, depositPo.serialize());
} catch (IOException e) {
Log.error(e);
return false;
}
return result.isSuccess();
}
Aggregations