Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create order using the same tx fee specified at funding #4266

Closed
wants to merge 0 commits into from
Closed

Create order using the same tx fee specified at funding #4266

wants to merge 0 commits into from

Conversation

ghost
Copy link

@ghost ghost commented May 17, 2020

This fixes an issue whereby updates from the fee API were causing Insufficient Funds exception. Since the wallet is funded with a specific amount (deposit+trade fee+txFee), that same amount has
to be used when the user confirms offer creation (which could be some time later).

Fixes #4227
Fixes #4278
Fixes #4336
Fixes #4327

Desktop Bisq createAndGetOfferneeds to pass a fee value to CreateOfferService but CoreApi::placeOffer does not pass one, so had pass from there a dummy fee of Coin.ZERO which would equate to existing functionaliy, i.e. get current appropriate fee.
@ghubstan and @bisq-network/bisq-devs , requesting your input here.

@ghost ghost marked this pull request as draft May 17, 2020 16:59
@ghost ghost marked this pull request as ready for review June 4, 2020 22:57
@ghost
Copy link
Author

ghost commented Jun 4, 2020

Also resolves #4278.

@ghost ghost changed the title [WIP] Create order using the same tx fee specified at funding Create order using the same tx fee specified at funding Jun 4, 2020
@ghost ghost mentioned this pull request Jun 11, 2020
@sqrrm
Copy link
Member

sqrrm commented Jun 14, 2020

@ghubstan Could you please review this PR as it relates to the API?

@ghost
Copy link
Author

ghost commented Jun 22, 2020

Scenario:

  • User's Bisq wallet is empty.
  • Fee service reports txFeePerByte=10
  • User enters offer to buy 0.01 BTC using BTC option for the fees.
  • Fund your offer screen tells him to deposit 0.006076 BTC (0.006 for deposit, 0.00005 for trade fee, 0.0000260 for miner fees)
  • Fee service reports txFeePerByte=26
  • User sends 0.0006076 BTC to fund the offer.
  • User reviews the funded offer and clicks to proceed.
  • The system reports insufficient value: needed 0.0000416 more.
  • This is becuase the transaction to create the offer was being executed at 26 sats per byte, whereas the at the funding stage it was 10 sats per byte.

Log excerpt of this scenario is below, full log is in #4278

Mai-31 20:05:21.430 [JavaFX Application Thread] INFO  b.c.p.f.FeeService: BTC tx fee: txFeePerByte=10 
Mai-31 20:06:51.709 [JavaFX Application Thread] INFO  o.b.w.Wallet: Completing send tx with 2 outputs totalling 0.00605 BTC and a fee of 0.00 BTC/kB 
Mai-31 20:06:51.710 [JavaFX Application Thread] WARN  o.b.w.Wallet: Insufficient value in wallet for send: needed 0.005205 BTC more 
Mai-31 20:06:51.711 [JavaFX Application Thread] INFO  b.c.b.TxFeeEstimationService: We cannot do the fee estimation because there are not enough funds in the wallet. This is expected if the user pays from an external wallet. In that case we use an estimated tx size of 260 bytes. 
Mai-31 20:06:51.711 [JavaFX Application Thread] INFO  b.c.b.TxFeeEstimationService: Fee estimation resulted in a tx size of 260 bytes and a tx fee of 2600 Sat. 

Mai-31 20:32:35.931 [JavaFX Application Thread] INFO  b.c.p.f.FeeService: BTC tx fee: txFeePerByte=26 
Mai-31 20:36:36.346 [BlockingClient network thread for c6ac4jdfyeiakex2.onion:8333] INFO  o.b.w.Wallet: Received a pending transaction 5271d0d8392a2d09ddea75e4445fcd10a70f21cdb6b5c11658d0afd2842661f8 that spends 0.00 BTC from our own wallet, and sends us 0.006076 BTC 
Mai-31 20:36:36.346 [BlockingClient network thread for c6ac4jdfyeiakex2.onion:8333] INFO  o.b.w.Wallet: commitTx of 5271d0d8392a2d09ddea75e4445fcd10a70f21cdb6b5c11658d0afd2842661f8 
Mai-31 20:36:36.347 [BlockingClient network thread for c6ac4jdfyeiakex2.onion:8333] INFO  o.b.w.Wallet: ->pending: 5271d0d8392a2d09ddea75e4445fcd10a70f21cdb6b5c11658d0afd2842661f8 
Mai-31 20:36:36.348 [BlockingClient network thread for c6ac4jdfyeiakex2.onion:8333] INFO  o.b.w.Wallet: Estimated balance is now: 0.006947 BTC 

Mai-31 20:36:49.589 [JavaFX Application Thread] INFO  o.b.w.Wallet: Completing send tx with 2 outputs totalling 0.00605 BTC and a fee of 0.00 BTC/kB 
Mai-31 20:36:49.590 [JavaFX Application Thread] WARN  o.b.w.Wallet: Insufficient value in wallet for send: needed 0.0052466 BTC more 
Mai-31 20:36:49.591 [JavaFX Application Thread] INFO  b.c.b.TxFeeEstimationService: We cannot do the fee estimation because there are not enough funds in the wallet. This is expected if the user pays from an external wallet. In that case we use an estimated tx size of 260 bytes. 
Mai-31 20:36:49.591 [JavaFX Application Thread] INFO  b.c.b.TxFeeEstimationService: Fee estimation resulted in a tx size of 260 bytes and a tx fee of 6760 Sat. 

**[DIFFERENCE BETWEEN 0.005205 and 0.0052466 IS 0.00004160 => exactly what's missing below]**:

Mai-31 20:36:49.588 [JavaFX Application Thread] INFO  b.c.o.CreateOfferService: hCrjCljy-0f34c9da-4e9e-4df7-a765-928665a9471e-134 EUR BUY 88091780 true -0.03 1000000 1000000 0.15 f0de6d7a-31e6-4647-af14-f3ce141640f8 

Mai-31 20:36:49.589 [JavaFX Application Thread] INFO  o.b.w.Wallet: Completing send tx with 2 outputs totalling 0.00605 BTC and a fee of 0.00 BTC/kB 
Mai-31 20:36:49.590 [JavaFX Application Thread] WARN  o.b.w.Wallet: Insufficient value in wallet for send: needed 0.0052466 BTC more 

Mai-31 20:36:49.591 [JavaFX Application Thread] INFO  b.c.b.TxFeeEstimationService: We cannot do the fee estimation because there are not enough funds in the wallet. This is expected if the user pays from an external wallet. In that case we use an estimated tx size of 260 bytes. 
Mai-31 20:36:49.591 [JavaFX Application Thread] INFO  b.c.b.TxFeeEstimationService: Fee estimation resulted in a tx size of 260 bytes and a tx fee of 6760 Sat. 

Mai-31 20:37:24.175 [JavaFX Application Thread] INFO  b.c.t.TaskRunner: Run task: ValidateOffer 
Mai-31 20:37:24.179 [JavaFX Application Thread] INFO  b.c.t.TaskRunner: Run task: CheckNumberOfUnconfirmedTransactions 
Mai-31 20:37:24.179 [JavaFX Application Thread] INFO  b.c.t.TaskRunner: Run task: CreateMakerFeeTx 

Mai-31 20:37:24.206 [JavaFX Application Thread] INFO  o.b.w.Wallet: Completing send tx with 2 outputs totalling 0.00605 BTC and a fee of 0.00 BTC/kB 
Mai-31 20:37:24.206 [JavaFX Application Thread] WARN  o.b.w.Wallet: Insufficient value in wallet for send: needed 0.0000416 BTC more 

Mai-31 20:37:24.207 [JavaFX Application Thread] WARN  b.c.b.w.TradeWalletService: Balance = 607600; CoinSelector = bisq.core.btc.wallet.BtcCoinSelector@1d5c198d 
Mai-31 20:37:24.209 [JavaFX Application Thread] WARN  b.c.b.w.TradeWalletService: createBtcTradingFeeTx failed: tradingFeeTx=  da573b2900c1743ca513f1e58a542cb7d319e64c2993ee1e5fcf0b2508efd09a
     INCOMPLETE: No inputs!
     out  HASH160 PUSHDATA(20)[5c95d9cf9d48683284dff53379acc296eb214883] EQUAL 0.00005 BTC (5000) ScriptPubKey: a9145c95d9cf9d48683284dff53379acc296eb21488387 Address:3A8Zc1XioE2HRzYfbb5P8iemCS72M6vRJV 
     out  DUP HASH160 PUSHDATA(20)[df97c3da231da8549913008f579366c6f44debfd] EQUALVERIFY CHECKSIG 0.006 BTC (600000) ScriptPubKey: 76a914df97c3da231da8549913008f579366c6f44debfd88ac Address:1MPFVbiTSH2yVJ1JswpSSh9JyoNGYBoyHc 
     prps UNKNOWN
, txOutputs=[TxOut of 0.00005 BTC to 3A8Zc1XioE2HRzYfbb5P8iemCS72M6vRJV script:HASH160 PUSHDATA(20)[5c95d9cf9d48683284dff53379acc296eb214883] EQUAL, TxOut of 0.006 BTC to 1MPFVbiTSH2yVJ1JswpSSh9JyoNGYBoyHc script:DUP HASH160 PUSHDATA(20)[df97c3da231da8549913008f579366c6f44debfd] EQUALVERIFY CHECKSIG] 
Mai-31 20:37:24.212 [JavaFX Application Thread] ERROR b.c.t.Task: An error occurred at task: CreateMakerFeeTx org.bitcoinj.core.InsufficientMoneyException: Insufficient money,  missing 0.0000416 BTC

This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant