Skip to content

Commit

Permalink
Add min_regular_funds_output_size_sats (#98)
Browse files Browse the repository at this point in the history
  • Loading branch information
dannydeezy authored May 3, 2024
1 parent 000df8a commit 4d5b860
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions .env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand All @@ -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,
Expand All @@ -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}`)
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 4d5b860

Please sign in to comment.