mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
Code polishing to make Codacy happy
This commit is contained in:
parent
02559f2334
commit
f342c89c8e
@ -53,13 +53,14 @@ public class BisqKeyChainFactory 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(isBsqWallet);
|
||||
accountPath = structure.accountPathFor(outputScriptType);
|
||||
maybeUpdatedAccountPath = structure.accountPathFor(outputScriptType);
|
||||
}
|
||||
|
||||
return super.makeKeyChain(key, firstSubKey, seed, crypter, isMarried, outputScriptType, accountPath);
|
||||
return super.makeKeyChain(key, firstSubKey, seed, crypter, isMarried, outputScriptType, maybeUpdatedAccountPath);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,7 +19,6 @@ package bisq.core.btc.setup;
|
||||
|
||||
import org.bitcoinj.crypto.ChildNumber;
|
||||
import org.bitcoinj.script.Script;
|
||||
import org.bitcoinj.wallet.DeterministicKeyChain;
|
||||
import org.bitcoinj.wallet.KeyChainGroupStructure;
|
||||
|
||||
import com.google.common.collect.ImmutableList;
|
||||
|
@ -283,7 +283,9 @@ public class WalletConfig extends AbstractIdleService {
|
||||
* This method is invoked on a background thread after all objects are initialised, but before the peer group
|
||||
* or block chain download is started. You can tweak the objects configuration here.
|
||||
*/
|
||||
protected void onSetupCompleted() { }
|
||||
protected void onSetupCompleted() {
|
||||
// Meant to be overridden by subclasses
|
||||
}
|
||||
|
||||
/**
|
||||
* Tests to see if the spvchain file has an operating system file lock on it. Useful for checking if your app
|
||||
@ -314,13 +316,13 @@ public class WalletConfig extends AbstractIdleService {
|
||||
protected void startUp() throws Exception {
|
||||
// Runs in a separate thread.
|
||||
Context.propagate(context);
|
||||
// bitcoinj's WalletAppKit creates the wallet directory if it was not created already,
|
||||
// but WalletConfig should not do that.
|
||||
// if (!directory.exists()) {
|
||||
// if (!directory.mkdirs()) {
|
||||
// throw new IOException("Could not create directory " + directory.getAbsolutePath());
|
||||
// }
|
||||
// }
|
||||
// bitcoinj's WalletAppKit creates the wallet directory if it was not created already,
|
||||
// but WalletConfig should not do that.
|
||||
// if (!directory.exists()) {
|
||||
// if (!directory.mkdirs()) {
|
||||
// throw new IOException("Could not create directory " + directory.getAbsolutePath());
|
||||
// }
|
||||
// }
|
||||
log.info("Starting up with directory = {}", directory);
|
||||
try {
|
||||
File chainFile = new File(directory, filePrefix + ".spvchain");
|
||||
@ -359,9 +361,7 @@ public class WalletConfig extends AbstractIdleService {
|
||||
log.info("Clearing the chain file in preparation for restore.");
|
||||
vStore.clear();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
time = vBtcWallet.getEarliestKeyCreationTime();
|
||||
}
|
||||
if (time > 0)
|
||||
|
@ -115,12 +115,12 @@ public class BisqRiskAnalysis implements RiskAnalysis {
|
||||
if (tx.getConfidence().getSource() == TransactionConfidence.Source.SELF)
|
||||
return Result.OK;
|
||||
|
||||
// Commented out to accept replace-by-fee txs.
|
||||
// // We consider transactions that opt into replace-by-fee at risk of double spending.
|
||||
// if (tx.isOptInFullRBF()) {
|
||||
// nonFinal = tx;
|
||||
// return Result.NON_FINAL;
|
||||
// }
|
||||
// Commented out to accept replace-by-fee txs.
|
||||
// // We consider transactions that opt into replace-by-fee at risk of double spending.
|
||||
// if (tx.isOptInFullRBF()) {
|
||||
// nonFinal = tx;
|
||||
// return Result.NON_FINAL;
|
||||
// }
|
||||
|
||||
// Relative time-locked transactions are risky too. We can't check the locks because usually we don't know the
|
||||
// spent outputs (to know when they were created).
|
||||
|
@ -41,29 +41,19 @@ import org.bitcoinj.core.Address;
|
||||
import org.bitcoinj.core.AddressFormatException;
|
||||
import org.bitcoinj.core.BlockChain;
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.bitcoinj.core.InsufficientMoneyException;
|
||||
import org.bitcoinj.core.LegacyAddress;
|
||||
import org.bitcoinj.core.NetworkParameters;
|
||||
import org.bitcoinj.core.Sha256Hash;
|
||||
import org.bitcoinj.core.listeners.TransactionConfidenceEventListener;
|
||||
import org.bitcoinj.script.ScriptException;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.TransactionConfidence;
|
||||
import org.bitcoinj.core.TransactionInput;
|
||||
import org.bitcoinj.core.TransactionOutPoint;
|
||||
import org.bitcoinj.core.TransactionOutput;
|
||||
import org.bitcoinj.script.Script;
|
||||
import org.bitcoinj.wallet.CoinSelection;
|
||||
import org.bitcoinj.wallet.CoinSelector;
|
||||
import org.bitcoinj.wallet.SendRequest;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
import org.bitcoinj.wallet.listeners.KeyChainEventListener;
|
||||
import org.bitcoinj.wallet.listeners.ScriptsChangeEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletChangeEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletCoinsReceivedEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletCoinsSentEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletReorganizeEventListener;
|
||||
|
||||
import javax.inject.Inject;
|
||||
|
||||
|
@ -41,14 +41,8 @@ import bisq.network.p2p.P2PService;
|
||||
|
||||
import bisq.common.util.Utilities;
|
||||
|
||||
import org.bitcoinj.core.Coin;
|
||||
import org.bitcoinj.core.ECKey;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.TransactionConfidence;
|
||||
import org.bitcoinj.core.listeners.TransactionConfidenceEventListener;
|
||||
import org.bitcoinj.script.Script;
|
||||
import org.bitcoinj.utils.Threading;
|
||||
import org.bitcoinj.wallet.Wallet;
|
||||
import org.bitcoinj.wallet.listeners.KeyChainEventListener;
|
||||
import org.bitcoinj.wallet.listeners.ScriptsChangeEventListener;
|
||||
import org.bitcoinj.wallet.listeners.WalletChangeEventListener;
|
||||
|
Loading…
Reference in New Issue
Block a user