mirror of
https://github.com/haveno-dex/haveno.git
synced 2025-04-20 07:46:05 -04:00
Adopt fees, allow mainnet, add mainnet seednodes, fix missing update at tx list view
This commit is contained in:
parent
1a389a4e4c
commit
f7c2a219c9
@ -40,16 +40,15 @@ public class FeePolicy {
|
||||
|
||||
// Other good source is: https://tradeblock.com/blockchain 15-100 satoshis/byte
|
||||
|
||||
public static final Coin TX_FEE = Coin.valueOf(30000); // 0.0003 BTC about 0.06 EUR @ 200 EUR/BTC: about 90 satoshi /byte
|
||||
public static final Coin TX_FEE = Coin.valueOf(20000); // 0.0002 BTC about 0.8 EUR @ 400 EUR/BTC: about 70 satoshi /byte
|
||||
|
||||
static {
|
||||
// we use our fee as default fee
|
||||
Wallet.SendRequest.DEFAULT_FEE_PER_KB = FeePolicy.TX_FEE;
|
||||
Wallet.SendRequest.DEFAULT_FEE_PER_KB = Coin.valueOf(5000); // 0.0005 BTC we use a higher value. original is Coin.valueOf(1000)
|
||||
}
|
||||
|
||||
public static final Coin DUST = Coin.valueOf(546);
|
||||
|
||||
public static final Coin CREATE_OFFER_FEE = Coin.valueOf(100000); // 0.001 BTC 0.1% of 1 BTC about 0.2 EUR @ 200 EUR/BTC
|
||||
public static final Coin CREATE_OFFER_FEE = Coin.valueOf(100000); // 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC
|
||||
public static final Coin TAKE_OFFER_FEE = CREATE_OFFER_FEE;
|
||||
public static final Coin SECURITY_DEPOSIT = Coin.valueOf(10000000); // 0.1 BTC; about 20 EUR @ 200 EUR/BTC
|
||||
public static final Coin SECURITY_DEPOSIT = Coin.valueOf(10000000); // 0.1 BTC; about 40 EUR @ 400 EUR/BTC
|
||||
}
|
||||
|
@ -56,8 +56,6 @@ import java.util.concurrent.TimeUnit;
|
||||
import java.util.concurrent.TimeoutException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.google.common.base.Preconditions.checkArgument;
|
||||
|
||||
/**
|
||||
* WalletService handles all non trade specific wallet and bitcoin related services.
|
||||
* It startup the wallet app kit and initialized the wallet.
|
||||
@ -102,11 +100,6 @@ public class WalletService {
|
||||
this.tradeWalletService = tradeWalletService;
|
||||
this.addressEntryList = addressEntryList;
|
||||
this.params = preferences.getBitcoinNetwork().getParameters();
|
||||
|
||||
// TODO remove after sufficient testing with testnet
|
||||
checkArgument(!params.getId().equals(NetworkParameters.ID_MAINNET),
|
||||
"Mainnet is not allowed to be used at that stage of development");
|
||||
|
||||
this.walletDir = new File(walletDir, "bitcoin");
|
||||
this.userAgent = userAgent;
|
||||
}
|
||||
|
@ -37,7 +37,7 @@ public class OpenOffer implements Tradable, Serializable {
|
||||
|
||||
// Timeout for offer reservation during takeoffer process. If deposit tx is not completed in that time we reset the offer to AVAILABLE state.
|
||||
transient private static final long TIMEOUT_SEC = 30;
|
||||
private java.util.Timer timeoutTimer;
|
||||
transient private java.util.Timer timeoutTimer;
|
||||
|
||||
public enum State {
|
||||
AVAILABLE,
|
||||
|
@ -19,7 +19,6 @@ package io.bitsquare.trade.protocol.trade;
|
||||
|
||||
import io.bitsquare.common.UserThread;
|
||||
import io.bitsquare.common.crypto.PubKeyRing;
|
||||
import io.bitsquare.common.util.Utilities;
|
||||
import io.bitsquare.p2p.Address;
|
||||
import io.bitsquare.p2p.Message;
|
||||
import io.bitsquare.p2p.messaging.DecryptedMailListener;
|
||||
@ -124,7 +123,6 @@ public abstract class TradeProtocol {
|
||||
stopTimeout();
|
||||
|
||||
timeoutTimer = UserThread.runAfter(() -> {
|
||||
Utilities.setThreadName("TradeProtocol:Timeout");
|
||||
log.error("Timeout reached");
|
||||
trade.setErrorMessage("A timeout occurred.");
|
||||
cleanupTradable();
|
||||
|
@ -48,17 +48,17 @@ public class Preferences implements Serializable {
|
||||
// Deactivate mBit for now as most screens are not supporting it yet
|
||||
transient private static final List<String> BTC_DENOMINATIONS = Arrays.asList(MonetaryFormat.CODE_BTC/*, MonetaryFormat.CODE_MBTC*/);
|
||||
transient static final private ArrayList<BlockChainExplorer> blockChainExplorersTestNet = new ArrayList<>(Arrays.asList(
|
||||
new BlockChainExplorer("Blocktrail", "https://www.blocktrail.com/tBTC/tx/", "https://www.blocktrail.com/tBTC/address/"),
|
||||
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/testnet/tx/", "https://blockexplorer.com/testnet/address/"),
|
||||
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/testnet/transactions/", "https://www.biteasy.com/testnet/addresses/"),
|
||||
new BlockChainExplorer("Blocktrail", "https://www.blocktrail.com/tBTC/tx/", "https://www.blocktrail.com/tBTC/address/"),
|
||||
new BlockChainExplorer("Blockr.io", "https://tbtc.blockr.io/tx/info/", "https://tbtc.blockr.io/address/info/")
|
||||
));
|
||||
|
||||
transient static final private ArrayList<BlockChainExplorer> blockChainExplorersMainNet = new ArrayList<>(Arrays.asList(
|
||||
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/tx/", "https://blockexplorer.com/address/"),
|
||||
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/transactions/", "https://www.biteasy.com/addresses/"),
|
||||
new BlockChainExplorer("Blockchain.info", "https://blockchain.info/tx/", "https://blockchain.info/address/"),
|
||||
new BlockChainExplorer("Blocktrail", "https://www.blocktrail.com/BTC/tx/", "https://www.blocktrail.com/BTC/address/"),
|
||||
new BlockChainExplorer("Blockexplorer", "https://blockexplorer.com/tx/", "https://blockexplorer.com/address/"),
|
||||
new BlockChainExplorer("Biteasy", "https://www.biteasy.com/transactions/", "https://www.biteasy.com/addresses/"),
|
||||
new BlockChainExplorer("Blockr.io", "https://btc.blockr.io/tx/info/", "https://btc.blockr.io/address/info/")
|
||||
));
|
||||
|
||||
|
@ -31,7 +31,8 @@ import javafx.fxml.FXML;
|
||||
import javafx.scene.control.*;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.util.Callback;
|
||||
import org.bitcoinj.core.Transaction;
|
||||
import org.bitcoinj.core.*;
|
||||
import org.bitcoinj.script.Script;
|
||||
|
||||
import javax.inject.Inject;
|
||||
import java.util.List;
|
||||
@ -46,11 +47,12 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
||||
TableColumn<TransactionsListItem, TransactionsListItem> dateColumn, addressColumn, amountColumn, typeColumn,
|
||||
confidenceColumn;
|
||||
|
||||
private ObservableList<TransactionsListItem> transactionsListItems;
|
||||
private final ObservableList<TransactionsListItem> transactionsListItems = FXCollections.observableArrayList();
|
||||
|
||||
private final WalletService walletService;
|
||||
private final BSFormatter formatter;
|
||||
private final Preferences preferences;
|
||||
private WalletEventListener walletEventListener;
|
||||
|
||||
@Inject
|
||||
private TransactionsView(WalletService walletService, BSFormatter formatter, Preferences preferences) {
|
||||
@ -66,21 +68,63 @@ public class TransactionsView extends ActivatableView<VBox, Void> {
|
||||
|
||||
setAddressColumnCellFactory();
|
||||
setConfidenceColumnCellFactory();
|
||||
|
||||
walletEventListener = new WalletEventListener() {
|
||||
@Override
|
||||
public void onCoinsReceived(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
updateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCoinsSent(Wallet wallet, Transaction tx, Coin prevBalance, Coin newBalance) {
|
||||
updateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onReorganize(Wallet wallet) {
|
||||
updateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTransactionConfidenceChanged(Wallet wallet, Transaction tx) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onWalletChanged(Wallet wallet) {
|
||||
updateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScriptsChanged(Wallet wallet, List<Script> scripts, boolean isAddingScripts) {
|
||||
updateList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onKeysAdded(List<ECKey> keys) {
|
||||
updateList();
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activate() {
|
||||
private void updateList() {
|
||||
List<Transaction> transactions = walletService.getWallet().getRecentTransactions(10000, true);
|
||||
transactionsListItems = FXCollections.observableArrayList();
|
||||
transactionsListItems.clear();
|
||||
transactionsListItems.addAll(transactions.stream().map(transaction ->
|
||||
new TransactionsListItem(transaction, walletService, formatter)).collect(Collectors.toList()));
|
||||
|
||||
table.setItems(transactionsListItems);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void activate() {
|
||||
updateList();
|
||||
walletService.getWallet().addEventListener(walletEventListener);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void deactivate() {
|
||||
transactionsListItems.forEach(TransactionsListItem::cleanup);
|
||||
walletService.getWallet().removeEventListener(walletEventListener);
|
||||
}
|
||||
|
||||
private void openTxDetails(TransactionsListItem item) {
|
||||
|
@ -107,6 +107,12 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
||||
log.debug("currentTradeChangeListener {} ", newValue);
|
||||
setNewSubView(newValue);
|
||||
};
|
||||
|
||||
// we add hidden emergency shortcut to open support ticket
|
||||
root.getScene().addEventHandler(KeyEvent.KEY_RELEASED, event -> {
|
||||
if (new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN).match(event))
|
||||
new OpenEmergencyTicketPopup().onOpenTicket(() -> model.dataModel.onOpenSupportTicket()).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -127,12 +133,6 @@ public class PendingTradesView extends ActivatableViewAndModel<VBox, PendingTrad
|
||||
UserThread.execute(() -> table.getFocusModel().focus(index));
|
||||
});
|
||||
}
|
||||
|
||||
// we add hidden emergency shortcut to open support ticket
|
||||
root.getScene().addEventHandler(KeyEvent.KEY_RELEASED, event -> {
|
||||
if (new KeyCodeCombination(KeyCode.O, KeyCombination.SHORTCUT_DOWN).match(event))
|
||||
new OpenEmergencyTicketPopup().onOpenTicket(() -> model.dataModel.onOpenSupportTicket()).show();
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -195,9 +195,15 @@ public class NetworkSettingsView extends ActivatableViewAndModel<GridPane, Activ
|
||||
private void onSelectNetwork() {
|
||||
if (netWorkComboBox.getSelectionModel().getSelectedItem() != preferences.getBitcoinNetwork()) {
|
||||
if (netWorkComboBox.getSelectionModel().getSelectedItem() == BitcoinNetwork.MAINNET) {
|
||||
new Popup().warning("The application needs more tested before it can be used in mainnet.\n" +
|
||||
"Please follow our mailing list to get informed when Bitsquare will be ready for mainnet.")
|
||||
.onClose(() -> UserThread.execute(() -> netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork())))
|
||||
new Popup().warning("The application is not sufficiently tested yet and it so it is not recommended " +
|
||||
"to use mainnet yet.\n" +
|
||||
"If you want to take the risk to use Mainnet please use low trading amounts like 0.1 BTC " +
|
||||
"to limit possible losses.")
|
||||
.actionButtonText("I will wait and stick with Testnet")
|
||||
.onAction(() -> UserThread.execute(() -> netWorkComboBox.getSelectionModel().select(preferences.getBitcoinNetwork())))
|
||||
.closeButtonText("I understand the risk and want to use Mainnet")
|
||||
.onClose(() -> selectNetwork())
|
||||
.width(800)
|
||||
.show();
|
||||
} else {
|
||||
selectNetwork();
|
||||
|
@ -96,8 +96,9 @@ public class EmptyWalletPopup extends Popup {
|
||||
|
||||
Coin totalBalance = walletService.getAvailableBalance();
|
||||
boolean isBalanceSufficient = Restrictions.isMinSpendableAmount(totalBalance);
|
||||
Preconditions.checkArgument(isBalanceSufficient,
|
||||
"You cannot send an amount which are smaller than the fee + dust output.");
|
||||
if (totalBalance.compareTo(Coin.ZERO) > 0)
|
||||
Preconditions.checkArgument(isBalanceSufficient,
|
||||
"You cannot send an amount which are smaller than the fee + dust output.");
|
||||
addressTextField = addLabelTextField(gridPane, ++rowIndex, "Your available wallet balance:",
|
||||
formatter.formatCoinWithCode(totalBalance), 10).second;
|
||||
Tuple2<Label, InputTextField> tuple = addLabelInputTextField(gridPane, ++rowIndex, "Your destination address:");
|
||||
|
@ -463,7 +463,7 @@ public class P2PService implements SetupListener, MessageListener, ConnectionLis
|
||||
|
||||
public void sendEncryptedMailboxMessage(Address peerAddress, PubKeyRing peersPubKeyRing,
|
||||
MailboxMessage message, SendMailboxMessageListener sendMailboxMessageListener) {
|
||||
Log.traceCall();
|
||||
Log.traceCall("message " + message);
|
||||
checkNotNull(peerAddress, "PeerAddress must not be null (sendEncryptedMailboxMessage)");
|
||||
checkArgument(optionalKeyRing.isPresent(), "keyRing not set. Seems that is called on a seed node which must not happen.");
|
||||
checkArgument(!optionalKeyRing.get().getPubKeyRing().equals(peersPubKeyRing), "We got own keyring instead of that from peer");
|
||||
|
@ -16,9 +16,9 @@ public class SeedNodesRepository {
|
||||
// regtest use port 8002
|
||||
private Set<Address> torSeedNodeAddresses = Sets.newHashSet(
|
||||
// mainnet
|
||||
/*new Address("lmvdenjkyvx2ovga.onion:8000"),
|
||||
new Address("eo5ay2lyzrfvx2nr.onion:8000"),
|
||||
new Address("si3uu56adkyqkldl.onion:8000"),*/
|
||||
new Address("lih5zsr2bvxi24pk.onion:8000"),
|
||||
new Address("s5xpstlooosehtxm.onion:8000"),
|
||||
new Address("izs5oz7i5ta7c2ir.onion:8000"),
|
||||
|
||||
// testnet
|
||||
new Address("znmy44wcstn2rkva.onion:8001"),
|
||||
|
@ -20,7 +20,6 @@ public class SeedNodeMain {
|
||||
|
||||
// args: myAddress (incl. port) useLocalhost seedNodes (separated with |)
|
||||
// eg. lmvdenjkyvx2ovga.onion:8001 false eo5ay2lyzrfvx2nr.onion:8002|si3uu56adkyqkldl.onion:8003
|
||||
// To stop enter: q
|
||||
public static void main(String[] args) throws InterruptedException {
|
||||
new SeedNodeMain(args);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user