<commit_before>
/**
The walletConnector

@class walletConnector
@constructor
*/

/**
Contains all wallet contracts

@property contracts
*/
contracts = {};


/**
Config for the ethereum connector

@property config
*/
ethereumConfig = {
    /**
    Number of blocks to rollback, from the last stable point.

    @property ethereumConfig.rollBackBy
    */
    rollBackBy: 500,
    /**
    Number of blocks to confirm a wallet

    @property ethereumConfig.requiredConfirmations
    */
    requiredConfirmations: 12,
    /**
    The default daily limit used for simple accounts

    @property ethereumConfig.dailyLimitDefault
    */
    dailyLimitDefault: '100000000000000000000000000'
};


/**
Connects to a node and setup all the filters for the accounts.

@method connectToNode
*/
connectToNode = function(){

    console.log('Connect to node...');

    // set providor
    web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545")); //8545 8080 10.10.42.116


    // UPDATE normal accounts
    web3.eth.getAccounts(function(e, accounts){
        if(!e) {
            _.each(Accounts.find({type: 'account'}).fetch(), function(account){
                if(!_.contains(accounts, account.address)) {
                    Accounts.remove(account._id);
                } else {
                    web3.eth.getBalance(account.address, function(e, balance){
                        if(!e) {
                            Accounts.update(account._id, {$set: {
                                balance: balance.toString(10)
                            }});
                        }
                    });
                }

                accounts = _.without(accounts, account.address);
            });
            // ADD missing accounts
            _.each(accounts, function(address){
                web3.eth.getBalance(address, function(e, balance){
                    if(!e) {
                        Accounts.insert({
                            type: 'account',
                            address: address,
                            balance: balance.toString(10),
                            name: (address === web3.eth.coinbase) ? 'Coinbase' : address
                        });
                    }
                });
            });
        }
    });


    observeLatestBlocks();

    observeAccounts();

    observeTransactions();

    observePendingConfirmations();

};

<commit_msg>made accounts request sync, so that it throws error on no connetion<commit_after>
/**
The walletConnector

@class walletConnector
@constructor
*/

/**
Contains all wallet contracts

@property contracts
*/
contracts = {};


/**
Config for the ethereum connector

@property config
*/
ethereumConfig = {
    /**
    Number of blocks to rollback, from the last stable point.

    @property ethereumConfig.rollBackBy
    */
    rollBackBy: 500,
    /**
    Number of blocks to confirm a wallet

    @property ethereumConfig.requiredConfirmations
    */
    requiredConfirmations: 12,
    /**
    The default daily limit used for simple accounts

    @property ethereumConfig.dailyLimitDefault
    */
    dailyLimitDefault: '100000000000000000000000000'
};


/**
Connects to a node and setup all the filters for the accounts.

@method connectToNode
*/
connectToNode = function(){

    console.log('Connect to node...');

    // set providor
    web3.setProvider(new web3.providers.HttpProvider("http://localhost:8545")); //8545 8080 10.10.42.116


    // UPDATE normal accounts (only sync request, to throw error on no connection)
    var accounts = web3.eth.accounts;
    _.each(Accounts.find({type: 'account'}).fetch(), function(account){
        if(!_.contains(accounts, account.address)) {
            Accounts.remove(account._id);
        } else {
            web3.eth.getBalance(account.address, function(e, balance){
                if(!e) {
                    Accounts.update(account._id, {$set: {
                        balance: balance.toString(10)
                    }});
                }
            });
        }

        accounts = _.without(accounts, account.address);
    });
    // ADD missing accounts
    _.each(accounts, function(address){
        web3.eth.getBalance(address, function(e, balance){
            if(!e) {
                Accounts.insert({
                    type: 'account',
                    address: address,
                    balance: balance.toString(10),
                    name: (address === web3.eth.coinbase) ? 'Coinbase' : address
                });
            }
        });
    });


    observeLatestBlocks();

    observeAccounts();

    observeTransactions();

    observePendingConfirmations();

};


{'fraction_non_alphanumeric': 0.11213550600343053, 'fraction_numerical': 0.027015437392795882, 'mean_word_length': 1.8255602665051485, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 2, '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': '7577630', 'n_tokens_mistral': 1342, 'n_tokens_neox': 1207, 'n_words': 286}