Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add min_regular_funds_output_size_sats #98

Merged
merged 1 commit into from
May 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@
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 @@
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 @@
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 @@
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 Expand Up @@ -369,7 +375,7 @@
await initNotifications()
await init_version_check(process.env.VERSION_CHECK_INTERVAL)
await init_wallet()
while (true) {

Check warning on line 378 in index.js

View workflow job for this annotation

GitHub Actions / Test Coverage & Linting

Unexpected constant condition
await run().catch((err) => {
console.error(err)
})
Expand Down
Loading