sc/deposit.js
function hasInvalidUnitsFromHistory(conn, address, cb){
    var conn = conn || db;
    if(!validationUtils.isNonemptyString(address))
        return cb("param address is null or empty string");
    if(!validationUtils.isValidAddress(address))
        return cb("param address is not a valid address");
    conn.query(
        "SELECT address FROM units JOIN unit_authors USING(unit)  \n\
        WHERE is_stable=1 AND sequence!='good' AND address=?", 
        [address],
        function(rows){
            cb(null, rows.length > 0 ?  true : false);
        }
    );
}
function hasInvalidUnitsFromHistory(conn, address, cb){
    var conn = conn || db;
    if(!validationUtils.isNonemptyString(address))
        return cb("param address is null or empty string");
    if(!validationUtils.isValidAddress(address))
        return cb("param address is not a valid address");
    conn.query(
        "SELECT address FROM units JOIN unit_authors USING(unit)  \n\
        WHERE is_stable=1 AND sequence!='good' AND address=?", 
        [address],
        function(rows){
            cb(null, rows.length > 0 ?  true : false);
        }
    );
}
function hasInvalidUnitsFromHistory ( conn , address , cb ) { var conn = conn || db ; if ( ! validationUtils . isNonemptyString ( address ) ) return cb ( "param address is null or empty string" ) ; if ( ! validationUtils . isValidAddress ( address ) ) return cb ( "param address is not a valid address" ) ; conn . query ( "SELECT address FROM units JOIN unit_authors USING(unit)  \n\
        WHERE is_stable=1 AND sequence!='good' AND address=?" , [ address ] , function ( rows ) { cb ( null , rows . length > 0 ? true : false ) ; } ) ; }
Check if an address has sent invalid unit.

@param	{obj}	    conn      if conn is null, use db query, otherwise use conn.
@param	{string}	address
@param	{function}	cb( err, hasInvalidUnits ) callback function
If there's error, err is the error message and hasInvalidUnits is null.
If there's no error and there's invalid units, then hasInvalidUnits is true, otherwise false.
Check if an address has sent invalid unit .