rename classes and executables from Bisq* to Haveno*

This commit is contained in:
woodser 2021-12-15 12:38:41 -05:00
parent 7c9c35b1b8
commit 1be8e53ee9
72 changed files with 235 additions and 234 deletions

View file

@ -32,7 +32,7 @@ import bisq.network.p2p.P2PService;
import bisq.common.UserThread;
import bisq.common.app.AppModule;
import bisq.common.config.BisqHelpFormatter;
import bisq.common.config.HavenoHelpFormatter;
import bisq.common.config.Config;
import bisq.common.config.ConfigException;
import bisq.common.handlers.ResultHandler;
@ -54,7 +54,7 @@ import lombok.extern.slf4j.Slf4j;
import javax.annotation.Nullable;
@Slf4j
public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSetup.BisqSetupListener, UncaughtExceptionHandler {
public abstract class HavenoExecutable implements GracefulShutDownHandler, HavenoSetup.BisqSetupListener, UncaughtExceptionHandler {
public static final int EXIT_SUCCESS = 0;
public static final int EXIT_FAILURE = 1;
@ -70,7 +70,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
private boolean isShutdownInProgress;
private boolean hasDowngraded;
public BisqExecutable(String fullName, String scriptName, String appName, String version) {
public HavenoExecutable(String fullName, String scriptName, String appName, String version) {
this.fullName = fullName;
this.scriptName = scriptName;
this.appName = appName;
@ -81,7 +81,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
try {
config = new Config(appName, Utilities.getUserDataDir(), args);
if (config.helpRequested) {
config.printHelp(System.out, new BisqHelpFormatter(fullName, scriptName, version));
config.printHelp(System.out, new HavenoHelpFormatter(fullName, scriptName, version));
System.exit(EXIT_SUCCESS);
}
} catch (ConfigException ex) {
@ -136,7 +136,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
setupGuice();
setupAvoidStandbyMode();
hasDowngraded = BisqSetup.hasDowngraded();
hasDowngraded = HavenoSetup.hasDowngraded();
if (hasDowngraded) {
// If user tried to downgrade we do not read the persisted data to avoid data corruption
// We call startApplication to enable UI to show popup. We prevent in BisqSetup to go further
@ -198,7 +198,7 @@ public abstract class BisqExecutable implements GracefulShutDownHandler, BisqSet
}
protected void runBisqSetup() {
BisqSetup bisqSetup = injector.getInstance(BisqSetup.class);
HavenoSetup bisqSetup = injector.getInstance(HavenoSetup.class);
bisqSetup.addBisqSetupListener(this);
bisqSetup.start();
}

View file

@ -33,7 +33,7 @@ import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class BisqHeadlessApp implements HeadlessApp {
public class HavenoHeadlessApp implements HeadlessApp {
@Getter
private static Runnable shutDownHandler;
@ -42,17 +42,17 @@ public class BisqHeadlessApp implements HeadlessApp {
@Setter
private GracefulShutDownHandler gracefulShutDownHandler;
private boolean shutDownRequested;
protected BisqSetup bisqSetup;
protected HavenoSetup bisqSetup;
private CorruptedStorageFileHandler corruptedStorageFileHandler;
private TradeManager tradeManager;
public BisqHeadlessApp() {
public HavenoHeadlessApp() {
shutDownHandler = this::stop;
}
public void startApplication() {
try {
bisqSetup = injector.getInstance(BisqSetup.class);
bisqSetup = injector.getInstance(HavenoSetup.class);
bisqSetup.addBisqSetupListener(this);
corruptedStorageFileHandler = injector.getInstance(CorruptedStorageFileHandler.class);

View file

@ -29,10 +29,10 @@ import java.util.concurrent.ThreadFactory;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class BisqHeadlessAppMain extends BisqExecutable {
public class HavenoHeadlessAppMain extends HavenoExecutable {
protected HeadlessApp headlessApp;
public BisqHeadlessAppMain() {
public HavenoHeadlessAppMain() {
super("Bisq Daemon", "bisqd", "Bisq", Version.VERSION);
}
@ -41,9 +41,9 @@ public class BisqHeadlessAppMain extends BisqExecutable {
// context class loader: reset it. In order to work around a bug in JavaFX 8u25
// and below, you must include the following code as the first line of your
// realMain method:
Thread.currentThread().setContextClassLoader(BisqHeadlessAppMain.class.getClassLoader());
Thread.currentThread().setContextClassLoader(HavenoHeadlessAppMain.class.getClassLoader());
new BisqHeadlessAppMain().execute(args);
new HavenoHeadlessAppMain().execute(args);
}
@Override
@ -68,7 +68,7 @@ public class BisqHeadlessAppMain extends BisqExecutable {
@Override
protected void launchApplication() {
headlessApp = new BisqHeadlessApp();
headlessApp = new HavenoHeadlessApp();
UserThread.execute(this::onApplicationLaunched);
}

View file

@ -100,7 +100,7 @@ import javax.annotation.Nullable;
@Slf4j
@Singleton
public class BisqSetup {
public class HavenoSetup {
private static final String VERSION_FILE_NAME = "version";
private static final String RESYNC_SPV_FILE_NAME = "resyncSpv";
@ -198,7 +198,7 @@ public class BisqSetup {
private final List<BisqSetupListener> bisqSetupListeners = new ArrayList<>();
@Inject
public BisqSetup(DomainInitialisation domainInitialisation,
public HavenoSetup(DomainInitialisation domainInitialisation,
P2PNetworkSetup p2PNetworkSetup,
WalletAppSetup walletAppSetup,
WalletsManager walletsManager,

View file

@ -22,7 +22,7 @@ import bisq.common.setup.UncaughtExceptionHandler;
import com.google.inject.Injector;
public interface HeadlessApp extends UncaughtExceptionHandler, BisqSetup.BisqSetupListener {
public interface HeadlessApp extends UncaughtExceptionHandler, HavenoSetup.BisqSetupListener {
void setGracefulShutDownHandler(GracefulShutDownHandler gracefulShutDownHandler);
void setInjector(Injector injector);

View file

@ -17,7 +17,7 @@
package bisq.core.app.misc;
import bisq.core.app.BisqExecutable;
import bisq.core.app.HavenoExecutable;
import bisq.core.btc.setup.WalletsSetup;
import bisq.core.btc.wallet.BtcWalletService;
import bisq.core.btc.wallet.XmrWalletService;
@ -53,7 +53,7 @@ import java.util.concurrent.TimeUnit;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public abstract class ExecutableForAppWithP2p extends BisqExecutable {
public abstract class ExecutableForAppWithP2p extends HavenoExecutable {
private static final long CHECK_MEMORY_PERIOD_SEC = 300;
private static final long CHECK_SHUTDOWN_SEC = TimeUnit.HOURS.toSeconds(1);
private static final long SHUTDOWN_INTERVAL = TimeUnit.HOURS.toMillis(24);
@ -93,7 +93,7 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
PersistenceManager.flushAllDataToDiskAtShutdown(() -> {
resultHandler.handleResult();
log.info("Graceful shutdown completed. Exiting now.");
UserThread.runAfter(() -> System.exit(BisqExecutable.EXIT_SUCCESS), 1);
UserThread.runAfter(() -> System.exit(HavenoExecutable.EXIT_SUCCESS), 1);
});
});
injector.getInstance(WalletsSetup.class).shutDown();
@ -105,13 +105,13 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
PersistenceManager.flushAllDataToDiskAtShutdown(() -> {
resultHandler.handleResult();
log.info("Graceful shutdown caused a timeout. Exiting now.");
UserThread.runAfter(() -> System.exit(BisqExecutable.EXIT_SUCCESS), 1);
UserThread.runAfter(() -> System.exit(HavenoExecutable.EXIT_SUCCESS), 1);
});
}, 5);
} else {
UserThread.runAfter(() -> {
resultHandler.handleResult();
System.exit(BisqExecutable.EXIT_SUCCESS);
System.exit(HavenoExecutable.EXIT_SUCCESS);
}, 1);
}
} catch (Throwable t) {
@ -120,7 +120,7 @@ public abstract class ExecutableForAppWithP2p extends BisqExecutable {
PersistenceManager.flushAllDataToDiskAtShutdown(() -> {
resultHandler.handleResult();
log.info("Graceful shutdown resulted in an error. Exiting now.");
UserThread.runAfter(() -> System.exit(BisqExecutable.EXIT_FAILURE), 1);
UserThread.runAfter(() -> System.exit(HavenoExecutable.EXIT_FAILURE), 1);
});
}

View file

@ -41,14 +41,14 @@ import com.google.common.collect.ImmutableList;
* 1) Run pre bitcoinj 0.15 btc and copy their seed words on a piece of paper.
* 2) Run post bitcoinj 0.15 btc and use recover from seed.
* */
public class BisqKeyChainFactory extends DefaultKeyChainFactory {
public class HavenoKeyChainFactory extends DefaultKeyChainFactory {
@Override
public DeterministicKeyChain makeKeyChain(Protos.Key key, Protos.Key firstSubKey, DeterministicSeed seed, KeyCrypter crypter, boolean isMarried, Script.ScriptType outputScriptType, ImmutableList<ChildNumber> accountPath) {
ImmutableList<ChildNumber> maybeUpdatedAccountPath = accountPath;
if (DeterministicKeyChain.ACCOUNT_ZERO_PATH.equals(accountPath)) {
// This is a bitcoinj 0.14 wallet that has no account path in the serialized mnemonic
KeyChainGroupStructure structure = new BisqKeyChainGroupStructure();
KeyChainGroupStructure structure = new HavenoKeyChainGroupStructure();
maybeUpdatedAccountPath = structure.accountPathFor(outputScriptType);
}

View file

@ -23,7 +23,7 @@ import org.bitcoinj.wallet.KeyChainGroupStructure;
import com.google.common.collect.ImmutableList;
public class BisqKeyChainGroupStructure implements KeyChainGroupStructure {
public class HavenoKeyChainGroupStructure implements KeyChainGroupStructure {
// See https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki
// https://github.com/satoshilabs/slips/blob/master/slip-0044.md

View file

@ -19,7 +19,7 @@ package bisq.core.btc.setup;
import bisq.core.btc.nodes.LocalBitcoinNode;
import bisq.core.btc.nodes.ProxySocketFactory;
import bisq.core.btc.wallet.BisqRiskAnalysis;
import bisq.core.btc.wallet.HavenoRiskAnalysis;
import bisq.common.config.Config;
import bisq.common.file.FileUtil;
@ -398,7 +398,7 @@ public class WalletConfig extends AbstractIdleService {
boolean shouldReplayWallet = (vBtcWalletFile.exists() && !chainFileExists) || restoreFromSeed != null;
vBtcWallet = createOrLoadWallet(shouldReplayWallet, vBtcWalletFile);
vBtcWallet.allowSpendingUnconfirmedTransactions();
vBtcWallet.setRiskAnalyzer(new BisqRiskAnalysis.Analyzer());
vBtcWallet.setRiskAnalyzer(new HavenoRiskAnalysis.Analyzer());
// Initiate Bitcoin network objects (block store, blockchain and peer group)
vStore = new SPVBlockStore(params, chainFile);
@ -519,7 +519,7 @@ public class WalletConfig extends AbstractIdleService {
final WalletProtobufSerializer serializer;
serializer = new WalletProtobufSerializer();
// Hack to convert bitcoinj 0.14 wallets to bitcoinj 0.15 format
serializer.setKeyChainFactory(new BisqKeyChainFactory());
serializer.setKeyChainFactory(new HavenoKeyChainFactory());
wallet = serializer.readWallet(params, extArray, proto);
if (shouldReplayWallet)
wallet.reset();
@ -530,7 +530,7 @@ public class WalletConfig extends AbstractIdleService {
protected Wallet createWallet() {
Script.ScriptType preferredOutputScriptType = Script.ScriptType.P2WPKH;
KeyChainGroupStructure structure = new BisqKeyChainGroupStructure();
KeyChainGroupStructure structure = new HavenoKeyChainGroupStructure();
KeyChainGroup.Builder kcgBuilder = KeyChainGroup.builder(params, structure);
if (restoreFromSeed != null) {
kcgBuilder.fromSeed(restoreFromSeed, preferredOutputScriptType);
@ -655,7 +655,7 @@ public class WalletConfig extends AbstractIdleService {
}
public void maybeAddSegwitKeychain(Wallet wallet, KeyParameter aesKey) {
if (BisqKeyChainGroupStructure.BIP44_BTC_NON_SEGWIT_ACCOUNT_PATH.equals(wallet.getActiveKeyChain().getAccountPath())) {
if (HavenoKeyChainGroupStructure.BIP44_BTC_NON_SEGWIT_ACCOUNT_PATH.equals(wallet.getActiveKeyChain().getAccountPath())) {
if (wallet.isEncrypted() && aesKey == null) {
// wait for the aesKey to be set and this method to be invoked again.
return;
@ -677,7 +677,7 @@ public class WalletConfig extends AbstractIdleService {
}
DeterministicKeyChain nativeSegwitKeyChain = DeterministicKeyChain.builder().seed(seed)
.outputScriptType(Script.ScriptType.P2WPKH)
.accountPath(new BisqKeyChainGroupStructure().accountPathFor(Script.ScriptType.P2WPKH)).build();
.accountPath(new HavenoKeyChainGroupStructure().accountPathFor(Script.ScriptType.P2WPKH)).build();
if (aesKey != null) {
// If wallet is encrypted, encrypt the new keychain.
KeyCrypter keyCrypter = wallet.getKeyCrypter();

View file

@ -31,7 +31,7 @@ import lombok.extern.slf4j.Slf4j;
* We lookup for spendable outputs which matches any of our addresses.
*/
@Slf4j
class BtcCoinSelector extends BisqDefaultCoinSelector {
class BtcCoinSelector extends HavenoDefaultCoinSelector {
private final Set<Address> addresses;
private final long ignoreDustThreshold;

View file

@ -48,7 +48,7 @@ import javax.annotation.Nullable;
* "spending" more priority than would be required to get the transaction we are creating confirmed.
*/
@Slf4j
public abstract class BisqDefaultCoinSelector implements CoinSelector {
public abstract class HavenoDefaultCoinSelector implements CoinSelector {
protected final boolean permitForeignPendingTx;
@ -62,11 +62,11 @@ public abstract class BisqDefaultCoinSelector implements CoinSelector {
return select(target, new ArrayList<>(candidates));
}
public BisqDefaultCoinSelector(boolean permitForeignPendingTx) {
public HavenoDefaultCoinSelector(boolean permitForeignPendingTx) {
this.permitForeignPendingTx = permitForeignPendingTx;
}
public BisqDefaultCoinSelector() {
public HavenoDefaultCoinSelector() {
permitForeignPendingTx = false;
}

View file

@ -72,8 +72,8 @@ import static com.google.common.base.Preconditions.checkState;
* whether a tx/dependency violates the dust rules. Outside of specialised protocols you should not encounter non-final
* transactions.</p>
*/
public class BisqRiskAnalysis implements RiskAnalysis {
private static final Logger log = LoggerFactory.getLogger(BisqRiskAnalysis.class);
public class HavenoRiskAnalysis implements RiskAnalysis {
private static final Logger log = LoggerFactory.getLogger(HavenoRiskAnalysis.class);
/**
* Any standard output smaller than this value (in satoshis) will be considered risky, as it's most likely be
@ -91,7 +91,7 @@ public class BisqRiskAnalysis implements RiskAnalysis {
protected Transaction nonFinal;
protected boolean analyzed;
private BisqRiskAnalysis(Wallet wallet, Transaction tx, List<Transaction> dependencies) {
private HavenoRiskAnalysis(Wallet wallet, Transaction tx, List<Transaction> dependencies) {
this.tx = tx;
this.dependencies = dependencies;
this.wallet = wallet;
@ -289,8 +289,8 @@ public class BisqRiskAnalysis implements RiskAnalysis {
public static class Analyzer implements RiskAnalysis.Analyzer {
@Override
public BisqRiskAnalysis create(Wallet wallet, Transaction tx, List<Transaction> dependencies) {
return new BisqRiskAnalysis(wallet, tx, dependencies);
public HavenoRiskAnalysis create(Wallet wallet, Transaction tx, List<Transaction> dependencies) {
return new HavenoRiskAnalysis(wallet, tx, dependencies);
}
}

View file

@ -33,7 +33,7 @@ import lombok.extern.slf4j.Slf4j;
* We lookup for spendable outputs which matches our address of our address.
*/
@Slf4j
public class NonBsqCoinSelector extends BisqDefaultCoinSelector {
public class NonBsqCoinSelector extends HavenoDefaultCoinSelector {
@Setter
private Preferences preferences;

View file

@ -17,7 +17,7 @@
package bisq.core.app;
import bisq.common.config.BisqHelpFormatter;
import bisq.common.config.HavenoHelpFormatter;
import joptsimple.OptionParser;
@ -36,14 +36,14 @@ import org.junit.Test;
import static org.hamcrest.CoreMatchers.equalTo;
import static org.junit.Assert.assertThat;
public class BisqHelpFormatterTest {
public class HavenoHelpFormatterTest {
@Test
public void testHelpFormatter() throws IOException, URISyntaxException {
OptionParser parser = new OptionParser();
parser.formatHelpWith(new BisqHelpFormatter("Bisq Test", "bisq-test", "0.1.0"));
parser.formatHelpWith(new HavenoHelpFormatter("Bisq Test", "bisq-test", "0.1.0"));
parser.accepts("name",
"The name of the Bisq node")