mirror of
https://github.com/bisq-network/bisq.git
synced 2025-02-23 23:06:39 +01:00
Increase tx fee to 0.0007 btc, increase tradeprotocol version, change log level for tx details to INFO
This commit is contained in:
parent
f6c4ac9143
commit
d65e098933
3 changed files with 28 additions and 24 deletions
|
@ -43,7 +43,7 @@ public class Version {
|
|||
|
||||
// The version no. of the current protocol. The offer holds that version.
|
||||
// A taker will check the version of the offers to see if his version is compatible.
|
||||
public static final int TRADE_PROTOCOL_VERSION = 1;
|
||||
public static final int TRADE_PROTOCOL_VERSION = 2;
|
||||
private static int p2pMessageVersion;
|
||||
|
||||
public static int getP2PMessageVersion() {
|
||||
|
|
|
@ -29,22 +29,22 @@ public class FeePolicy {
|
|||
// http://p2sh.info/dashboard/db/fee-estimation
|
||||
// https://bitcoinfees.github.io/#1d
|
||||
// Average values are 10-100 satoshis/byte in january 2016
|
||||
// Average values are 60-140 satoshis/byte in february 2017
|
||||
//
|
||||
// Our trade transactions have a fixed set of inputs and outputs making the size very predictable
|
||||
// (as long the user does not do multiple funding transactions)
|
||||
//
|
||||
// trade fee tx: 226 bytes // 88 satoshi/byte
|
||||
// deposit tx: 336 bytes // 59 satoshi/byte
|
||||
// payout tx: 371 bytes // 53 satoshi/byte
|
||||
// disputed payout tx: 408 bytes // 49 satoshi/byte
|
||||
// trade fee tx: 226 bytes // 309 satoshi/byte
|
||||
// deposit tx: 336 bytes // 208 satoshi/byte
|
||||
// payout tx: 371 bytes // 188 satoshi/byte
|
||||
// disputed payout tx: 408 bytes // 171 satoshi/byte
|
||||
|
||||
// We set a fixed fee to make the needed amounts in the trade predictable.
|
||||
// We use 0.0002 BTC (0.08 EUR @ 400 EUR/BTC) which is for our tx sizes about 50-90 satoshi/byte
|
||||
// We use 0.0007 BTC (0.7 EUR @ 1000 EUR/BTC) which is for our tx sizes about 150-300 satoshi/byte
|
||||
// We cannot make that user defined as it need to be the same for both users, so we can only change that in
|
||||
// software updates
|
||||
// TODO before Beta we should get a good future proof guess as a change causes incompatible versions
|
||||
public static Coin getFixedTxFeeForTrades() {
|
||||
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(5_000) : Coin.valueOf(20_000);
|
||||
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(5_000) : Coin.valueOf(70_000);
|
||||
}
|
||||
|
||||
// For non trade transactions (withdrawal) we use the default fee calculation
|
||||
|
@ -65,9 +65,9 @@ public class FeePolicy {
|
|||
|
||||
// 0.0005 BTC 0.05% of 1 BTC about 0.2 EUR @ 400 EUR/BTC
|
||||
public static Coin getCreateOfferFee() {
|
||||
// We need to pay the quite high miner fee of 30_000 from the trading fee tx so 30_000 us our lower limit
|
||||
// We need to pay the quite high miner fee of 70_000 from the trading fee tx so 30_000 is our lower limit
|
||||
// The arbitrator receive only 0.0002 BTC - less than the miners
|
||||
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(10_000) : Coin.valueOf(50_000);
|
||||
return DevFlags.STRESS_TEST_MODE ? Coin.valueOf(10_000) : Coin.valueOf(100_000);
|
||||
}
|
||||
|
||||
// 0.001 BTC 0.1% of 1 BTC about 0.4 EUR @ 400 EUR/BTC
|
||||
|
|
|
@ -238,7 +238,7 @@ public class TradeWalletService {
|
|||
|
||||
verifyTransaction(dummyTX);
|
||||
|
||||
printTxWithInputs("dummyTX", dummyTX);
|
||||
//printTxWithInputs("dummyTX", dummyTX);
|
||||
|
||||
List<RawTransactionInput> rawTransactionInputList = dummyTX.getInputs().stream()
|
||||
.map(e -> {
|
||||
|
@ -407,7 +407,7 @@ public class TradeWalletService {
|
|||
|
||||
verifyTransaction(preparedDepositTx);
|
||||
|
||||
printTxWithInputs("preparedDepositTx", preparedDepositTx);
|
||||
//printTxWithInputs("preparedDepositTx", preparedDepositTx);
|
||||
|
||||
return new PreparedDepositTxAndOffererInputs(offererRawTransactionInputs, preparedDepositTx.bitcoinSerialize());
|
||||
}
|
||||
|
@ -429,14 +429,14 @@ public class TradeWalletService {
|
|||
* @throws WalletException
|
||||
*/
|
||||
public Transaction takerSignsAndPublishesDepositTx(boolean takerIsSeller,
|
||||
byte[] contractHash,
|
||||
byte[] offerersDepositTxSerialized,
|
||||
List<RawTransactionInput> buyerInputs,
|
||||
List<RawTransactionInput> sellerInputs,
|
||||
byte[] buyerPubKey,
|
||||
byte[] sellerPubKey,
|
||||
byte[] arbitratorPubKey,
|
||||
FutureCallback<Transaction> callback) throws SigningException, TransactionVerificationException,
|
||||
byte[] contractHash,
|
||||
byte[] offerersDepositTxSerialized,
|
||||
List<RawTransactionInput> buyerInputs,
|
||||
List<RawTransactionInput> sellerInputs,
|
||||
byte[] buyerPubKey,
|
||||
byte[] sellerPubKey,
|
||||
byte[] arbitratorPubKey,
|
||||
FutureCallback<Transaction> callback) throws SigningException, TransactionVerificationException,
|
||||
WalletException {
|
||||
Transaction offerersDepositTx = new Transaction(params, offerersDepositTxSerialized);
|
||||
|
||||
|
@ -493,7 +493,7 @@ public class TradeWalletService {
|
|||
|
||||
// Add all outputs from offerersDepositTx to depositTx
|
||||
offerersDepositTx.getOutputs().forEach(depositTx::addOutput);
|
||||
printTxWithInputs("offerersDepositTx", offerersDepositTx);
|
||||
//printTxWithInputs("offerersDepositTx", offerersDepositTx);
|
||||
|
||||
// Sign inputs
|
||||
int start = takerIsSeller ? buyerInputs.size() : 0;
|
||||
|
@ -577,7 +577,7 @@ public class TradeWalletService {
|
|||
|
||||
verifyTransaction(preparedPayoutTx);
|
||||
|
||||
printTxWithInputs("preparedPayoutTx", preparedPayoutTx);
|
||||
//printTxWithInputs("preparedPayoutTx", preparedPayoutTx);
|
||||
|
||||
return sellerSignature.encodeToDER();
|
||||
}
|
||||
|
@ -732,7 +732,7 @@ public class TradeWalletService {
|
|||
|
||||
verifyTransaction(preparedPayoutTx);
|
||||
|
||||
printTxWithInputs("preparedPayoutTx", preparedPayoutTx);
|
||||
//printTxWithInputs("preparedPayoutTx", preparedPayoutTx);
|
||||
|
||||
return arbitratorSignature.encodeToDER();
|
||||
}
|
||||
|
@ -1122,7 +1122,11 @@ public class TradeWalletService {
|
|||
}
|
||||
|
||||
private static void printTxWithInputs(String tracePrefix, Transaction tx) {
|
||||
log.info(tracePrefix + ": " + tx.toString());
|
||||
long fee = tx.getFee() != null ? tx.getFee().value : 0;
|
||||
int size = tx.getMessageSize();
|
||||
log.info(tracePrefix + ": " + tx.toString() + "\nSize (Byte): " + size + "\nFee (Satoshi/Byte): "
|
||||
+ (fee / size));
|
||||
|
||||
for (TransactionInput input : tx.getInputs()) {
|
||||
if (input.getConnectedOutput() != null)
|
||||
log.info(tracePrefix + " input value: " + input.getConnectedOutput().getValue().toFriendlyString());
|
||||
|
|
Loading…
Add table
Reference in a new issue