• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

bernardladenthin / BitcoinAddressFinder / #246

08 Apr 2025 06:29AM UTC coverage: 59.356% (-6.0%) from 65.404%
#246

push

bernardladenthin
Add timeout. Extract interruptAfterDelay. Ignore testRoundtrip_configurationsGiven_lmdbCreatedExportedAndRunFindSecretsFile for now.

1050 of 1769 relevant lines covered (59.36%)

0.59 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/main/java/net/ladenthin/bitcoinaddressfinder/LMDBToAddressFile.java
1
// @formatter:off
2
/**
3
 * Copyright 2020 Bernard Ladenthin bernard.ladenthin@gmail.com
4
 *
5
 * Licensed under the Apache License, Version 2.0 (the "License");
6
 * you may not use this file except in compliance with the License.
7
 * You may obtain a copy of the License at
8
 *
9
 *    http://www.apache.org/licenses/LICENSE-2.0
10
 *
11
 * Unless required by applicable law or agreed to in writing, software
12
 * distributed under the License is distributed on an "AS IS" BASIS,
13
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
 * See the License for the specific language governing permissions and
15
 * limitations under the License.
16
 *
17
 */
18
// @formatter:on
19
package net.ladenthin.bitcoinaddressfinder;
20

21
import net.ladenthin.bitcoinaddressfinder.persistence.PersistenceUtils;
22
import net.ladenthin.bitcoinaddressfinder.persistence.lmdb.LMDBPersistence;
23
import org.bitcoinj.core.NetworkParameters;
24
import org.slf4j.Logger;
25
import org.slf4j.LoggerFactory;
26

27
import java.io.File;
28
import java.io.IOException;
29
import java.util.concurrent.atomic.AtomicBoolean;
30
import net.ladenthin.bitcoinaddressfinder.configuration.CLMDBToAddressFile;
31

32
public class LMDBToAddressFile implements Runnable, Interruptable {
33

34
    private final Logger logger = LoggerFactory.getLogger(LMDBToAddressFile.class);
×
35

36
    private final CLMDBToAddressFile lmdbToAddressFile;
37

38
    private LMDBPersistence persistence;
39
    
40
    private final AtomicBoolean shouldRun = new AtomicBoolean(true);
×
41

42
    public LMDBToAddressFile(CLMDBToAddressFile lmdbToAddressFile) {
×
43
        this.lmdbToAddressFile = lmdbToAddressFile;
×
44
    }
×
45

46
    @Override
47
    public void run() {
48
        final NetworkParameters networkParameters = new NetworkParameterFactory().getOrCreate();
×
49
        
50
        PersistenceUtils persistenceUtils = new PersistenceUtils(networkParameters);
×
51
        persistence = new LMDBPersistence(lmdbToAddressFile.lmdbConfigurationReadOnly, persistenceUtils);
×
52
        persistence.init();
×
53
        try {
54
            logger.info("writeAllAmounts ...");
×
55
            File addressesFile = new File(lmdbToAddressFile.addressesFile);
×
56
            // delete before write all addresses
57
            addressesFile.delete();
×
58
            persistence.writeAllAmountsToAddressFile(addressesFile, lmdbToAddressFile.addressFileOutputFormat, shouldRun);
×
59
            logger.info("writeAllAmounts done");
×
60
        } catch (IOException e) {
×
61
            throw new RuntimeException(e);
×
62
        } finally {
63
            persistence.close();
×
64
        }
65
    }
×
66

67
    @Override
68
    public void interrupt() {
69
        shouldRun.set(false);
×
70
    }
×
71
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc