JoinMarket-Org / joinmarket-clientserver

Bitcoin CoinJoin implementation with incentive structure to convince people to take part
GNU General Public License v3.0
731 stars 179 forks source link

JoinMarket doesn't handle "Fee estimation disabled" error from Bitcoin Core #1653

Open kristapsk opened 9 months ago

kristapsk commented 9 months ago

Displays unhandled error and hangs.

$ ./scripts/sendpayment.py testnet-test-124.jmdat "bitcoin:tb1qjhzn0n46u0szatr5833rk80mhf9caqn6knmwxq?amount=0.00200000&pj=http://w6k7nba4rx4jieyumt7z3zrmk5sq5kymhly74oxe63loazqctt7j3vid.onion"
User data location: /home/user/.joinmarket/
2024-02-05 16:24:36,119 [DEBUG]  rpc: getblockchaininfo []
2024-02-05 16:24:36,121 [DEBUG]  rpc: listwallets []
2024-02-05 16:24:36,121 [DEBUG]  rpc: getwalletinfo []
Attempting to pay via payjoin.
2024-02-05 16:24:36,133 [INFO]  starting sendpayment
Enter passphrase to decrypt wallet: 
2024-02-05 16:24:38,259 [DEBUG]  rpc: listaddressgroupings []
2024-02-05 16:24:38,261 [DEBUG]  Fast sync in progress. Got this many used addresses: 1
2024-02-05 16:24:39,059 [DEBUG]  rpc: listunspent []
2024-02-05 16:24:39,060 [DEBUG]  bitcoind sync_unspent took 0.001708984375sec
2024-02-05 16:24:39,070 [WARNING]  Cannot listen on port 25183, trying next port
2024-02-05 16:24:39,070 [INFO]  BIP78 daemon listening on port 25184
2024-02-05 16:24:39,071 [DEBUG]  rpc: getmempoolinfo []
2024-02-05 16:24:39,072 [DEBUG]  rpc: estimatesmartfee [3]
Unhandled Error
Traceback (most recent call last):
  File "/home/user/git/joinmarket-clientserver/jmvenv/lib/python3.9/site-packages/twisted/internet/base.py", line 502, in fireEvent
    DeferredList(beforeResults).addCallback(self._continueFiring)
  File "/home/user/git/joinmarket-clientserver/jmvenv/lib/python3.9/site-packages/twisted/internet/defer.py", line 645, in addCallback
    return self.addCallbacks(callback, callbackArgs=args, callbackKeywords=kwargs)
  File "/home/user/git/joinmarket-clientserver/jmvenv/lib/python3.9/site-packages/twisted/internet/defer.py", line 558, in addCallbacks
    self._runCallbacks()
  File "/home/user/git/joinmarket-clientserver/jmvenv/lib/python3.9/site-packages/twisted/internet/defer.py", line 1101, in _runCallbacks
    current.result = callback(  # type: ignore[misc]
--- <exception caught here> ---
  File "/home/user/git/joinmarket-clientserver/jmvenv/lib/python3.9/site-packages/twisted/internet/base.py", line 514, in _continueFiring
    callable(*args, **kwargs)
  File "/home/user/git/joinmarket-clientserver/src/jmclient/payjoin.py", line 546, in send_payjoin
    success, errmsg = make_payment_psbt(manager, accept_callback, info_callback)
  File "/home/user/git/joinmarket-clientserver/src/jmclient/payjoin.py", line 487, in make_payment_psbt
    payment_psbt = direct_send(manager.wallet_service, manager.amount,
  File "/home/user/git/joinmarket-clientserver/src/jmclient/taker_utils.py", line 140, in direct_send
    initial_fee_est = estimate_tx_fee(8, 2, txtype=txtype, outtype=outtypes)
  File "/home/user/git/joinmarket-clientserver/src/jmclient/wallet.py", line 105, in estimate_tx_fee
    fee_per_kb = jm_single().bc_interface.estimate_fee_per_kb(
  File "/home/user/git/joinmarket-clientserver/src/jmclient/blockchaininterface.py", line 283, in estimate_fee_per_kb
    retval = self._estimate_fee_basic(tx_fees)
  File "/home/user/git/joinmarket-clientserver/src/jmclient/blockchaininterface.py", line 597, in _estimate_fee_basic
    rpc_result = self._rpc('estimatesmartfee', [conf_target + i])
  File "/home/user/git/joinmarket-clientserver/src/jmclient/blockchaininterface.py", line 435, in _rpc
    res = self.jsonRpc.call(method, args)
  File "/home/user/git/joinmarket-clientserver/src/jmclient/jsonrpc.py", line 164, in call
    raise JsonRpcError(response["error"])
jmclient.jsonrpc.JsonRpcError: {'code': -32603, 'message': 'Fee estimation disabled'}

2024-02-05 16:24:39,082 [INFO]  Starting transaction monitor in walletservice
kristapsk commented 9 months ago

Should terminate script if relative fee is configured / specified. Could use Esplora as a fallback if #1481 is ever agreed to, finished and merged.

kristapsk commented 9 months ago

This is even worse with Qt GUI, it gives no feedback about error (apart from console output, which user will not see if not launching it from terminal).

image