Remove code that has been commented out

This commit is contained in:
Chris Beams 2014-08-26 16:26:16 +02:00
parent 7f67d5545d
commit fcd9966978
No known key found for this signature in database
GPG Key ID: 3D214F8F5BC5ED73
18 changed files with 0 additions and 315 deletions

View File

@ -55,11 +55,6 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
// Constructor
///////////////////////////////////////////////////////////////////////////////////////////
/*public AddressBasedCoinSelector(NetworkParameters params, AddressInfo addressInfo)
{
this(params, addressInfo, false);
} */
public AddressBasedCoinSelector(NetworkParameters params, AddressEntry addressEntry, boolean includePending) {
this.params = params;
this.addressEntry = addressEntry;
@ -172,19 +167,4 @@ public class AddressBasedCoinSelector extends DefaultCoinSelector {
return new CoinSelection(Coin.valueOf(total), selected);
}
/*
public static boolean isSelectable(Transaction tx)
{
// Only pick chain-included transactions, or transactions that are ours and pending.
TransactionConfidence confidence = tx.getConfidence();
TransactionConfidence.ConfidenceType type = confidence.getConfidenceType();
return type.equals(TransactionConfidence.ConfidenceType.BUILDING) ||
type.equals(TransactionConfidence.ConfidenceType.PENDING) &&
confidence.getSource().equals(TransactionConfidence.Source.SELF) &&
// In regtest mode we expect to have only one peer, so we won't see transactions propagate.
// TODO: The value 1 below dates from a time when transactions we broadcast *to* were
// counted, set to 0
(confidence.numBroadcastPeers() > 1 || tx.getParams() == RegTestParams.get());
}
*/
}

View File

@ -39,14 +39,6 @@ public class BlockChainFacade {
//TODO
public boolean verifyAccountRegistration() {
return true;
// tx id 76982adc582657b2eb68f3e43341596a68aadc4ef6b9590e88e93387d4d5d1f9
// address: mjbxLbuVpU1cNXLJbrJZyirYwweoRPVVTj
/*
if (findAddressInBlockChain(address) && isFeePayed(address))
return getDataForTxWithAddress(address) != null;
else
return true; */
}
private boolean findAddressInBlockChain(String address) {

View File

@ -35,16 +35,4 @@ public class BtcValidator {
return amount != null && amount.compareTo(FeePolicy.TX_FEE.add(Transaction.MIN_NONDUST_OUTPUT)) > 0;
}
/* public boolean isAddressValid(String addressString)
{
try
{
new Address(BtcValidator.params, addressString);
return true;
} catch (AddressFormatException e)
{
return false;
}
} */
}

View File

@ -182,8 +182,6 @@ public class WalletFacade {
if (params == RegTestParams.get()) {
walletAppKit.peerGroup().setMinBroadcastConnections(1);
}
/* else
walletAppKit.peerGroup().setMinBroadcastConnections(2); */
walletEventListener = new WalletEventListener() {
@Override
@ -348,12 +346,6 @@ public class WalletFacade {
if (transactions != null) {
transactionConfidenceList.addAll(transactions.stream().map(tx ->
getTransactionConfidence(tx, address)).collect(Collectors.toList()));
/* same as:
for (Transaction tx : transactions)
{
transactionConfidenceList.add(getTransactionConfidence(tx, address));
}
*/
}
return getMostRecentConfidence(transactionConfidenceList);
}
@ -380,21 +372,6 @@ public class WalletFacade {
transactionConfidenceList.add(tx.getConfidence());
}
});
/*
same as:
for (TransactionOutput transactionOutput : mergedOutputs)
{
if (transactionOutput.getScriptPubKey().isSentToAddress() ||
transactionOutput.getScriptPubKey().isSentToP2SH())
{
Address outputAddress = transactionOutput.getScriptPubKey().getToAddress(params);
if (address.equals(outputAddress))
{
transactionConfidenceList.add(tx.getConfidence());
}
}
}
*/
return getMostRecentConfidence(transactionConfidenceList);
}
@ -502,20 +479,6 @@ public class WalletFacade {
return getRegistrationBalance().compareTo(FeePolicy.ACCOUNT_REGISTRATION_FEE) >= 0;
}
/* public boolean isUnusedTradeAddressBalanceAboveCreationFee()
{
AddressEntry unUsedAddressEntry = getUnusedTradeAddressInfo();
Coin unUsedAddressInfoBalance = getBalanceForAddress(unUsedAddressEntry.getAddress());
return unUsedAddressInfoBalance.compareTo(FeePolicy.CREATE_OFFER_FEE) > 0;
}
public boolean isUnusedTradeAddressBalanceAboveTakeOfferFee()
{
AddressEntry unUsedAddressEntry = getUnusedTradeAddressInfo();
Coin unUsedAddressInfoBalance = getBalanceForAddress(unUsedAddressEntry.getAddress());
return unUsedAddressInfoBalance.compareTo(FeePolicy.TAKE_OFFER_FEE) > 0;
}*/
//TODO
public int getNumOfPeersSeenTx(String txID) {
// TODO check from blockchain
@ -553,21 +516,7 @@ public class WalletFacade {
sendRequest.coinSelector = new AddressBasedCoinSelector(params, getRegistrationAddressEntry(), false);
sendRequest.changeAddress = getRegistrationAddressEntry().getAddress();
Wallet.SendResult sendResult = wallet.sendCoins(sendRequest);
//Object k = getRegistrationAddressInfo().getKey();
Futures.addCallback(sendResult.broadcastComplete, callback);
/*Futures.addCallback(sendResult.broadcastComplete, new FutureCallback<Transaction>(){
@Override
public void onSuccess(@Nullable Transaction result)
{
Object k = getRegistrationAddressInfo().getKey();
}
@Override
public void onFailure(Throwable t)
{
}
}); */
log.debug("Registration transaction: " + tx);
printInputs("payRegistrationFee", tx);
@ -579,7 +528,6 @@ public class WalletFacade {
Coin fee = FeePolicy.CREATE_OFFER_FEE.subtract(FeePolicy.TX_FEE);
log.trace("fee: " + fee.toFriendlyString());
tx.addOutput(fee, feePolicy.getAddressForCreateOfferFee());
// printInputs("payCreateOfferFee", tx);
Wallet.SendRequest sendRequest = Wallet.SendRequest.forTx(tx);
sendRequest.shuffleOutputs = false;
// we allow spending of unconfirmed tx (double spend risk is low and usability would suffer if we need to

View File

@ -310,12 +310,6 @@ public class MainController extends ViewController {
///////////////////////////////////////////////////////////////////////////////////////////
private void loadViewFromNavButton(NavigationItem navigationItem) {
/* if (childController instanceof CachedViewController)
((CachedViewController) childController).deactivate();
else if (childController != null)
childController.terminate();*/
final GuiceFXMLLoader loader = new GuiceFXMLLoader(getClass().getResource(navigationItem.getFxmlUrl()));
try {
final Node view = loader.load();

View File

@ -93,17 +93,6 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
* ************************************************************************
*/
//private static final String DONE = ControlResources.getString("ProgressIndicator.doneString");
/**
* doneText is just used to know the size of done as that is the biggest text we need to allow for
*/
/* private static final Text doneText = new Text(DONE);
static {
doneText.getStyleClass().add("text");
} */
private IndeterminateSpinner spinner;
/**
* The number of segments in the spinner.
@ -399,10 +388,6 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
getChildren().clear();
/* text = new Text((control.getProgress() >= 1) ? (DONE) : ("" + intProgress + "%"));
text.setTextOrigin(VPos.TOP);
text.getStyleClass().setAll("text", "percentage"); */
// The circular background for the progress pie piece
indicator = new StackPane();
indicator.setScaleShape(false);
@ -519,17 +504,6 @@ public class ConfidenceProgressIndicatorSkin extends BehaviorSkinBase<Confidence
tick.setLayoutY(centerY - squareBoxHalfWidth);
tick.resize(squareBoxHalfWidth + squareBoxHalfWidth, squareBoxHalfWidth + squareBoxHalfWidth);
tick.setVisible(control.getProgress() >= 1);
// if the % text can't fit anywhere in the bounds then don't display it
/* double textWidth = text.getLayoutBounds().getWidth();
double textHeight = text.getLayoutBounds().getHeight();
if (control.getWidth() >= textWidth && control.getHeight() >= textHeight) {
if (!text.isVisible()) text.setVisible(true);
text.setLayoutY(snapPosition(centerY + radius + textGap));
text.setLayoutX(snapPosition(centerX - (textWidth/2)));
} else {
if (text.isVisible()) text.setVisible(false);
} */
}
@Override

View File

@ -143,13 +143,8 @@ class ProcessStepBarSkin<T> extends BehaviorSkinBase<ProcessStepBar<T>, Behavior
}
public void deSelect() {
/*BorderStroke borderStroke = new BorderStroke(Color.GRAY, BorderStrokeStyle.SOLID, null,
new BorderWidths(borderWidth, borderWidth, borderWidth, borderWidth), Insets.EMPTY);
this.setBorder(new Border(borderStroke));
setTextFill(Color.GRAY); */
}
public double getArrowWidth() {
return arrowWidth;
}

View File

@ -275,13 +275,6 @@ public class CreateOfferController extends CachedViewController {
placeOfferButton.visibleProperty().bind(viewModel.isOfferPlacedScreen.not());
closeButton.visibleProperty().bind(viewModel.isOfferPlacedScreen);
//TODO
/* progressIndicator.visibleProperty().bind(viewModel.isOfferPlacedScreen);
confirmationLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen);
txTitleLabel.visibleProperty().bind(viewModel.isOfferPlacedScreen);
transactionIdTextField.visibleProperty().bind(viewModel.isOfferPlacedScreen);
*/
placeOfferButton.disableProperty().bind(amountTextField.isValidProperty()
.and(minAmountTextField.isValidProperty())
.and(volumeTextField.isValidProperty())

View File

@ -48,12 +48,6 @@ public class BitSquareFormatter {
return coin != null ? coin.toPlainString() : "";
}
/* public static String formatCoinToWithSymbol(Coin coin)
{
return "฿ " + coin.toPlainString();
} */
public static String formatCoinWithCode(Coin coin) {
return coin != null ? coin.toFriendlyString() : "";
}

View File

@ -120,16 +120,6 @@ public class CountryUtil {
Set<Locale> allLocalesAsSet =
allLocales.stream().filter(locale -> !"".equals(locale.getCountry())).map(locale ->
new Locale("", locale.getCountry(), "")).collect(Collectors.toSet());
/*
same as:
Set<Locale> allLocalesAsSet = new HashSet<>();
for (Locale locale : allLocales)
{
if (!locale.getCountry().equals(""))
{
allLocalesAsSet.add(new Locale("", locale.getCountry(), ""));
}
} */
allLocales = new ArrayList<>();
allLocales.addAll(allLocalesAsSet);

View File

@ -26,23 +26,6 @@ import java.util.stream.Collectors;
public class LanguageUtil {
/*public static List<Locale> getPopularLanguages()
{
List<Locale> list = new ArrayList<>();
list.add(new Locale("de", "AT"));
list.add(new Locale("de", "DE"));
list.add(new Locale("en", "US"));
list.add(new Locale("en", "UK"));
list.add(new Locale("es", "ES"));
list.add(new Locale("ru", "RU"));
list.add(new Locale("zh", "CN"));
list.add(new Locale("en", "AU"));
list.add(new Locale("it", "IT"));
list.add(new Locale("en", "CA"));
return list;
} */
public static List<Locale> getAllLanguageLocales() {
List<Locale> allLocales = Arrays.asList(Locale.getAvailableLocales());
final Set<Locale> allLocalesAsSet =

View File

@ -117,16 +117,6 @@ public class BootstrappedPeerFactory {
@Override
public void peerInserted(PeerAddress peerAddress, boolean verified) {
log.debug("Peer inserted: peerAddress=" + peerAddress + ", verified=" + verified);
/* NavigableSet<PeerAddress> closePeers = peer.peerBean().peerMap().closePeers(2);
log.debug("closePeers size = " + closePeers.size());
log.debug("closePeers = " + closePeers);
closePeers.forEach(e -> log.debug("forEach: " + e.toString()));
List<PeerAddress> allPeers = peer.peerBean().peerMap().all();
log.debug("allPeers size = " + allPeers.size());
log.debug("allPeers = " + allPeers);
allPeers.forEach(e -> log.debug("forEach: " + e.toString()));*/
}
@Override
@ -136,7 +126,6 @@ public class BootstrappedPeerFactory {
@Override
public void peerUpdated(PeerAddress peerAddress, PeerStatatistic peerStatistics) {
// log.debug("Peer updated: peerAddress=" + peerAddress + ", peerStatistics=" + peerStatistics);
}
});
@ -358,17 +347,5 @@ public class BootstrappedPeerFactory {
// The seed node should only be used if no other known peers are available
private void requestBootstrapPeerMap() {
log.debug("getBootstrapPeerMap");
/* NavigableSet<PeerAddress> closePeers = peer.peerBean().peerMap().closePeers(2);
log.debug("closePeers size = " + closePeers.size());
log.debug("closePeers = " + closePeers);
closePeers.forEach(e -> log.debug("forEach: " + e.toString()));
List<PeerAddress> allPeers = peer.peerBean().peerMap().all();
log.debug("allPeers size = " + allPeers.size());
log.debug("allPeers = " + allPeers);
allPeers.forEach(e -> log.debug("forEach: " + e.toString())); */
}
}

View File

@ -377,16 +377,6 @@ public class MessageFacade implements MessageBroker {
orderBookListeners.remove(listener);
}
/* public void addPingPeerListener(PingPeerListener listener)
{
pingPeerListeners.add(listener);
}
public void removePingPeerListener(PingPeerListener listener)
{
pingPeerListeners.remove(listener);
} */
public void addArbitratorListener(ArbitratorListener listener) {
arbitratorListeners.add(listener);
}

View File

@ -73,32 +73,6 @@ public class P2PNode {
private Thread bootstrapToLocalhostThread;
private Thread bootstrapToServerThread;
// just for lightweight client test
/* public static void main(String[] args)
{
P2PNode p2pNode = new P2PNode(DSAKeyUtil.generateKeyPair(), false, SeedNodeAddress.StaticSeedNodeAddresses
.DIGITAL_OCEAN,
(message, peerAddress) -> log.debug("handleMessage: message= " + message + "/
peerAddress=" + peerAddress));
p2pNode.start(new FutureCallback<PeerDHT>()
{
@Override
public void onSuccess(@Nullable PeerDHT result)
{
log.debug("p2pNode.start success result = " + result);
}
@Override
public void onFailure(Throwable t)
{
log.error(t.toString());
}
});
for (; ; )
{
}
}*/
private KeyPair keyPair;
private final Boolean useDiskStorage;
private final SeedNodeAddress.StaticSeedNodeAddresses defaultStaticSeedNodeAddresses;

View File

@ -114,11 +114,7 @@ public class Settings implements Serializable {
List<Arbitrator> candidates = new ArrayList<>();
//noinspection Convert2streamapi
for (Arbitrator arbitrator : acceptedArbitrators) {
/*if (arbitrator.getArbitrationFeePercent() >= collateral &&
arbitrator.getMinArbitrationAmount().compareTo(amount) < 0)
{ */
candidates.add(arbitrator);
// }
}
return !candidates.isEmpty() ? candidates.get((int) (Math.random() * candidates.size())) : null;
}

View File

@ -153,35 +153,6 @@ public class OrderBook implements OrderBookListener {
boolean result = currencyResult && countryResult && languageResult && amountResult && directionResult &&
priceResult && arbitratorResult;
/*
log.debug("result = " + result +
", currencyResult = " + currencyResult +
", countryResult = " + countryResult +
", languageResult = " + languageResult +
", amountResult = " + amountResult +
", directionResult = " + directionResult +
", priceResult = " + priceResult +
", arbitratorResult = " + arbitratorResult
);*/
/*
log.debug("currentBankAccount.getCurrency() = " + currentBankAccount.getCurrency() +
", offer.getCurrency() = " + offer.getCurrency());
log.debug("offer.getCountryLocale() = " + offer.getBankAccountCountryLocale() +
", settings.getAcceptedCountries() = " + settings.getAcceptedCountries().toString());
log.debug("settings.getAcceptedLanguageLocales() = " + settings.getAcceptedLanguageLocales() +
", offer.getAcceptedLanguageLocales() = " + offer.getAcceptedLanguageLocales());
log.debug("currentBankAccount.getBankAccountType().getType() = " + currentBankAccount.getBankAccountType
().getType() +
", offer.getBankAccountTypeEnum() = " + offer.getBankAccountTypeEnum());
log.debug("orderBookFilter.getAmount() = " + orderBookFilter.getAmount() +
", offer.getAmount() = " + offer.getAmount());
log.debug("orderBookFilter.getDirection() = " + orderBookFilter.getDirection() +
", offer.getDirection() = " + offer.getDirection());
log.debug("orderBookFilter.getPrice() = " + orderBookFilter.getPrice() +
", offer.getPrice() = " + offer.getPrice());
log.debug("offer.getArbitrator() = " + offer.getArbitrator() +
", settings.getAcceptedArbitrators() = " + settings.getAcceptedArbitrators());
*/
return result;
});
}

View File

@ -54,27 +54,11 @@ public class VerifyAndSignContract {
bankAccount, peersBankAccount, messagePublicKey, takerMessagePublicKey);
String contractAsJson = Utilities.objectToJson(contract);
// log.trace("Offerer contract created: " + contract);
// log.trace("Offerers contractAsJson: " + contractAsJson);
// log.trace("Takers contractAsJson: " + sharedModel.peersContractAsJson);
//TODO PublicKey cause problems, need to be changed to hex
/*if (contractAsJson.equals(peersContractAsJson))
{*/
log.trace("The 2 contracts as json does match");
String signature = cryptoFacade.signContract(registrationKey, contractAsJson);
//log.trace("signature: " + signature);
resultHandler.onResult(contract, contractAsJson, signature);
/* }
else
{
// TODO use diff output as feedback ?
log.error("Contracts are not matching.");
log.error("Offerers contractAsJson: " + contractAsJson);
log.error("Takers contractAsJson: " + peersContractAsJson);
faultHandler.onFault(new Exception("Contracts are not matching"));
}*/
}
public interface ResultHandler {

View File

@ -36,44 +36,6 @@ public class FileUtil {
return File.createTempFile("temp_" + prefix, null, StorageDirectory.getStorageDirectory());
}
/*
public static String getApplicationFileName()
{
File executionRoot = new File(StorageDirectory.class.getProtectionDomain().getCodeSource().getLocation()
.getFile());
try
{
log.trace("getApplicationFileName " + executionRoot.getCanonicalPath());
} catch (IOException e)
{
e.printStackTrace();
}
// check if it is packed into a mac app (e.g.: "/Users/mk/Desktop/bitsquare.app/Contents/Java/bitsquare.jar")
try
{
if (executionRoot.getCanonicalPath().endsWith(".app/Contents/Java/bitsquare.jar") && System.getProperty
("os.name").startsWith("Mac"))
{
File appFile = executionRoot.getParentFile().getParentFile().getParentFile();
try
{
int lastSlash = appFile.getCanonicalPath().lastIndexOf("/") + 1;
return appFile.getCanonicalPath().substring(lastSlash).replace(".app", "");
} catch (IOException e)
{
e.printStackTrace();
}
}
} catch (IOException e)
{
e.printStackTrace();
}
// fallback use AppName
return BitSquare.getAppName();
}
*/
public static void writeTempFileToFile(File tempFile, File file) throws IOException {
if (Utils.isWindows()) {
// Work around an issue on Windows whereby you can't rename over existing files.