<commit_before>package org.ethereum.net.submit;

import org.ethereum.core.Transaction;
import org.ethereum.core.Wallet;
import org.ethereum.manager.WorldManager;
import org.ethereum.net.server.ChannelManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Callable;

import static java.lang.Thread.sleep;

/**
 * @author <NAME>
 * @since 23.05.2014
 */
public class TransactionTask implements Callable<Transaction> {

    private static final Logger logger = LoggerFactory.getLogger(TransactionTask.class);

    private final Transaction tx;
    private final WorldManager worldManager;

    public TransactionTask(Transaction tx, WorldManager worldManager) {
        this.tx = tx;
        this.worldManager = worldManager;
    }

    @Override
    public Transaction call() throws Exception {

        try {
            logger.info("Call() tx: {}", tx.toString());

            Wallet wallet = worldManager.getWallet();
            ChannelManager channelManager = worldManager.getChannelManager();

            WalletTransaction walletTransaction = wallet.addByWalletTransaction(tx);
            channelManager.sendTransaction(tx);

            while (walletTransaction.getApproved() < 1) {
                sleep(10);
            }
            logger.info("return approved: {}", walletTransaction.getApproved());
        } catch (Throwable th) {
            logger.warn("Exception caught: {}", th);
            worldManager.getWallet().removeTransaction(tx);
        }
        return null;
    }
}<commit_msg>Cancel transaction approve by the clone transaction.<commit_after>package org.ethereum.net.submit;

import org.ethereum.core.Transaction;
import org.ethereum.core.Wallet;
import org.ethereum.manager.WorldManager;
import org.ethereum.net.server.ChannelManager;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.Callable;

import static java.lang.Thread.sleep;

/**
 * @author <NAME>
 * @since 23.05.2014
 */
public class TransactionTask implements Callable<Transaction> {

    private static final Logger logger = LoggerFactory.getLogger("net");

    private final Transaction tx;
    private final WorldManager worldManager;

    public TransactionTask(Transaction tx, WorldManager worldManager) {
        this.tx = tx;
        this.worldManager = worldManager;
    }

    @Override
    public Transaction call() throws Exception {

        try {
            logger.info("submit tx: {}", tx.toString());
            ChannelManager channelManager = worldManager.getChannelManager();
            channelManager.sendTransaction(tx);
            return tx;

        } catch (Throwable th) {
            logger.warn("Exception caught: {}", th);
        }
        return null;
    }
}
{'fraction_non_alphanumeric': 0.10198915009041591, 'fraction_numerical': 0.008318264014466547, 'mean_word_length': 3.043859649122807, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '260471', 'n_tokens_mistral': 751, 'n_tokens_neox': 730, 'n_words': 168}