This cron script generates electrum addresses well past the max count when the hardcron setting is enabled. My wp_bwwc_btc_addresses had 300+ addresses after a day when I setup the cron to be run every 5 minutes. The culprit seems to be this query:
// NULL == not found
// Retrieve:
// 'unused' - with fresh zero balances
// 'assigned' - expired, with fresh zero balances (if 'reuse_expired_addresses' is true)
//
// Hence - any returned address will be clean to use.
$query =
"SELECT COUNT(*) as `total_unused_addresses` FROM `$btc_addresses_table_name`
WHERE `origin_id`='$origin_id'
AND `total_received_funds`='0'
AND (('$current_time' - `received_funds_checked_at`) < '$funds_received_value_expires_in_secs')
AND (`status`='unused' $reuse_expired_addresses_query_part)
";
AND (('$current_time' - `received_funds_checked_at`) < '$funds_received_value_expires_in_secs')
Since the received_funds_checked_at field never gets updated for unused addresses after they're generated, the query doesn't count them, so a new address gets generated on each run.