use bitcoin as currency in lowercase

This commit is contained in:
Manfred Karrer 2016-01-18 13:04:15 +01:00
parent 49b5ac5403
commit be4a25abb0
40 changed files with 109 additions and 114 deletions

View file

@ -38,7 +38,15 @@ public class Version {
public static final long PROTOCOL_VERSION = 1; public static final long PROTOCOL_VERSION = 1;
// The version for the bitcoin network (Mainnet = 0, TestNet = 1, Regtest = 2) // The version for the bitcoin network (Mainnet = 0, TestNet = 1, Regtest = 2)
public static int NETWORK_ID; private static int NETWORK_ID;
public static int getNetworkId() {
return NETWORK_ID;
}
public static void setNetworkId(int networkId) {
NETWORK_ID = networkId;
}
public static void printVersion() { public static void printVersion() {
log.info("Version{" + log.info("Version{" +
@ -50,4 +58,5 @@ public class Version {
'}'); '}');
} }
} }

View file

@ -21,7 +21,7 @@ import io.bitsquare.app.Version;
import io.bitsquare.p2p.messaging.MailboxMessage; import io.bitsquare.p2p.messaging.MailboxMessage;
public abstract class DisputeMessage implements MailboxMessage { public abstract class DisputeMessage implements MailboxMessage {
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
@Override @Override
public int networkId() { public int networkId() {

View file

@ -27,7 +27,7 @@ public abstract class OfferMessage implements MailMessage {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public final String offerId; public final String offerId;
protected OfferMessage(String offerId) { protected OfferMessage(String offerId) {

View file

@ -27,7 +27,7 @@ public abstract class TradeMessage implements MailMessage {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public final String tradeId; public final String tradeId;
@Override @Override

View file

@ -128,7 +128,7 @@ public class BitsquareApp extends Application {
injector = Guice.createInjector(bitsquareAppModule); injector = Guice.createInjector(bitsquareAppModule);
injector.getInstance(InjectorViewFactory.class).setInjector(injector); injector.getInstance(InjectorViewFactory.class).setInjector(injector);
Version.NETWORK_ID = injector.getInstance(BitsquareEnvironment.class).getBitcoinNetwork().ordinal(); Version.setNetworkId(injector.getInstance(BitsquareEnvironment.class).getBitcoinNetwork().ordinal());
// load the main view and create the main scene // load the main view and create the main scene
CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class); CachingViewLoader viewLoader = injector.getInstance(CachingViewLoader.class);

View file

@ -62,13 +62,13 @@ public class AddressTextField extends AnchorPane {
textField.setId("address-text-field"); textField.setId("address-text-field");
textField.setEditable(false); textField.setEditable(false);
textField.textProperty().bind(address); textField.textProperty().bind(address);
Tooltip.install(textField, new Tooltip("Open your default Bitcoin wallet with that address.")); Tooltip.install(textField, new Tooltip("Open your default bitcoin wallet with that address."));
textField.setOnMouseClicked(mouseEvent -> { textField.setOnMouseClicked(mouseEvent -> {
try { try {
Utilities.openURI(URI.create(getBitcoinURI())); Utilities.openURI(URI.create(getBitcoinURI()));
} catch (Exception e) { } catch (Exception e) {
log.warn(e.getMessage()); log.warn(e.getMessage());
new Popup().warning("Opening a system Bitcoin wallet application has failed. " + new Popup().warning("Opening a default bitcoin wallet application has failed. " +
"Perhaps you don't have one installed?").show(); "Perhaps you don't have one installed?").show();
} }
}); });

View file

@ -60,7 +60,7 @@
</HBox> </HBox>
<InfoDisplay gridPane="$root" onAction="#onOpenHelp" rowIndex="4" <InfoDisplay gridPane="$root" onAction="#onOpenHelp" rowIndex="4"
text="Protect your wallet with a strong password. You need to enter the password any time you withdraw Bitcoin from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/> text="Protect your wallet with a strong password. You need to enter the password any time you withdraw bitcoin from your trading wallets. You can change the password later in the settings. Open the help menu for more information."/>
<columnConstraints> <columnConstraints>
<ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/> <ColumnConstraints hgrow="SOMETIMES" halignment="RIGHT" minWidth="140.0"/>

View file

@ -142,7 +142,7 @@ public class PasswordView extends ActivatableView<GridPane, Void> {
addTitledGroupBg(root, ++gridRow, 1, "Information", Layout.GROUP_DISTANCE); addTitledGroupBg(root, ++gridRow, 1, "Information", Layout.GROUP_DISTANCE);
addMultilineLabel(root, gridRow, addMultilineLabel(root, gridRow,
"With password protection you need to enter your password when" + "With password protection you need to enter your password when" +
" withdrawing Bitcoin out of your wallet or " + " withdrawing bitcoin out of your wallet or " +
"if you want to view or restore a wallet from seed words.\n" + "if you want to view or restore a wallet from seed words.\n" +
"For the transactions used in the trade process we don't support password protection as that would make automatic offer " + "For the transactions used in the trade process we don't support password protection as that would make automatic offer " +
"execution impossible.", "execution impossible.",

View file

@ -178,8 +178,8 @@ public class SeedWordsView extends ActivatableView<GridPane, Void> {
.headLine("Wallet is not empty") .headLine("Wallet is not empty")
.warning("You must empty this wallet out before attempting to restore an older one, as mixing wallets " + .warning("You must empty this wallet out before attempting to restore an older one, as mixing wallets " +
"together can lead to invalidated backups.\n\n" + "together can lead to invalidated backups.\n\n" +
"Please finalize your trades, close all your open offers and go to the Funds section to withdraw your Bitcoin.\n" + "Please finalize your trades, close all your open offers and go to the Funds section to withdraw your bitcoin.\n" +
"In case you cannot access your Bitcoin you can use the emergency tool to empty the wallet.\n" + "In case you cannot access your bitcoin you can use the emergency tool to empty the wallet.\n" +
"To open that emergency tool press cmd + e.") "To open that emergency tool press cmd + e.")
.show(); .show();
} else if (wallet.isEncrypted()) { } else if (wallet.isEncrypted()) {

View file

@ -116,7 +116,7 @@ public abstract class OfferView extends ActivatableView<TabPane, Void> {
if (viewClass == OfferBookView.class && offerBookView == null) { if (viewClass == OfferBookView.class && offerBookView == null) {
view = viewLoader.load(viewClass); view = viewLoader.load(viewClass);
// Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens. // Offerbook must not be cached by ViewLoader as we use 2 instances for sell and buy screens.
final Tab tab = new Tab(direction == Offer.Direction.BUY ? "Buy Bitcoin" : "Sell Bitcoin"); final Tab tab = new Tab(direction == Offer.Direction.BUY ? "Buy bitcoin" : "Sell bitcoin");
tab.setClosable(false); tab.setClosable(false);
tab.setContent(view.getRoot()); tab.setContent(view.getRoot());
tabPane.getTabs().add(tab); tabPane.getTabs().add(tab);

View file

@ -225,9 +225,9 @@ public class CreateOfferView extends ActivatableViewAndModel<AnchorPane, CreateO
new Popup().information("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" + new Popup().information("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" +
"The deposit will stay in your local trading wallet until the offer gets accepted by another trader.\n" + "The deposit will stay in your local trading wallet until the offer gets accepted by another trader.\n" +
"It will be refunded to you after the trade has successfully completed.\n\n" + "It will be refunded to you after the trade has successfully completed.\n\n" +
"You need to pay in the exact amount displayed to you from your external Bitcoin wallet into the " + "You need to pay in the exact amount displayed to you from your external bitcoin wallet into the " +
"Bitsquare trade wallet. The amount is the sum of the security deposit, the trading fee and " + "Bitsquare trade wallet. The amount is the sum of the security deposit, the trading fee and " +
"the Bitcoin mining fee.\n" + "the bitcoin mining fee.\n" +
"You can see the details when you move the mouse over the question mark.").show(); "You can see the details when you move the mouse over the question mark.").show();
model.onSecurityDepositInfoDisplayed(); model.onSecurityDepositInfoDisplayed();

View file

@ -359,10 +359,10 @@ public class TakeOfferView extends ActivatableViewAndModel<AnchorPane, TakeOffer
}); });
new Popup().information("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" + new Popup().information("To ensure that both traders follow the trade protocol they need to pay a security deposit.\n\n" +
"The security deposit will be refunded to you after the trade has successfully completed.\n\n" + "The security deposit will be refunded to you after the trade has successfully completed.\n\n" +
"You need to pay in the exact amount displayed to you from your external Bitcoin wallet into the " + "You need to pay in the exact amount displayed to you from your external bitcoin wallet into the " +
"Bitsquare trade wallet. In case you over pay, you will get it refunded after the trade.\n\n" + "Bitsquare trade wallet. In case you over pay, you will get it refunded after the trade.\n\n" +
"The amount needed for funding is the sum of the trade amount, the security deposit, " + "The amount needed for funding is the sum of the trade amount, the security deposit, " +
"the trading fee and the Bitcoin mining fee.\n" + "the trading fee and the bitcoin mining fee.\n" +
"You can see the details when you move the mouse over the question mark.").show(); "You can see the details when you move the mouse over the question mark.").show();
model.onSecurityDepositInfoDisplayed(); model.onSecurityDepositInfoDisplayed();

View file

@ -100,46 +100,6 @@ public class OpenOffersView extends ActivatableViewAndModel<VBox, OpenOffersView
}); });
} }
/* private void openOfferDetails(OpenOfferListItem item) {
Offer offer = item.getOffer();
int rowIndex = 0;
GridPane gridPane = new GridPane();
gridPane.setPrefWidth(700);
gridPane.setPadding(new Insets(30, 30, 30, 30));
gridPane.setHgap(Layout.GRID_GAP);
gridPane.setVgap(Layout.GRID_GAP);
gridPane.setStyle("-fx-background-color: -bs-content-bg-grey");
ColumnConstraints columnConstraints1 = new ColumnConstraints();
columnConstraints1.setHalignment(HPos.RIGHT);
columnConstraints1.setHgrow(Priority.SOMETIMES);
ColumnConstraints columnConstraints2 = new ColumnConstraints();
columnConstraints2.setHgrow(Priority.ALWAYS);
gridPane.getColumnConstraints().addAll(columnConstraints1, columnConstraints2);
int rows = offer.getPaymentMethodCountry() == null ? 10 : 11;
addTitledGroupBg(gridPane, rowIndex, rows, "Offer details");
addLabelTextField(gridPane, rowIndex, "Offer ID:", offer.getId(), Layout.FIRST_ROW_DISTANCE);
addLabelTextField(gridPane, ++rowIndex, "Creation date:", formatter.formatDateTime(offer.getDate()));
addLabelTextField(gridPane, ++rowIndex, "Offer direction:", formatter.formatDirection(offer.getDirection()));
addLabelTextField(gridPane, ++rowIndex, "Currency code:", offer.getCurrencyCode());
addLabelTextField(gridPane, ++rowIndex, "Price:", formatter.formatFiat(offer.getPrice()));
addLabelTextField(gridPane, ++rowIndex, "Bitcoin amount:", formatter.formatCoin(offer.getAmount()));
addLabelTextField(gridPane, ++rowIndex, "Min. amount:", formatter.formatCoin(offer.getMinAmount()));
addLabelTextField(gridPane, ++rowIndex, "Payment method:", BSResources.get(offer.getPaymentMethod().getName()));
if (offer.getPaymentMethodCountry() != null)
addLabelTextField(gridPane, ++rowIndex, "Country of bank:", offer.getPaymentMethodCountry().code);
addLabelTextField(gridPane, ++rowIndex, "Accepted arbitrators:", formatter.arbitratorNamesToString(offer.getArbitratorNames()));
addLabelTxIdTextField(gridPane, ++rowIndex, "Create offer fee transaction ID:", offer.getOfferFeePaymentTxID());
Button closeButton = addButton(gridPane, ++rowIndex, "Close");
GridPane.setMargin(closeButton, new Insets(15, 0, 0, 0));
PopOver popover = PopOvers.getPopOver(gridPane);
PopOvers.showInCenter(popover);
closeButton.setOnAction(e -> popover.hide());
}*/
private void setOfferIdColumnCellFactory() { private void setOfferIdColumnCellFactory() {
offerIdColumn.setCellValueFactory((openOfferListItem) -> new ReadOnlyObjectWrapper<>(openOfferListItem.getValue())); offerIdColumn.setCellValueFactory((openOfferListItem) -> new ReadOnlyObjectWrapper<>(openOfferListItem.getValue()));
offerIdColumn.setCellFactory( offerIdColumn.setCellFactory(

View file

@ -104,7 +104,7 @@ public class BuyerSubView extends TradeSubView {
startPayment.setCompleted(); startPayment.setCompleted();
showItem(waitPaymentReceived); showItem(waitPaymentReceived);
((WaitPaymentReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Waiting for the Bitcoin sellers confirmation " + ((WaitPaymentReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("Waiting for the bitcoin sellers confirmation " +
"that the {0} payment has arrived.", "that the {0} payment has arrived.",
model.getCurrencyCode())); model.getCurrencyCode()));
break; break;
@ -116,7 +116,7 @@ public class BuyerSubView extends TradeSubView {
showItem(waitPayoutUnlock); showItem(waitPayoutUnlock);
((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." + ((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." +
"\nFor reducing bank charge back risks you need to wait until the payout gets unlocked to transfer your Bitcoin."); "\nFor reducing bank charge back risks you need to wait until the payout gets unlocked to transfer your bitcoin.");
} }
break; break;
case REQUEST_WITHDRAWAL: case REQUEST_WITHDRAWAL:

View file

@ -93,7 +93,7 @@ public class SellerSubView extends TradeSubView {
showItem(waitTxInBlockchain); showItem(waitTxInBlockchain);
((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. " + ((WaitTxInBlockchainView) tradeStepDetailsView).setInfoLabelText("Deposit transaction has been published. " +
"The Bitcoin buyer need to wait for at least one blockchain confirmation."); "The bitcoin buyer need to wait for at least one blockchain confirmation.");
break; break;
case WAIT_FOR_FIAT_PAYMENT_STARTED: case WAIT_FOR_FIAT_PAYMENT_STARTED:
waitTxInBlockchain.setCompleted(); waitTxInBlockchain.setCompleted();
@ -110,11 +110,11 @@ public class SellerSubView extends TradeSubView {
showItem(confirmPaymentReceived); showItem(confirmPaymentReceived);
if (model.isBlockChainMethod()) { if (model.isBlockChainMethod()) {
((ConfirmPaymentReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The Bitcoin buyer has started the {0} payment. " + ((ConfirmPaymentReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The bitcoin buyer has started the {0} payment. " +
"Check your Altcoin wallet or Block explorer and confirm when you have received the payment.", "Check your Altcoin wallet or Block explorer and confirm when you have received the payment.",
model.getCurrencyCode())); model.getCurrencyCode()));
} else { } else {
((ConfirmPaymentReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The Bitcoin buyer has started the {0} payment. " + ((ConfirmPaymentReceivedView) tradeStepDetailsView).setInfoLabelText(BSResources.get("The bitcoin buyer has started the {0} payment. " +
"Check your payment account and confirm when you have received the payment.", "Check your payment account and confirm when you have received the payment.",
model.getCurrencyCode())); model.getCurrencyCode()));
} }
@ -141,7 +141,7 @@ public class SellerSubView extends TradeSubView {
showItem(waitPayoutUnlock); showItem(waitPayoutUnlock);
((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." + ((WaitPayoutLockTimeView) tradeStepDetailsView).setInfoLabelText("The payout transaction is signed and finalized by both parties." +
"\nFor reducing bank charge back risks you need to wait until the payout gets unlocked to transfer your Bitcoin."); "\nFor reducing bank charge back risks you need to wait until the payout gets unlocked to transfer your bitcoin.");
break; break;
case REQUEST_WITHDRAWAL: case REQUEST_WITHDRAWAL:
waitTxInBlockchain.setCompleted(); waitTxInBlockchain.setCompleted();

View file

@ -113,8 +113,8 @@ public class ConfirmPaymentReceivedView extends TradeStepDetailsView {
if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) { if (preferences.showAgain(key) && !BitsquareApp.DEV_MODE) {
new Popup().headLine("Confirmation") new Popup().headLine("Confirmation")
.message("Do you have received the payment from your trading partner?\n\n" + .message("Do you have received the payment from your trading partner?\n\n" +
"Please note that as soon you have confirmed the locked Bitcoin will be released.\n" + "Please note that as soon you have confirmed the locked bitcoin will be released.\n" +
"There is no way to reverse a Bitcoin payment.") "There is no way to reverse a bitcoin payment.")
.dontShowAgainId(key, preferences) .dontShowAgainId(key, preferences)
.actionButtonText("Yes I have received the payment") .actionButtonText("Yes I have received the payment")
.closeButtonText("No") .closeButtonText("No")

View file

@ -84,7 +84,7 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
BitcoinNetwork bitcoinNetwork = preferences.getBitcoinNetwork(); BitcoinNetwork bitcoinNetwork = preferences.getBitcoinNetwork();
boolean useLocalhost = p2PService.getNetworkNode() instanceof LocalhostNetworkNode; boolean useLocalhost = p2PService.getNetworkNode() instanceof LocalhostNetworkNode;
this.seedNodeAddresses = seedNodesRepository.geSeedNodeAddresses(useLocalhost, bitcoinNetwork.ordinal()); this.seedNodeAddresses = seedNodesRepository.getSeedNodeAddresses(useLocalhost, bitcoinNetwork.ordinal());
} }
public void initialize() { public void initialize() {

View file

@ -370,6 +370,6 @@ public class BSFormatter {
} }
public String getDirectionDescription(Offer.Direction direction) { public String getDirectionDescription(Offer.Direction direction) {
return direction == Offer.Direction.BUY ? "Offerer as Bitcoin buyer / Taker as Bitcoin seller" : "Offerer as Bitcoin seller / Taker as Bitcoin buyer"; return direction == Offer.Direction.BUY ? "Offerer as bitcoin buyer / Taker as bitcoin seller" : "Offerer as bitcoin seller / Taker as bitcoin buyer";
} }
} }

View file

@ -47,7 +47,7 @@ public final class BtcAddressValidator extends InputValidator {
new Address(preferences.getBitcoinNetwork().getParameters(), input); new Address(preferences.getBitcoinNetwork().getParameters(), input);
return new ValidationResult(true); return new ValidationResult(true);
} catch (AddressFormatException e) { } catch (AddressFormatException e) {
return new ValidationResult(false, "Bitcoin address is a valid format"); return new ValidationResult(false, "Invalid format of the bitcoin address.");
} }
} }
} }

View file

@ -10,8 +10,8 @@ shared.yes=Yes
shared.no=No shared.no=No
shared.openSettings=Open settings for editing shared.openSettings=Open settings for editing
shared.buyBitcoin=Buy Bitcoin shared.buyBitcoin=Buy bitcoin
shared.sellBitcoin=Sell Bitcoin shared.sellBitcoin=Sell bitcoin
shared.buy=buy shared.buy=buy
shared.sell=sell shared.sell=sell
shared.spend=spend shared.spend=spend
@ -23,7 +23,7 @@ validation.zero=Input of 0 is not allowed.
validation.negative=A negative value is not allowed. validation.negative=A negative value is not allowed.
validation.fiat.toSmall=Input smaller as minimum possible amount is not allowed. validation.fiat.toSmall=Input smaller as minimum possible amount is not allowed.
validation.fiat.toLarge=Input larger as maximum possible amount is not allowed. validation.fiat.toLarge=Input larger as maximum possible amount is not allowed.
validation.btc.toSmall=Input results in a Bitcoin value with a fraction of the smallest unit (Satoshi). validation.btc.toSmall=Input results in a bitcoin value with a fraction of the smallest unit (Satoshi).
validation.btc.toLarge=Input larger as maximum trading amount of {0} is not allowed. validation.btc.toLarge=Input larger as maximum trading amount of {0} is not allowed.
validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters. validation.passwordTooShort=The password you entered is too short. It needs to have min. 8 characters.
@ -34,27 +34,27 @@ createOffer.volume.prompt=Enter amount in {0}
createOffer.minAmount.prompt=Enter min. amount createOffer.minAmount.prompt=Enter min. amount
createOffer.amountPriceBox.title=Create your offer createOffer.amountPriceBox.title=Create your offer
createOffer.amountPriceBox.amountDescription=Amount of Bitcoin to {0} createOffer.amountPriceBox.amountDescription=Amount of bitcoin to {0}
createOffer.amountPriceBox.priceDescription=Price per Bitcoin in {0} createOffer.amountPriceBox.priceDescription=Price per bitcoin in {0}
createOffer.amountPriceBox.buy.volumeDescription=Amount in {0} to spend createOffer.amountPriceBox.buy.volumeDescription=Amount in {0} to spend
createOffer.amountPriceBox.sell.volumeDescription=Amount in {0} to receive createOffer.amountPriceBox.sell.volumeDescription=Amount in {0} to receive
createOffer.amountPriceBox.minAmountDescription=Minimum amount of Bitcoin createOffer.amountPriceBox.minAmountDescription=Minimum amount of bitcoin
createOffer.amountPriceBox.buy.info=Define a price for which you want to buy Bitcoin and either enter the amount or the trade volume. With the minimum amount you can attract more potential traders with giving them more flexibility. But note that there is no automatic creation of a new offer for the remaining amount in the case that a trader takes your offer with a lower amount as defined in the amount field. Your offer will be removed from the offerbook once a trader has taken your offer. createOffer.amountPriceBox.buy.info=Define a price for which you want to buy bitcoin and either enter the amount or the trade volume. With the minimum amount you can attract more potential traders with giving them more flexibility. But note that there is no automatic creation of a new offer for the remaining amount in the case that a trader takes your offer with a lower amount as defined in the amount field. Your offer will be removed from the offerbook once a trader has taken your offer.
createOffer.amountPriceBox.sell.info=Define a price for which you want to sell Bitcoin and either enter the amount or the trade volume. With the minimum amount you can attract more potential traders with giving them more flexibility. But note that there is no automatic creation of a new offer for the remaining amount in the case that a trader takes your offer with a lower amount as defined in the amount field. Your offer will be removed from the offerbook once a trader has taken your offer. createOffer.amountPriceBox.sell.info=Define a price for which you want to sell bitcoin and either enter the amount or the trade volume. With the minimum amount you can attract more potential traders with giving them more flexibility. But note that there is no automatic creation of a new offer for the remaining amount in the case that a trader takes your offer with a lower amount as defined in the amount field. Your offer will be removed from the offerbook once a trader has taken your offer.
createOffer.amountPriceBox.next=Next step createOffer.amountPriceBox.next=Next step
createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places. createOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.
createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places. createOffer.amountPriceBox.warning.invalidFiatDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places. The amount has been adjusted to 2 decimal places.
createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional Bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it. createOffer.amountPriceBox.warning.adjustedVolume=The total volume you have entered leads to invalid fractional bitcoin amounts. The amount has been adjusted and a new total volume be calculated from it.
createOffer.amountPriceBox.error.message=An error occurred when placing the offer:\n\n{0} createOffer.amountPriceBox.error.message=An error occurred when placing the offer:\n\n{0}
createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount. createOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount.
createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount. createOffer.validation.minAmountLargerThanAmount=Minimum amount cannot be larger than amount.
createOffer.fundsBox.title=Fund your trade wallet createOffer.fundsBox.title=Fund your trade wallet
createOffer.fundsBox.totalsNeeded=Funds needed for that trade: createOffer.fundsBox.totalsNeeded=Funds needed for that trade:
createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amount entered above createOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the bitcoin amount entered above
createOffer.fundsBox.address=Trade wallet address: createOffer.fundsBox.address=Trade wallet address:
createOffer.fundsBox.balance=Trade wallet balance: createOffer.fundsBox.balance=Trade wallet balance:
createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment. createOffer.fundsBox.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary bitcoin amount. Those funds are reserved and will be used in the case that your offer gets executed. If you cancel your offer you can withdraw your funds from that trading wallet. The only payment which will be done now when placing the offer is the offer fee payment.
createOffer.fundsBox.tradeAmount=Trade amount: createOffer.fundsBox.tradeAmount=Trade amount:
createOffer.fundsBox.securityDeposit=Security deposit: createOffer.fundsBox.securityDeposit=Security deposit:
createOffer.fundsBox.offerFee=Offer fee: createOffer.fundsBox.offerFee=Offer fee:
@ -88,15 +88,15 @@ takeOffer.volume.prompt=Enter amount in {0}
takeOffer.minAmount.prompt=Enter min. amount takeOffer.minAmount.prompt=Enter min. amount
takeOffer.amountPriceBox.title=Take offer takeOffer.amountPriceBox.title=Take offer
takeOffer.amountPriceBox.subTitle=Buy Bitcoin takeOffer.amountPriceBox.subTitle=Buy bitcoin
takeOffer.amountPriceBox.buy.amountDescription=Amount of Bitcoin to sell takeOffer.amountPriceBox.buy.amountDescription=Amount of bitcoin to sell
takeOffer.amountPriceBox.sell.amountDescription=Amount of Bitcoin to buy takeOffer.amountPriceBox.sell.amountDescription=Amount of bitcoin to buy
takeOffer.amountPriceBox.priceDescription=Price per Bitcoin in {0} takeOffer.amountPriceBox.priceDescription=Price per bitcoin in {0}
takeOffer.amountPriceBox.buy.volumeDescription=Receiving amount in {0} takeOffer.amountPriceBox.buy.volumeDescription=Receiving amount in {0}
takeOffer.amountPriceBox.sell.volumeDescription=Amount in {0} to spend takeOffer.amountPriceBox.sell.volumeDescription=Amount in {0} to spend
takeOffer.amountPriceBox.amountRangeDescription=Possible amount range takeOffer.amountPriceBox.amountRangeDescription=Possible amount range
takeOffer.amountPriceBox.buy.info=Enter the amount of Bitcoin you want to sell. You can choose an amount between the minimum amount and the amount. takeOffer.amountPriceBox.buy.info=Enter the amount of bitcoin you want to sell. You can choose an amount between the minimum amount and the amount.
takeOffer.amountPriceBox.sell.info=Enter the amount of Bitcoin you want to buy. You can choose an amount between the minimum amount and the amount. takeOffer.amountPriceBox.sell.info=Enter the amount of bitcoin you want to buy. You can choose an amount between the minimum amount and the amount.
takeOffer.amountPriceBox.next=Next step takeOffer.amountPriceBox.next=Next step
takeOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places. takeOffer.amountPriceBox.warning.invalidBtcDecimalPlaces=The amount you have entered exceeds the number of allowed decimal places.\nThe amount has been adjusted to 4 decimal places.
takeOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount defined in the offer. takeOffer.validation.amountSmallerThanMinAmount=Amount cannot be smaller than minimum amount defined in the offer.
@ -105,13 +105,13 @@ takeOffer.validation.amountLargerThanOfferAmount=Input amount cannot be higher t
takeOffer.fundsBox.title=Fund your trade wallet takeOffer.fundsBox.title=Fund your trade wallet
takeOffer.fundsBox.isOfferAvailable=Check if offer is available... takeOffer.fundsBox.isOfferAvailable=Check if offer is available...
takeOffer.fundsBox.totalsNeeded=Funds needed for that trade: takeOffer.fundsBox.totalsNeeded=Funds needed for that trade:
takeOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the Bitcoin amount entered above takeOffer.fundsBox.totalsNeeded.prompt=Will be calculated from the bitcoin amount entered above
takeOffer.fundsBox.address=Trade wallet address: takeOffer.fundsBox.address=Trade wallet address:
takeOffer.fundsBox.balance=Trade wallet balance: takeOffer.fundsBox.balance=Trade wallet balance:
takeOffer.fundsBox.buy.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those \ takeOffer.fundsBox.buy.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary bitcoin amount. Those \
funds will be paid in to a locked deposit address. At the end of a successful trade you will get back your security deposit and the Bitcoin amount you sold will be transferred to the \ funds will be paid in to a locked deposit address. At the end of a successful trade you will get back your security deposit and the bitcoin amount you sold will be transferred to the \
buyer. buyer.
takeOffer.fundsBox.sell.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary Bitcoin amount. Those \ takeOffer.fundsBox.sell.info=For every offer there is a dedicated trade wallet. You need to fund that trade wallet with the necessary bitcoin amount. Those \
funds will be paid in to a locked deposit address. At the end of a successful trade you will get back your security deposit. funds will be paid in to a locked deposit address. At the end of a successful trade you will get back your security deposit.
takeOffer.fundsBox.tradeAmount=Amount to sell: takeOffer.fundsBox.tradeAmount=Amount to sell:
takeOffer.fundsBox.securityDeposit=Security deposit: takeOffer.fundsBox.securityDeposit=Security deposit:
@ -135,7 +135,7 @@ takeOffer.advancedBox.info=These are the offer restrictions your trading partner
settings are matching those constraints and you are able to trade with him. settings are matching those constraints and you are able to trade with him.
takeOffer.success.headline=Your have successfully published the deposit. takeOffer.success.headline=Your have successfully published the deposit.
takeOffer.success.info=You need to wait now for the Bitcoin buyer to transfer the money to you. \nYou will get a \ takeOffer.success.info=You need to wait now for the bitcoin buyer to transfer the money to you. \nYou will get a \
notification when he has started the EUR payment. You can see the status of your trade in the \"Portfolio\" screen \ notification when he has started the EUR payment. You can see the status of your trade in the \"Portfolio\" screen \
under \"Open trades\". under \"Open trades\".
takeOffer.error.message=An error occurred when taking the offer.\n\n{0} takeOffer.error.message=An error occurred when taking the offer.\n\n{0}

View file

@ -11,7 +11,7 @@ public final class SealedAndSignedMessage implements MailboxMessage {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public final SealedAndSigned sealedAndSigned; public final SealedAndSigned sealedAndSigned;
public final byte[] addressPrefixHash; public final byte[] addressPrefixHash;

View file

@ -116,7 +116,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
if (persistedOnionAddress != null) if (persistedOnionAddress != null)
this.myOnionAddress = persistedOnionAddress; this.myOnionAddress = persistedOnionAddress;
seedNodeAddresses = seedNodesRepository.geSeedNodeAddresses(useLocalhost, networkId); seedNodeAddresses = seedNodesRepository.getSeedNodeAddresses(useLocalhost, networkId);
// network node // network node
networkNode = useLocalhost ? new LocalhostNetworkNode(port) : new TorNetworkNode(port, torDir); networkNode = useLocalhost ? new LocalhostNetworkNode(port) : new TorNetworkNode(port, torDir);

View file

@ -30,7 +30,7 @@ public class SeedNodeP2PService extends P2PService {
@Override @Override
protected PeerManager getNewPeerManager() { protected PeerManager getNewPeerManager() {
return new SeedNodePeerManager(networkNode, storageDir); return new SeedNodePeerManager(networkNode);
} }
@Override @Override

View file

@ -26,7 +26,7 @@ public final class DecryptedMsgWithPubKey implements MailMessage {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public final Message message; public final Message message;
public final PublicKey signaturePubKey; public final PublicKey signaturePubKey;

View file

@ -552,7 +552,7 @@ public class Connection implements MessageListener {
} }
Message message = (Message) serializable; Message message = (Message) serializable;
if (message.networkId() != Version.NETWORK_ID) { if (message.networkId() != Version.getNetworkId()) {
sharedSpace.reportIllegalRequest(IllegalRequest.WrongNetworkId); sharedSpace.reportIllegalRequest(IllegalRequest.WrongNetworkId);
return; return;
} }

View file

@ -5,7 +5,7 @@ public enum IllegalRequest {
MaxSizeExceeded(1), MaxSizeExceeded(1),
NotAuthenticated(1), NotAuthenticated(1),
InvalidDataType(1), InvalidDataType(1),
WrongNetworkId(1); WrongNetworkId(0);
public final int maxTolerance; public final int maxTolerance;

View file

@ -8,7 +8,7 @@ public final class CloseConnectionMessage implements Message {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public Address peerAddress; public Address peerAddress;
public CloseConnectionMessage() { public CloseConnectionMessage() {

View file

@ -60,7 +60,8 @@ public class PeerManager implements MessageListener, ConnectionListener {
private final NetworkNode networkNode; private final NetworkNode networkNode;
private final PeerExchangeManager peerExchangeManager; private final PeerExchangeManager peerExchangeManager;
protected final ScheduledThreadPoolExecutor checkSeedNodeConnectionExecutor; protected final ScheduledThreadPoolExecutor checkSeedNodeConnectionExecutor;
private final Storage<HashSet<ReportedPeer>> dbStorage; @Nullable
private Storage<HashSet<ReportedPeer>> dbStorage;
private final CopyOnWriteArraySet<AuthenticationListener> authenticationListeners = new CopyOnWriteArraySet<>(); private final CopyOnWriteArraySet<AuthenticationListener> authenticationListeners = new CopyOnWriteArraySet<>();
protected final Map<Address, Peer> authenticatedPeers = new HashMap<>(); protected final Map<Address, Peer> authenticatedPeers = new HashMap<>();
@ -80,7 +81,7 @@ public class PeerManager implements MessageListener, ConnectionListener {
Log.traceCall(); Log.traceCall();
this.networkNode = networkNode; this.networkNode = networkNode;
dbStorage = new Storage<>(storageDir); createDbStorage(storageDir);
peerExchangeManager = new PeerExchangeManager(networkNode, peerExchangeManager = new PeerExchangeManager(networkNode,
() -> getAuthenticatedAndReportedPeers(), () -> getAuthenticatedAndReportedPeers(),
@ -92,10 +93,18 @@ public class PeerManager implements MessageListener, ConnectionListener {
init(); init();
} }
protected void createDbStorage(File storageDir) {
dbStorage = new Storage<>(storageDir);
}
private void init() { private void init() {
networkNode.addMessageListener(this); networkNode.addMessageListener(this);
networkNode.addConnectionListener(this); networkNode.addConnectionListener(this);
initPersistedPeers();
}
protected void initPersistedPeers() {
HashSet<ReportedPeer> persistedPeers = dbStorage.initAndGetPersisted("persistedPeers"); HashSet<ReportedPeer> persistedPeers = dbStorage.initAndGetPersisted("persistedPeers");
if (persistedPeers != null) { if (persistedPeers != null) {
log.info("We have persisted reported peers. " + log.info("We have persisted reported peers. " +
@ -712,6 +721,8 @@ public class PeerManager implements MessageListener, ConnectionListener {
ReportedPeer reportedPeer = new ReportedPeer(peerAddress); ReportedPeer reportedPeer = new ReportedPeer(peerAddress);
if (persistedPeers.contains(reportedPeer)) { if (persistedPeers.contains(reportedPeer)) {
persistedPeers.remove(reportedPeer); persistedPeers.remove(reportedPeer);
if (dbStorage != null)
dbStorage.queueUpForSave(persistedPeers, 5000); dbStorage.queueUpForSave(persistedPeers, 5000);
} }
} }
@ -885,6 +896,8 @@ public class PeerManager implements MessageListener, ConnectionListener {
persistedPeers.remove(list.get(i)); persistedPeers.remove(list.get(i));
} }
} }
if (dbStorage != null)
dbStorage.queueUpForSave(persistedPeers); dbStorage.queueUpForSave(persistedPeers);
} }

View file

@ -15,8 +15,9 @@ import static com.google.common.base.Preconditions.checkArgument;
public class SeedNodePeerManager extends PeerManager { public class SeedNodePeerManager extends PeerManager {
private static final Logger log = LoggerFactory.getLogger(SeedNodePeerManager.class); private static final Logger log = LoggerFactory.getLogger(SeedNodePeerManager.class);
public SeedNodePeerManager(NetworkNode networkNode, File storageDir) {
super(networkNode, storageDir); public SeedNodePeerManager(NetworkNode networkNode) {
super(networkNode, null);
} }
public void authenticateToSeedNode() { public void authenticateToSeedNode() {
@ -32,6 +33,17 @@ public class SeedNodePeerManager extends PeerManager {
startCheckSeedNodeConnectionTask(); startCheckSeedNodeConnectionTask();
} }
@Override
protected void createDbStorage(File storageDir) {
// Do nothing.
// The seed node does not store persisted peers in the local db
}
@Override
protected void initPersistedPeers() {
// Do nothing.
// The seed node does not store persisted peers in the local db
}
@Override @Override
protected void onFirstSeedNodeAuthenticated() { protected void onFirstSeedNodeAuthenticated() {

View file

@ -5,7 +5,7 @@ import io.bitsquare.p2p.Address;
import io.bitsquare.p2p.Message; import io.bitsquare.p2p.Message;
public abstract class AuthenticationMessage implements Message { public abstract class AuthenticationMessage implements Message {
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public final Address senderAddress; public final Address senderAddress;

View file

@ -7,7 +7,7 @@ public final class DataRequest implements Message {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public DataRequest() { public DataRequest() {
} }

View file

@ -9,7 +9,7 @@ import java.util.HashSet;
public final class DataResponse implements Message { public final class DataResponse implements Message {
// That object is sent over the wire, so we need to take care of version compatibility. // That object is sent over the wire, so we need to take care of version compatibility.
private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION; private static final long serialVersionUID = Version.NETWORK_PROTOCOL_VERSION;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public final HashSet<ProtectedData> set; public final HashSet<ProtectedData> set;

View file

@ -4,7 +4,7 @@ import io.bitsquare.app.Version;
import io.bitsquare.p2p.Message; import io.bitsquare.p2p.Message;
public abstract class PeerExchangeMessage implements Message { public abstract class PeerExchangeMessage implements Message {
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
@Override @Override
public int networkId() { public int networkId() {

View file

@ -60,7 +60,7 @@ public class SeedNode {
int networkId = Integer.parseInt(arg1); int networkId = Integer.parseInt(arg1);
checkArgument(networkId > -1 && networkId < 3, checkArgument(networkId > -1 && networkId < 3,
"networkId out of scope (Mainnet = 0, TestNet = 1, Regtest = 2)"); "networkId out of scope (Mainnet = 0, TestNet = 1, Regtest = 2)");
Version.NETWORK_ID = networkId; Version.setNetworkId(networkId);
if (args.length > 2) { if (args.length > 2) {
String arg2 = args[2]; String arg2 = args[2];
int maxConnections = Integer.parseInt(arg2); int maxConnections = Integer.parseInt(arg2);
@ -100,7 +100,7 @@ public class SeedNode {
} }
public void createAndStartP2PService(boolean useDetailedLogging) { public void createAndStartP2PService(boolean useDetailedLogging) {
createAndStartP2PService(mySeedNodeAddress, useLocalhost, Version.NETWORK_ID, useDetailedLogging, progArgSeedNodes, null); createAndStartP2PService(mySeedNodeAddress, useLocalhost, Version.getNetworkId(), useDetailedLogging, progArgSeedNodes, null);
} }
@VisibleForTesting @VisibleForTesting

View file

@ -49,7 +49,7 @@ public class SeedNodesRepository {
new Address("localhost:4002") new Address("localhost:4002")
); );
public Set<Address> geSeedNodeAddresses(boolean useLocalhost, int networkId) { public Set<Address> getSeedNodeAddresses(boolean useLocalhost, int networkId) {
String networkIdAsString = String.valueOf(networkId); String networkIdAsString = String.valueOf(networkId);
Set<Address> addresses = useLocalhost ? localhostSeedNodeAddresses : torSeedNodeAddresses; Set<Address> addresses = useLocalhost ? localhostSeedNodeAddresses : torSeedNodeAddresses;
Set<Address> filtered = addresses.stream() Set<Address> filtered = addresses.stream()

View file

@ -4,7 +4,7 @@ import io.bitsquare.app.Version;
import io.bitsquare.p2p.Message; import io.bitsquare.p2p.Message;
public abstract class DataBroadcastMessage implements Message { public abstract class DataBroadcastMessage implements Message {
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
@Override @Override
public int networkId() { public int networkId() {

View file

@ -81,7 +81,7 @@ public class EncryptionServiceTests {
final class TestMessage implements MailboxMessage { final class TestMessage implements MailboxMessage {
public String data = "test"; public String data = "test";
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public TestMessage(String data) { public TestMessage(String data) {
this.data = data; this.data = data;

View file

@ -6,7 +6,7 @@ import io.bitsquare.p2p.messaging.MailboxMessage;
import io.bitsquare.p2p.storage.data.ExpirablePayload; import io.bitsquare.p2p.storage.data.ExpirablePayload;
public final class MockMailboxMessage implements MailboxMessage, ExpirablePayload { public final class MockMailboxMessage implements MailboxMessage, ExpirablePayload {
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public String msg; public String msg;
public Address senderAddress; public Address senderAddress;
public long ttl; public long ttl;

View file

@ -7,7 +7,7 @@ import io.bitsquare.p2p.storage.data.ExpirablePayload;
public final class MockMessage implements Message, ExpirablePayload { public final class MockMessage implements Message, ExpirablePayload {
public String msg; public String msg;
public long ttl; public long ttl;
private final int networkId = Version.NETWORK_ID; private final int networkId = Version.getNetworkId();
public MockMessage(String msg) { public MockMessage(String msg) {
this.msg = msg; this.msg = msg;

View file

@ -12,6 +12,7 @@ mvn clean package -DskipTests -Dmaven.javadoc.skip=true
cp gui/target/shaded.jar "gui/deploy/Bitsquare-$fullVersion.jar" cp gui/target/shaded.jar "gui/deploy/Bitsquare-$fullVersion.jar"
cp gui/target/shaded.jar "/Users/mk/vm_shared_ubuntu/Bitsquare-$fullVersion.jar" cp gui/target/shaded.jar "/Users/mk/vm_shared_ubuntu/Bitsquare-$fullVersion.jar"
cp gui/target/shaded.jar "/Users/mk/vm_shared_windows/Bitsquare-$fullVersion.jar" cp gui/target/shaded.jar "/Users/mk/vm_shared_windows/Bitsquare-$fullVersion.jar"
cp seednode/target/SeedNode.jar "gui/deploy/SeedNode.jar"
$JAVA_HOME/bin/javapackager \ $JAVA_HOME/bin/javapackager \
-deploy \ -deploy \