Search in sources :

Example 66 with Result

use of io.nuls.kernel.model.Result in project nuls by nuls-io.

the class AccountServiceImpl method removeMultiSigAccount.

/**
 * 从数据库中删除该账户
 */
@Override
public Result<Boolean> removeMultiSigAccount(String address) {
    try {
        Address addressObj = Address.fromHashs(address);
        Result result = this.multiSigAccountStorageService.getAccount(addressObj);
        if (result.isFailed() || result.getData() == null) {
            return Result.getFailed(AccountErrorCode.ACCOUNT_NOT_EXIST);
        }
        return this.multiSigAccountStorageService.removeAccount(addressObj);
    } catch (Exception e) {
        Log.error(e);
        return Result.getFailed();
    }
}
Also used : Address(io.nuls.kernel.model.Address) CryptoException(io.nuls.core.tools.crypto.Exception.CryptoException) NulsRuntimeException(io.nuls.kernel.exception.NulsRuntimeException) SignatureException(java.security.SignatureException) IOException(java.io.IOException) NulsException(io.nuls.kernel.exception.NulsException) Result(io.nuls.kernel.model.Result)

Example 67 with Result

use of io.nuls.kernel.model.Result in project nuls by nuls-io.

the class GetBlocksByHashHandler method sendBlock.

private void sendBlock(Block block, Node fromNode) {
    BlockMessage blockMessage = new BlockMessage();
    blockMessage.setMsgBody(block);
    Result result = this.messageBusService.sendToNode(blockMessage, fromNode, true);
    if (result.isFailed()) {
        Log.warn("send block failed:" + fromNode.getId() + ",height:" + block.getHeader().getHeight());
    }
}
Also used : Result(io.nuls.kernel.model.Result)

Example 68 with Result

use of io.nuls.kernel.model.Result in project nuls by nuls-io.

the class GetBlocksHashHandler method sendResponse.

private void sendResponse(BlockHashResponse response, Node fromNode) {
    BlocksHashMessage event = new BlocksHashMessage();
    event.setMsgBody(response);
    Result result = messageBusService.sendToNode(event, fromNode, true);
    if (result.isFailed()) {
        BlockLog.debug("send block hashes to " + fromNode.getId() + " failed!");
    }
}
Also used : BlocksHashMessage(io.nuls.protocol.message.BlocksHashMessage) GetBlocksHashMessage(io.nuls.protocol.message.GetBlocksHashMessage) Result(io.nuls.kernel.model.Result)

Example 69 with Result

use of io.nuls.kernel.model.Result in project nuls by nuls-io.

the class GetBlockHandler method sendBlock.

private void sendBlock(Block block, Node fromNode) {
    BlockMessage blockMessage = new BlockMessage();
    blockMessage.setMsgBody(block);
    Result result = this.messageBusService.sendToNode(blockMessage, fromNode, true);
    if (result.isFailed()) {
        Log.warn("send block failed:" + fromNode.getId() + ",height:" + block.getHeader().getHeight());
    }
}
Also used : BlockMessage(io.nuls.protocol.message.BlockMessage) GetBlockMessage(io.nuls.protocol.message.GetBlockMessage) Result(io.nuls.kernel.model.Result)

Example 70 with Result

use of io.nuls.kernel.model.Result in project nuls by nuls-io.

the class GetBlocksByHeightHandler method sendBlock.

private void sendBlock(Block block, Node fromNode) {
    BlockMessage blockMessage = new BlockMessage();
    blockMessage.setMsgBody(block);
    Result result = this.messageBusService.sendToNode(blockMessage, fromNode, true);
    if (result.isFailed()) {
        Log.warn("send block failed:" + fromNode.getId() + ",height:" + block.getHeader().getHeight());
    }
}
Also used : Result(io.nuls.kernel.model.Result)

Aggregations

Result (io.nuls.kernel.model.Result)70 NulsException (io.nuls.kernel.exception.NulsException)16 IOException (java.io.IOException)15 NulsRuntimeException (io.nuls.kernel.exception.NulsRuntimeException)12 ValidateResult (io.nuls.kernel.validate.ValidateResult)11 AccountPo (io.nuls.account.storage.po.AccountPo)7 RpcClientResult (io.nuls.kernel.model.RpcClientResult)7 ArrayList (java.util.ArrayList)7 Account (io.nuls.account.model.Account)6 NulsDigestData (io.nuls.kernel.model.NulsDigestData)5 Test (org.junit.Test)5 CryptoException (io.nuls.core.tools.crypto.Exception.CryptoException)4 BatchOperation (io.nuls.db.service.BatchOperation)4 Address (io.nuls.kernel.model.Address)4 Block (io.nuls.kernel.model.Block)4 BlockHeader (io.nuls.kernel.model.BlockHeader)4 Transaction (io.nuls.kernel.model.Transaction)4 Node (io.nuls.network.model.Node)4 NotFound (io.nuls.protocol.model.NotFound)4 ApiOperation (io.swagger.annotations.ApiOperation)4