mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-06-25 07:10:48 -04:00
Remove authentication for P2P network, UI improvements
This commit is contained in:
parent
17fa8a424a
commit
2ad72938ec
65 changed files with 1351 additions and 2275 deletions
|
@ -113,7 +113,7 @@ public class MainViewModel implements ViewModel {
|
|||
private final User user;
|
||||
private int numBTCPeers = 0;
|
||||
private Timer checkForBtcSyncStateTimer;
|
||||
private ChangeListener<Number> numAuthenticatedPeersListener, btcNumPeersListener;
|
||||
private ChangeListener<Number> numConnectedPeersListener, btcNumPeersListener;
|
||||
private java.util.Timer numberofBtcPeersTimer;
|
||||
private java.util.Timer numberofP2PNetworkPeersTimer;
|
||||
|
||||
|
@ -176,8 +176,8 @@ public class MainViewModel implements ViewModel {
|
|||
}
|
||||
|
||||
public void shutDown() {
|
||||
if (numAuthenticatedPeersListener != null)
|
||||
p2PService.getNumAuthenticatedPeers().removeListener(numAuthenticatedPeersListener);
|
||||
if (numConnectedPeersListener != null)
|
||||
p2PService.getNumConnectedPeers().removeListener(numConnectedPeersListener);
|
||||
|
||||
if (btcNumPeersListener != null)
|
||||
walletService.numPeersProperty().removeListener(btcNumPeersListener);
|
||||
|
@ -208,17 +208,17 @@ public class MainViewModel implements ViewModel {
|
|||
|
||||
@Override
|
||||
public void onRequestingDataCompleted() {
|
||||
if (p2PService.getNumAuthenticatedPeers().get() == 0) {
|
||||
if (p2PService.getNumConnectedPeers().get() == 0) {
|
||||
p2PNetworkInfo.set("Initial data received");
|
||||
} else {
|
||||
updateP2pNetworkInfoWithPeersChanged(p2PService.getNumAuthenticatedPeers().get());
|
||||
updateP2pNetworkInfoWithPeersChanged(p2PService.getNumConnectedPeers().get());
|
||||
}
|
||||
p2pNetworkInitialized.set(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNoSeedNodeAvailable() {
|
||||
if (p2PService.getNumAuthenticatedPeers().get() == 0) {
|
||||
if (p2PService.getNumConnectedPeers().get() == 0) {
|
||||
p2PNetworkInfo.set("No seed nodes available");
|
||||
}
|
||||
p2pNetworkInitialized.set(true);
|
||||
|
@ -226,7 +226,7 @@ public class MainViewModel implements ViewModel {
|
|||
|
||||
@Override
|
||||
public void onNoPeersAvailable() {
|
||||
if (p2PService.getNumAuthenticatedPeers().get() == 0) {
|
||||
if (p2PService.getNumConnectedPeers().get() == 0) {
|
||||
p2PNetworkWarnMsg.set("There are no seed nodes or persisted peers available for requesting data.\n" +
|
||||
"Please check your internet connection or try to restart the application.");
|
||||
p2PNetworkInfo.set("No seed nodes and peers available");
|
||||
|
@ -236,8 +236,8 @@ public class MainViewModel implements ViewModel {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFirstPeerAuthenticated() {
|
||||
updateP2pNetworkInfoWithPeersChanged(p2PService.getNumAuthenticatedPeers().get());
|
||||
public void onBootstrapped() {
|
||||
updateP2pNetworkInfoWithPeersChanged(p2PService.getNumConnectedPeers().get());
|
||||
splashP2PNetworkProgress.set(1);
|
||||
}
|
||||
|
||||
|
@ -248,7 +248,7 @@ public class MainViewModel implements ViewModel {
|
|||
+ throwable.getMessage() + ").\n" +
|
||||
"Please check your internet connection or try to restart the application.");
|
||||
splashP2PNetworkProgress.set(0);
|
||||
if (p2PService.getNumAuthenticatedPeers().get() == 0)
|
||||
if (p2PService.getNumConnectedPeers().get() == 0)
|
||||
p2PNetworkLabelId.set("splash-error-state-msg");
|
||||
}
|
||||
});
|
||||
|
@ -385,14 +385,13 @@ public class MainViewModel implements ViewModel {
|
|||
.show();
|
||||
|
||||
// update nr of peers in footer
|
||||
numAuthenticatedPeersListener = (observable, oldValue, newValue) -> {
|
||||
|
||||
numConnectedPeersListener = (observable, oldValue, newValue) -> {
|
||||
if ((int) oldValue > 0 && (int) newValue == 0) {
|
||||
// give a bit of tolerance
|
||||
if (numberofP2PNetworkPeersTimer != null)
|
||||
numberofP2PNetworkPeersTimer.cancel();
|
||||
numberofP2PNetworkPeersTimer = UserThread.runAfter(() -> {
|
||||
if (p2PService.getNumAuthenticatedPeers().get() == 0) {
|
||||
if (p2PService.getNumConnectedPeers().get() == 0) {
|
||||
p2PNetworkWarnMsg.set("You lost the connection to all P2P network peers.\n" +
|
||||
"Maybe you lost your internet connection or your computer was in hibernate/sleep mode.");
|
||||
p2PNetworkLabelId.set("splash-error-state-msg");
|
||||
|
@ -408,7 +407,7 @@ public class MainViewModel implements ViewModel {
|
|||
|
||||
updateP2pNetworkInfoWithPeersChanged((int) newValue);
|
||||
};
|
||||
p2PService.getNumAuthenticatedPeers().addListener(numAuthenticatedPeersListener);
|
||||
p2PService.getNumConnectedPeers().addListener(numConnectedPeersListener);
|
||||
|
||||
// now show app
|
||||
showAppScreen.set(true);
|
||||
|
@ -427,8 +426,8 @@ public class MainViewModel implements ViewModel {
|
|||
}
|
||||
}
|
||||
|
||||
private void updateP2pNetworkInfoWithPeersChanged(int numAuthenticatedPeers) {
|
||||
p2PNetworkInfo.set("Nr. of connections: " + numAuthenticatedPeers);
|
||||
private void updateP2pNetworkInfoWithPeersChanged(int numPeers) {
|
||||
p2PNetworkInfo.set("Nr. of connections: " + numPeers);
|
||||
}
|
||||
|
||||
private void displayAlertIfPresent(Alert alert) {
|
||||
|
|
|
@ -219,23 +219,23 @@ public class ArbitratorRegistrationView extends ActivatableViewAndModel<VBox, Ar
|
|||
}
|
||||
|
||||
private void onRevoke() {
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
model.onRevoke(
|
||||
() -> new Popup().information("You have successfully removed your arbitrator from the P2P network.").show(),
|
||||
(errorMessage) -> new Popup().error("Could not remove arbitrator.\nError message: " + errorMessage).show());
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
||||
private void onRegister() {
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
model.onRegister(
|
||||
() -> new Popup().information("You have successfully registered your arbitrator to the P2P network.").show(),
|
||||
(errorMessage) -> new Popup().error("Could not register arbitrator.\nError message: " + errorMessage).show());
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -183,7 +183,7 @@ class ArbitratorRegistrationViewModel extends ActivatableViewModel {
|
|||
revokeButtonDisabled.set(!allDataValid || myArbitratorProperty.get() == null);
|
||||
}
|
||||
|
||||
boolean isAuthenticated() {
|
||||
return p2PService.isAuthenticated();
|
||||
boolean isNetworkReady() {
|
||||
return p2PService.isNetworkReady();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
|
||||
<TableView fx:id="table" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn text="Label" fx:id="labelColumn" minWidth="100" sortable="false"/>
|
||||
<TableColumn text="Details" fx:id="detailsColumn" minWidth="100" sortable="false"/>
|
||||
<TableColumn text="Address" fx:id="addressColumn" minWidth="240" sortable="false"/>
|
||||
<TableColumn text="Balance" fx:id="balanceColumn" minWidth="90" sortable="false"/>
|
||||
<TableColumn text="Confirmations" fx:id="confidenceColumn" minWidth="30" sortable="false"/>
|
||||
|
|
|
@ -50,7 +50,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
|
|||
@FXML
|
||||
TableView<ReservedListItem> table;
|
||||
@FXML
|
||||
TableColumn<ReservedListItem, ReservedListItem> labelColumn, addressColumn, balanceColumn, confidenceColumn;
|
||||
TableColumn<ReservedListItem, ReservedListItem> detailsColumn, addressColumn, balanceColumn, confidenceColumn;
|
||||
|
||||
private final WalletService walletService;
|
||||
private final TradeManager tradeManager;
|
||||
|
@ -123,8 +123,8 @@ public class ReservedView extends ActivatableView<VBox, Void> {
|
|||
}
|
||||
|
||||
private void setLabelColumnCellFactory() {
|
||||
labelColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
|
||||
labelColumn.setCellFactory(new Callback<TableColumn<ReservedListItem, ReservedListItem>,
|
||||
detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
|
||||
detailsColumn.setCellFactory(new Callback<TableColumn<ReservedListItem, ReservedListItem>,
|
||||
TableCell<ReservedListItem,
|
||||
ReservedListItem>>() {
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@
|
|||
|
||||
<TableView fx:id="table" VBox.vgrow="ALWAYS">
|
||||
<columns>
|
||||
<TableColumn text="Label" fx:id="labelColumn" minWidth="100" sortable="false"/>
|
||||
<TableColumn text="Details" fx:id="detailsColumn" minWidth="100" sortable="false"/>
|
||||
<TableColumn text="Address" fx:id="addressColumn" minWidth="240" sortable="false">
|
||||
<cellValueFactory>
|
||||
<PropertyValueFactory property="addressString"/>
|
||||
|
@ -37,6 +37,7 @@
|
|||
</TableColumn>
|
||||
<TableColumn text="Balance" fx:id="balanceColumn" minWidth="50" sortable="false"/>
|
||||
<TableColumn text="Confirmations" fx:id="confidenceColumn" minWidth="30" sortable="false"/>
|
||||
<TableColumn text="" fx:id="selectColumn" prefWidth="80" sortable="false"/>
|
||||
</columns>
|
||||
</TableView>
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
@FXML
|
||||
TextField withdrawFromTextField, withdrawToTextField, amountTextField;
|
||||
@FXML
|
||||
TableColumn<WithdrawalListItem, WithdrawalListItem> labelColumn, addressColumn, balanceColumn, confidenceColumn;
|
||||
TableColumn<WithdrawalListItem, WithdrawalListItem> detailsColumn, addressColumn, balanceColumn, confidenceColumn, selectColumn;
|
||||
|
||||
private final WalletService walletService;
|
||||
private final TradeManager tradeManager;
|
||||
|
@ -114,6 +114,7 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
setAddressColumnCellFactory();
|
||||
setBalanceColumnCellFactory();
|
||||
setConfidenceColumnCellFactory();
|
||||
setSelectColumnCellFactory();
|
||||
|
||||
if (BitsquareApp.DEV_MODE)
|
||||
withdrawToTextField.setText("mxAkWWaQBqwqcYstKzqLku3kzR6pbu2zHq");
|
||||
|
@ -262,8 +263,8 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
}
|
||||
|
||||
private void setLabelColumnCellFactory() {
|
||||
labelColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
|
||||
labelColumn.setCellFactory(new Callback<TableColumn<WithdrawalListItem, WithdrawalListItem>,
|
||||
detailsColumn.setCellValueFactory((addressListItem) -> new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
|
||||
detailsColumn.setCellFactory(new Callback<TableColumn<WithdrawalListItem, WithdrawalListItem>,
|
||||
TableCell<WithdrawalListItem,
|
||||
WithdrawalListItem>>() {
|
||||
|
||||
|
@ -272,21 +273,25 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
WithdrawalListItem> column) {
|
||||
return new TableCell<WithdrawalListItem, WithdrawalListItem>() {
|
||||
|
||||
private Hyperlink hyperlink;
|
||||
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
|
||||
if (item != null && !empty) {
|
||||
hyperlink = new Hyperlink(item.getLabel());
|
||||
if (item.getAddressEntry().getOfferId() != null) {
|
||||
Tooltip tooltip = new Tooltip(item.getAddressEntry().getShortOfferId());
|
||||
Tooltip.install(hyperlink, tooltip);
|
||||
if (detailsAvailable(item)) {
|
||||
Hyperlink hyperlink = new Hyperlink(item.getLabel());
|
||||
if (item.getAddressEntry().getOfferId() != null) {
|
||||
Tooltip tooltip = new Tooltip(item.getAddressEntry().getShortOfferId());
|
||||
Tooltip.install(hyperlink, tooltip);
|
||||
|
||||
hyperlink.setOnAction(event -> openDetails(item));
|
||||
hyperlink.setOnAction(event -> openDetails(item));
|
||||
setGraphic(hyperlink);
|
||||
}
|
||||
} else {
|
||||
Label label = new Label("No info available");
|
||||
setGraphic(label);
|
||||
}
|
||||
setGraphic(hyperlink);
|
||||
|
||||
} else {
|
||||
setGraphic(null);
|
||||
setId(null);
|
||||
|
@ -374,6 +379,42 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
});
|
||||
}
|
||||
|
||||
private void setSelectColumnCellFactory() {
|
||||
selectColumn.setCellValueFactory((addressListItem) ->
|
||||
new ReadOnlyObjectWrapper<>(addressListItem.getValue()));
|
||||
selectColumn.setCellFactory(
|
||||
new Callback<TableColumn<WithdrawalListItem, WithdrawalListItem>, TableCell<WithdrawalListItem,
|
||||
WithdrawalListItem>>() {
|
||||
|
||||
@Override
|
||||
public TableCell<WithdrawalListItem, WithdrawalListItem> call(TableColumn<WithdrawalListItem,
|
||||
WithdrawalListItem> column) {
|
||||
return new TableCell<WithdrawalListItem, WithdrawalListItem>() {
|
||||
|
||||
Button button = new Button("Select");
|
||||
|
||||
@Override
|
||||
public void updateItem(final WithdrawalListItem item, boolean empty) {
|
||||
super.updateItem(item, empty);
|
||||
if (item != null && !empty) {
|
||||
button.setDefaultButton(true);
|
||||
button.setMouseTransparent(true);
|
||||
setGraphic(button);
|
||||
} else {
|
||||
setGraphic(null);
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private boolean detailsAvailable(WithdrawalListItem item) {
|
||||
String offerId = item.getAddressEntry().getOfferId();
|
||||
return closedTradableManager.getTradableById(offerId).isPresent() ||
|
||||
failedTradesManager.getTradeById(offerId).isPresent();
|
||||
}
|
||||
|
||||
private void openDetails(WithdrawalListItem item) {
|
||||
String offerId = item.getAddressEntry().getOfferId();
|
||||
Optional<Tradable> tradableOptional = closedTradableManager.getTradableById(offerId);
|
||||
|
@ -384,8 +425,10 @@ public class WithdrawalView extends ActivatableView<VBox, Void> {
|
|||
} else if (tradable instanceof OpenOffer) {
|
||||
offerDetailsPopup.show(tradable.getOffer());
|
||||
}
|
||||
} else if (failedTradesManager.getTradeById(offerId).isPresent()) {
|
||||
tradeDetailsPopup.show(failedTradesManager.getTradeById(offerId).get());
|
||||
} else {
|
||||
failedTradesManager.getTradeById(offerId).ifPresent(trade -> tradeDetailsPopup.show(trade));
|
||||
log.warn("no details available. A test with detailsAvailable() is missing.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
|||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void onPlaceOffer() {
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
Offer offer = model.createAndGetOffer();
|
||||
if (model.getShowPlaceOfferConfirmation()) {
|
||||
offerDetailsPopup.onPlaceOffer(o -> model.onPlaceOffer(o)).show(offer);
|
||||
|
@ -214,7 +214,7 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
|
|||
}
|
||||
}
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -485,8 +485,8 @@ class CreateOfferViewModel extends ActivatableWithDataModel<CreateOfferDataModel
|
|||
return dataModel.hasAcceptedArbitrators();
|
||||
}
|
||||
|
||||
boolean isAuthenticated() {
|
||||
return p2PService.isAuthenticated();
|
||||
boolean isNetworkReady() {
|
||||
return p2PService.isNetworkReady();
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -230,15 +230,15 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
}
|
||||
|
||||
private void onTakeOffer(Offer offer) {
|
||||
if (model.isAuthenticated())
|
||||
if (model.isNetworkReady())
|
||||
offerActionHandler.onTakeOffer(offer);
|
||||
else
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
|
||||
private void onRemoveOpenOffer(Offer offer) {
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
new Popup().warning("Are you sure you want to remove that offer?\n" +
|
||||
"The offer fee you have paid will be lost if you remove that offer.")
|
||||
.actionButtonText("Remove offer")
|
||||
|
@ -246,7 +246,7 @@ public class OfferBookView extends ActivatableViewAndModel<GridPane, OfferBookVi
|
|||
.closeButtonText("Don't remove the offer")
|
||||
.show();
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -157,8 +157,8 @@ class OfferBookViewModel extends ActivatableViewModel {
|
|||
return list;
|
||||
}
|
||||
|
||||
boolean isAuthenticated() {
|
||||
return p2PService.isAuthenticated();
|
||||
boolean isNetworkReady() {
|
||||
return p2PService.isNetworkReady();
|
||||
}
|
||||
|
||||
public TradeCurrency getTradeCurrency() {
|
||||
|
|
|
@ -73,7 +73,7 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
|
|||
}
|
||||
|
||||
private void onRemoveOpenOffer(OpenOffer openOffer) {
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
new Popup().warning("Are you sure you want to remove that offer?\n" +
|
||||
"The offer fee you have paid will be lost if you remove that offer.")
|
||||
.actionButtonText("Remove offer")
|
||||
|
@ -81,7 +81,7 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
|
|||
.closeButtonText("Don't remove the offer")
|
||||
.show();
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -73,7 +73,7 @@ class OpenOffersViewModel extends ActivatableWithDataModel<OpenOffersDataModel>
|
|||
return formatter.formatDateTime(item.getOffer().getDate());
|
||||
}
|
||||
|
||||
boolean isAuthenticated() {
|
||||
return p2PService.isAuthenticated();
|
||||
boolean isNetworkReady() {
|
||||
return p2PService.isNetworkReady();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -219,8 +219,8 @@ public class PendingTradesViewModel extends ActivatableWithDataModel<PendingTrad
|
|||
return btcAddressValidator;
|
||||
}
|
||||
|
||||
public boolean isAuthenticated() {
|
||||
return p2PService.isAuthenticated();
|
||||
public boolean isNetworkReady() {
|
||||
return p2PService.isNetworkReady();
|
||||
}
|
||||
|
||||
// columns
|
||||
|
|
|
@ -107,7 +107,7 @@ public class ConfirmPaymentReceivedView extends TradeStepDetailsView {
|
|||
|
||||
private void onPaymentReceived(ActionEvent actionEvent) {
|
||||
log.debug("onPaymentReceived");
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
Preferences preferences = model.dataModel.getPreferences();
|
||||
String key = PopupId.PAYMENT_RECEIVED;
|
||||
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
|
||||
|
@ -124,7 +124,7 @@ public class ConfirmPaymentReceivedView extends TradeStepDetailsView {
|
|||
confirmPaymentReceived();
|
||||
}
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -140,7 +140,7 @@ public class StartPaymentView extends TradeStepDetailsView {
|
|||
|
||||
private void onPaymentStarted(ActionEvent actionEvent) {
|
||||
log.debug("onPaymentStarted");
|
||||
if (model.isAuthenticated()) {
|
||||
if (model.isNetworkReady()) {
|
||||
String key = PopupId.PAYMENT_SENT;
|
||||
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
|
||||
new Popup().headLine("Confirmation")
|
||||
|
@ -154,7 +154,7 @@ public class StartPaymentView extends TradeStepDetailsView {
|
|||
confirmPaymentStarted();
|
||||
}
|
||||
} else {
|
||||
new Popup().warning("You need to wait until your client is authenticated in the network.\n" +
|
||||
new Popup().warning("You need to wait until your client is bootstrapped in the network.\n" +
|
||||
"That might take up to about 2 minutes at startup.").show();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@
|
|||
<ComboBox fx:id="netWorkComboBox" GridPane.rowIndex="0" GridPane.columnIndex="1"/>
|
||||
|
||||
<Label fx:id="bitcoinPeersLabel" text="Connected peers:" GridPane.rowIndex="1"/>
|
||||
<TextArea fx:id="bitcoinPeersTextArea" GridPane.rowIndex="1" GridPane.columnIndex="1"
|
||||
<TextArea fx:id="bitcoinPeersTextArea" GridPane.rowIndex="1" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
||||
editable="false" focusTraversable="false"/>
|
||||
|
||||
|
||||
|
@ -62,8 +62,8 @@
|
|||
</GridPane.margin>
|
||||
</TextField>
|
||||
|
||||
<Label fx:id="authenticatedPeersLabel" text="Authenticated peers:" GridPane.rowIndex="4"/>
|
||||
<TextArea fx:id="authenticatedPeersTextArea" GridPane.rowIndex="4" GridPane.columnIndex="1"
|
||||
<Label fx:id="p2PPeersLabel" text="Connected peers:" GridPane.rowIndex="4"/>
|
||||
<TextArea fx:id="p2PPeersTextArea" GridPane.rowIndex="4" GridPane.columnIndex="1" GridPane.hgrow="ALWAYS"
|
||||
editable="false" focusTraversable="false"/>
|
||||
|
||||
<columnConstraints>
|
||||
|
|
|
@ -65,14 +65,14 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
@FXML
|
||||
ComboBox<BitcoinNetwork> netWorkComboBox;
|
||||
@FXML
|
||||
TextArea bitcoinPeersTextArea, authenticatedPeersTextArea;
|
||||
TextArea bitcoinPeersTextArea, p2PPeersTextArea;
|
||||
@FXML
|
||||
Label bitcoinPeersLabel, authenticatedPeersLabel;
|
||||
Label bitcoinPeersLabel, p2PPeersLabel;
|
||||
|
||||
private P2PServiceListener p2PServiceListener;
|
||||
private ChangeListener<Number> numAuthenticatedPeersChangeListener;
|
||||
private ChangeListener<Number> numP2PPeersChangeListener;
|
||||
private ChangeListener<List<Peer>> bitcoinPeersChangeListener;
|
||||
private final Set<NodeAddress> seedNodeNodeAddresses;
|
||||
private final Set<NodeAddress> seedNodeAddresses;
|
||||
|
||||
@Inject
|
||||
public NetworkSettingsView(WalletService walletService, P2PService p2PService, Preferences preferences,
|
||||
|
@ -84,14 +84,14 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
BitcoinNetwork bitcoinNetwork = preferences.getBitcoinNetwork();
|
||||
|
||||
boolean useLocalhost = p2PService.getNetworkNode() instanceof LocalhostNetworkNode;
|
||||
this.seedNodeNodeAddresses = seedNodesRepository.getSeedNodeAddresses(useLocalhost, bitcoinNetwork.ordinal());
|
||||
this.seedNodeAddresses = seedNodesRepository.getSeedNodeAddresses(useLocalhost, bitcoinNetwork.ordinal());
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
GridPane.setMargin(bitcoinPeersLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(bitcoinPeersLabel, VPos.TOP);
|
||||
GridPane.setMargin(authenticatedPeersLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(authenticatedPeersLabel, VPos.TOP);
|
||||
GridPane.setMargin(p2PPeersLabel, new Insets(4, 0, 0, 0));
|
||||
GridPane.setValignment(p2PPeersLabel, VPos.TOP);
|
||||
bitcoinPeersTextArea.setPrefRowCount(12);
|
||||
netWorkComboBox.setItems(FXCollections.observableArrayList(BitcoinNetwork.values()));
|
||||
netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork());
|
||||
|
@ -127,7 +127,7 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
}
|
||||
|
||||
@Override
|
||||
public void onFirstPeerAuthenticated() {
|
||||
public void onBootstrapped() {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -152,9 +152,9 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
walletService.connectedPeersProperty().addListener(bitcoinPeersChangeListener);
|
||||
updateBitcoinPeersTextArea();
|
||||
|
||||
numAuthenticatedPeersChangeListener = (observable, oldValue, newValue) -> updateAuthenticatedPeersTextArea();
|
||||
p2PService.getNumAuthenticatedPeers().addListener(numAuthenticatedPeersChangeListener);
|
||||
updateAuthenticatedPeersTextArea();
|
||||
numP2PPeersChangeListener = (observable, oldValue, newValue) -> updateP2PPeersTextArea();
|
||||
p2PService.getNumConnectedPeers().addListener(numP2PPeersChangeListener);
|
||||
updateP2PPeersTextArea();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -165,18 +165,18 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
|||
if (bitcoinPeersChangeListener != null)
|
||||
walletService.connectedPeersProperty().removeListener(bitcoinPeersChangeListener);
|
||||
|
||||
if (numAuthenticatedPeersChangeListener != null)
|
||||
p2PService.getNumAuthenticatedPeers().removeListener(numAuthenticatedPeersChangeListener);
|
||||
if (numP2PPeersChangeListener != null)
|
||||
p2PService.getNumConnectedPeers().removeListener(numP2PPeersChangeListener);
|
||||
}
|
||||
|
||||
private void updateAuthenticatedPeersTextArea() {
|
||||
authenticatedPeersTextArea.clear();
|
||||
p2PService.getAuthenticatedPeerNodeAddresses().stream().forEach(e -> {
|
||||
if (authenticatedPeersTextArea.getText().length() > 0)
|
||||
authenticatedPeersTextArea.appendText("\n");
|
||||
authenticatedPeersTextArea.appendText(e.getFullAddress());
|
||||
if (seedNodeNodeAddresses.contains(e))
|
||||
authenticatedPeersTextArea.appendText(" (Seed node)");
|
||||
private void updateP2PPeersTextArea() {
|
||||
p2PPeersTextArea.clear();
|
||||
p2PService.getNodeAddressesOfConnectedPeers().stream().forEach(e -> {
|
||||
if (p2PPeersTextArea.getText().length() > 0)
|
||||
p2PPeersTextArea.appendText("\n");
|
||||
p2PPeersTextArea.appendText(e.getFullAddress());
|
||||
if (seedNodeAddresses.contains(e))
|
||||
p2PPeersTextArea.appendText(" (Seed node)");
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
@ -83,7 +83,7 @@ public class Transitions {
|
|||
fade.setInterpolator(Interpolator.EASE_IN);
|
||||
fade.setOnFinished(actionEvent -> {
|
||||
((Pane) (node.getParent())).getChildren().remove(node);
|
||||
Profiler.printMsgWithTime("fadeOutAndRemove");
|
||||
//Profiler.printMsgWithTime("fadeOutAndRemove");
|
||||
if (handler != null)
|
||||
handler.handle(actionEvent);
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue