mirror of
https://github.com/bisq-network/bisq.git
synced 2025-01-19 05:44:05 +01:00
fix formatting bug, wrong fee payment, nullpointer with tab
This commit is contained in:
parent
d5a5db1d42
commit
88a3ec0f7b
@ -28,7 +28,7 @@ public class Relay extends Application
|
||||
}
|
||||
else
|
||||
{
|
||||
port = 5000;
|
||||
port = 5001;
|
||||
}
|
||||
|
||||
launch(args);
|
||||
|
@ -696,6 +696,11 @@ public class WalletFacade
|
||||
log.trace("offererPubKey=" + offererPubKey);
|
||||
log.trace("takerPubKey=" + takerPubKey);
|
||||
log.trace("arbitratorPubKey=" + arbitratorPubKey);
|
||||
log.trace("offererInputAmount=" + BtcFormatter.formatSatoshis(offererInputAmount));
|
||||
|
||||
// we need to subtract the fee as it will go to the miners
|
||||
BigInteger amountToPay = offererInputAmount.subtract(FeePolicy.TX_FEE);
|
||||
log.trace("amountToPay=" + BtcFormatter.formatSatoshis(amountToPay));
|
||||
|
||||
// We pay the offererInputAmount to a temporary MS output which will be changed later to the correct value.
|
||||
// With the usage of completeTx() we get all the work done with fee calculation, validation and coin selection.
|
||||
@ -705,7 +710,7 @@ public class WalletFacade
|
||||
// The btc tx fee will be included by the completeTx() call, so we don't need to add it manually.
|
||||
Transaction tx = new Transaction(params);
|
||||
Script multiSigOutputScript = getMultiSigScript(offererPubKey, takerPubKey, arbitratorPubKey);
|
||||
tx.addOutput(offererInputAmount, multiSigOutputScript);
|
||||
tx.addOutput(amountToPay, multiSigOutputScript);
|
||||
|
||||
Wallet.SendRequest sendRequest = Wallet.SendRequest.forTx(tx);
|
||||
AddressEntry addressEntry = getAddressInfoByTradeID(tradeId);
|
||||
|
@ -216,14 +216,15 @@ public class MainController implements Initializable, NavigationController
|
||||
navigateToView(selectedNavigationItem);
|
||||
}
|
||||
|
||||
//TODO make ordersButton also reacting to jump to pending tab
|
||||
private void onTakeOfferRequested(String offerId, PeerAddress sender)
|
||||
{
|
||||
final Button alertButton = new Button("", Icons.getIconImageView(Icons.MSG_ALERT));
|
||||
alertButton.setId("nav-alert-button");
|
||||
alertButton.relocate(36, 19);
|
||||
alertButton.setOnAction((e) -> {
|
||||
OrdersController.GET_INSTANCE().setSelectedTabIndex(1);
|
||||
ordersButton.fire();
|
||||
OrdersController.GET_INSTANCE().setSelectedTabIndex(1);
|
||||
});
|
||||
Tooltip.install(alertButton, new Tooltip("Someone accepted your offer"));
|
||||
ordersButtonButtonHolder.getChildren().add(alertButton);
|
||||
|
@ -110,9 +110,11 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
amountTextField.setText("1");
|
||||
priceTextField.setText("" + (int) (499 - new Random().nextDouble() * 1000 / 100));
|
||||
minAmountTextField.setText("0,1");
|
||||
collateralTextField.setText("10");
|
||||
}
|
||||
|
||||
//TODO derive form arbitrators
|
||||
collateralTextField.setText("10");
|
||||
|
||||
updateVolume();
|
||||
updateTotals();
|
||||
|
||||
@ -296,7 +298,7 @@ public class CreateOfferController implements Initializable, ChildController, Hi
|
||||
double collateralPercentAsDouble = BitSquareConverter.stringToDouble(collateralTextField.getText());
|
||||
double collateralAmountAsDouble = collateralPercentAsDouble * amountAsDouble / 100;
|
||||
BigInteger collateral = BtcFormatter.doubleValueToSatoshis(collateralAmountAsDouble);
|
||||
BigInteger totals = FeePolicy.CREATE_OFFER_FEE.add(collateral);
|
||||
BigInteger totals = FeePolicy.CREATE_OFFER_FEE.add(collateral).add(FeePolicy.TX_FEE);
|
||||
totalTextField.setText(BtcFormatter.formatSatoshis(totals));
|
||||
}
|
||||
|
||||
|
@ -282,7 +282,7 @@ public class TakerOfferController implements Initializable, ChildController
|
||||
|
||||
private String getFormattedTotal()
|
||||
{
|
||||
return BitSquareFormatter.formatVolume(getTotal().doubleValue());
|
||||
return BitSquareFormatter.formatDouble(BtcFormatter.satoshiToBTC(getTotal()), 4);
|
||||
}
|
||||
|
||||
private String getFormattedCollateral()
|
||||
|
@ -38,7 +38,7 @@ public class MessageFacade
|
||||
private static final Logger log = LoggerFactory.getLogger(MessageFacade.class);
|
||||
// private static final String PING = "ping";
|
||||
// private static final String PONG = "pong";
|
||||
private static final int MASTER_PEER_PORT = 5000;
|
||||
private static final int MASTER_PEER_PORT = 5001;
|
||||
|
||||
private final List<OrderBookListener> orderBookListeners = new ArrayList<>();
|
||||
private final List<ArbitratorListener> arbitratorListeners = new ArrayList<>();
|
||||
|
@ -17,7 +17,7 @@ public class CreateDepositTx
|
||||
FaultHandler faultHandler,
|
||||
WalletFacade walletFacade,
|
||||
String tradeId,
|
||||
BigInteger collateralAmount,
|
||||
BigInteger offererInputAmount,
|
||||
String takerMultiSigPubKey,
|
||||
String arbitratorPubKeyAsHex)
|
||||
{
|
||||
@ -25,7 +25,7 @@ public class CreateDepositTx
|
||||
try
|
||||
{
|
||||
String offererPubKey = walletFacade.getAddressInfoByTradeID(tradeId).getPubKeyAsHexString();
|
||||
Transaction transaction = walletFacade.offererCreatesMSTxAndAddPayment(collateralAmount, offererPubKey, takerMultiSigPubKey, arbitratorPubKeyAsHex, tradeId);
|
||||
Transaction transaction = walletFacade.offererCreatesMSTxAndAddPayment(offererInputAmount, offererPubKey, takerMultiSigPubKey, arbitratorPubKeyAsHex, tradeId);
|
||||
|
||||
String preparedOffererDepositTxAsHex = Utils.bytesToHexString(transaction.bitcoinSerialize());
|
||||
long offererTxOutIndex = transaction.getInput(0).getOutpoint().getIndex();
|
||||
|
@ -4,6 +4,7 @@ import com.google.bitcoin.core.ECKey;
|
||||
import com.google.bitcoin.core.Transaction;
|
||||
import io.bitsquare.bank.BankAccount;
|
||||
import io.bitsquare.btc.BlockChainFacade;
|
||||
import io.bitsquare.btc.FeePolicy;
|
||||
import io.bitsquare.btc.WalletFacade;
|
||||
import io.bitsquare.crypto.CryptoFacade;
|
||||
import io.bitsquare.msg.MessageFacade;
|
||||
@ -194,9 +195,9 @@ public class ProtocolForOffererAsBuyer
|
||||
log.debug("onResultVerifyTakeOfferFeePayment called " + step++);
|
||||
|
||||
BigInteger collateral = trade.getCollateralAmount();
|
||||
BigInteger offererInputAmount = collateral.add(FeePolicy.TX_FEE);
|
||||
state = State.CreateDepositTx;
|
||||
CreateDepositTx.run(this::onResultCreateDepositTx, this::onFault, walletFacade, tradeId, collateral, takerPubKey, arbitratorPubKey);
|
||||
|
||||
CreateDepositTx.run(this::onResultCreateDepositTx, this::onFault, walletFacade, tradeId, offererInputAmount, takerPubKey, arbitratorPubKey);
|
||||
}
|
||||
|
||||
public void onResultCreateDepositTx(String offererPubKey, String preparedOffererDepositTxAsHex, long offererTxOutIndex)
|
||||
|
Loading…
Reference in New Issue
Block a user