diff --git a/.env.sample b/.env.sample index 120fdbf..472ea57 100644 --- a/.env.sample +++ b/.env.sample @@ -166,6 +166,9 @@ PAYMENT_LOOP_SECONDS=60 #IGNORE_UTXOS_BELOW_SATS=1001 +# Do not create outputs below this amount to regular funds addresses - instead just merge their value into the previous output. +#MIN_REGULAR_FUNDS_OUTPUT_SIZE_SATS=500000 + ## Whether to split large chunk of special sats, if it contains another special sats (subset) #SPLIT_SPECIAL_RANGES=1 diff --git a/index.js b/index.js index d83f974..72c775d 100644 --- a/index.js +++ b/index.js @@ -212,6 +212,7 @@ async function run() { const scan_request_ids = [] const exchange_address = await exchange.get_deposit_address() const rare_sat_address = process.env.RARE_SAT_ADDRESS + const min_regular_funds_output_size_sats_env = parseInt(process.env.MIN_REGULAR_FUNDS_OUTPUT_SIZE_SATS || 0) for (const utxo of utxos) { console.log(`Preparing to scan: ${utxo}`) if (!rescanned_utxos.has(utxo) && !process.env.ONLY_NOTIFY_ON_SATS) { @@ -224,6 +225,7 @@ async function run() { regular_funds_addresses: [exchange_address], special_sat_addresses: [rare_sat_address], extraction_fee_rate: fee_rate, + min_regular_funds_output_size_sats: min_regular_funds_output_size_sats_env, } const { excluded_tags, @@ -234,6 +236,7 @@ async function run() { split_config, withdraw_config, split_special_ranges, + min_regular_funds_output_size_sats, } = get_scan_config({ fee_rate, utxo }) if (excluded_tags) { console.log(`Using excluded tags: ${excluded_tags}`) @@ -286,6 +289,9 @@ async function run() { if (split_special_ranges) { request_body.split_special_ranges = split_special_ranges } + if (min_regular_funds_output_size_sats || min_regular_funds_output_size_sats === 0) { + request_body.min_regular_funds_output_size_sats = min_regular_funds_output_size_sats + } const scan_request = await post_scan_request(request_body) if (!scan_request.id) { throw new Error('Failed to initiate scan request')