remove mining fee from locked funds in MS for locked funds display

This commit is contained in:
Manfred Karrer 2016-04-06 11:53:41 +02:00
parent ae65561623
commit afe009b303
6 changed files with 8 additions and 6 deletions

View file

@ -56,7 +56,7 @@ public class OffererCreatesAndSignsDepositTxAsBuyer extends TradeTask {
WalletService walletService = processModel.getWalletService(); WalletService walletService = processModel.getWalletService();
String id = processModel.getOffer().getId(); String id = processModel.getOffer().getId();
AddressEntry buyerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG); AddressEntry buyerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG);
buyerMultiSigAddressEntry.setLockedTradeAmount(buyerInputAmount); buyerMultiSigAddressEntry.setLockedTradeAmount(buyerInputAmount.subtract(FeePolicy.getFixedTxFeeForTrades()));
walletService.saveAddressEntryList(); walletService.saveAddressEntryList();
PreparedDepositTxAndOffererInputs result = processModel.getTradeWalletService().offererCreatesAndSignsDepositTx( PreparedDepositTxAndOffererInputs result = processModel.getTradeWalletService().offererCreatesAndSignsDepositTx(
true, true,

View file

@ -19,6 +19,7 @@ package io.bitsquare.trade.protocol.trade.tasks.buyer;
import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.FutureCallback;
import io.bitsquare.btc.AddressEntry; import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.FeePolicy;
import io.bitsquare.btc.WalletService; import io.bitsquare.btc.WalletService;
import io.bitsquare.btc.data.RawTransactionInput; import io.bitsquare.btc.data.RawTransactionInput;
import io.bitsquare.common.crypto.Hash; import io.bitsquare.common.crypto.Hash;
@ -57,7 +58,7 @@ public class SignAndPublishDepositTxAsBuyer extends TradeTask {
ArrayList<RawTransactionInput> buyerInputs = processModel.getRawTransactionInputs(); ArrayList<RawTransactionInput> buyerInputs = processModel.getRawTransactionInputs();
WalletService walletService = processModel.getWalletService(); WalletService walletService = processModel.getWalletService();
AddressEntry buyerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(processModel.getOffer().getId(), AddressEntry.Context.MULTI_SIG); AddressEntry buyerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(processModel.getOffer().getId(), AddressEntry.Context.MULTI_SIG);
buyerMultiSigAddressEntry.setLockedTradeAmount(Coin.valueOf(buyerInputs.stream().mapToLong(input -> input.value).sum())); buyerMultiSigAddressEntry.setLockedTradeAmount(Coin.valueOf(buyerInputs.stream().mapToLong(input -> input.value).sum()).subtract(FeePolicy.getFixedTxFeeForTrades()));
walletService.saveAddressEntryList(); walletService.saveAddressEntryList();
TradingPeer tradingPeer = processModel.tradingPeer; TradingPeer tradingPeer = processModel.tradingPeer;
processModel.getTradeWalletService().takerSignsAndPublishesDepositTx( processModel.getTradeWalletService().takerSignsAndPublishesDepositTx(

View file

@ -56,7 +56,7 @@ public class OffererCreatesAndSignsDepositTxAsSeller extends TradeTask {
WalletService walletService = processModel.getWalletService(); WalletService walletService = processModel.getWalletService();
String id = processModel.getOffer().getId(); String id = processModel.getOffer().getId();
AddressEntry sellerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG); AddressEntry sellerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(id, AddressEntry.Context.MULTI_SIG);
sellerMultiSigAddressEntry.setLockedTradeAmount(sellerInputAmount); sellerMultiSigAddressEntry.setLockedTradeAmount(sellerInputAmount.subtract(FeePolicy.getFixedTxFeeForTrades()));
walletService.saveAddressEntryList(); walletService.saveAddressEntryList();
PreparedDepositTxAndOffererInputs result = processModel.getTradeWalletService().offererCreatesAndSignsDepositTx( PreparedDepositTxAndOffererInputs result = processModel.getTradeWalletService().offererCreatesAndSignsDepositTx(
false, false,

View file

@ -19,6 +19,7 @@ package io.bitsquare.trade.protocol.trade.tasks.seller;
import com.google.common.util.concurrent.FutureCallback; import com.google.common.util.concurrent.FutureCallback;
import io.bitsquare.btc.AddressEntry; import io.bitsquare.btc.AddressEntry;
import io.bitsquare.btc.FeePolicy;
import io.bitsquare.btc.WalletService; import io.bitsquare.btc.WalletService;
import io.bitsquare.btc.data.RawTransactionInput; import io.bitsquare.btc.data.RawTransactionInput;
import io.bitsquare.common.crypto.Hash; import io.bitsquare.common.crypto.Hash;
@ -56,7 +57,7 @@ public class SignAndPublishDepositTxAsSeller extends TradeTask {
ArrayList<RawTransactionInput> sellerInputs = processModel.getRawTransactionInputs(); ArrayList<RawTransactionInput> sellerInputs = processModel.getRawTransactionInputs();
WalletService walletService = processModel.getWalletService(); WalletService walletService = processModel.getWalletService();
AddressEntry sellerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(processModel.getOffer().getId(), AddressEntry.Context.MULTI_SIG); AddressEntry sellerMultiSigAddressEntry = walletService.getOrCreateAddressEntry(processModel.getOffer().getId(), AddressEntry.Context.MULTI_SIG);
sellerMultiSigAddressEntry.setLockedTradeAmount(Coin.valueOf(sellerInputs.stream().mapToLong(input -> input.value).sum())); sellerMultiSigAddressEntry.setLockedTradeAmount(Coin.valueOf(sellerInputs.stream().mapToLong(input -> input.value).sum()).subtract(FeePolicy.getFixedTxFeeForTrades()));
walletService.saveAddressEntryList(); walletService.saveAddressEntryList();
TradingPeer tradingPeer = processModel.tradingPeer; TradingPeer tradingPeer = processModel.tradingPeer;
processModel.getTradeWalletService().takerSignsAndPublishesDepositTx( processModel.getTradeWalletService().takerSignsAndPublishesDepositTx(

View file

@ -253,7 +253,7 @@ public class LockedView extends ActivatableView<VBox, Void> {
details = "-"; details = "-";
} }
field = new HyperlinkWithIcon(details + " (Locked in trade (MultiSig))", field = new HyperlinkWithIcon("Locked in trade with ID: " + details + " (MultiSig)",
AwesomeIcon.INFO_SIGN); AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item)); field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip("Open popup for details")); field.setTooltip(new Tooltip("Open popup for details"));

View file

@ -252,7 +252,7 @@ public class ReservedView extends ActivatableView<VBox, Void> {
details = "-"; details = "-";
} }
field = new HyperlinkWithIcon(details + " (Reserved in offer (local wallet))", field = new HyperlinkWithIcon("Reserved in offer with ID: " + details + " (local wallet)",
AwesomeIcon.INFO_SIGN); AwesomeIcon.INFO_SIGN);
field.setOnAction(event -> openDetailPopup(item)); field.setOnAction(event -> openDetailPopup(item));
field.setTooltip(new Tooltip("Open popup for details")); field.setTooltip(new Tooltip("Open popup for details"));