Electrs: bug: estimatefee estimates a fee below the min relay fee

Created on 3 Mar 2020  路  9Comments  路  Source: romanz/electrs

Hi

The estimatefee for a low prio transaction currently estimates a fee of 995 satoshis with a target of 24 blocks. This is below the standard min relay fee of 1000 sats.

The call should make sure to not go below the relayfee of the daemon.

As a result, transactions created using this fee cannot be broadcast.

Slightly related: https://github.com/romanz/electrs/issues/222

All 9 comments

Couldn't test it yet, but I assume it does. Thanks!

Not sure this solved the issue. I initially reported this to @benma when testing BitBoxApp with my own full node. After compiling the limit-fees branch and trying to replicate my findings, I get the following:

Make sure everything is up-to-date

$ git status
commit 6471ba1e2589ff9c415d3b596e104c3bc998356b (HEAD -> limit-fees, origin/limit-fees)
Author: Roman Zeyde <[email protected]>
Date:   Sat Mar 7 17:59:25 2020 +0200

    Limit estimatefee using daemon's relayfee
....

$ cargo build --release
   Compiling libc v0.2.65
   Compiling lazy_static v1.4.0
   Compiling cfg-if v0.1.10
   Compiling semver-parser v0.7.0
   ...
   Finished release [optimized] target(s) in 29m 52s

$ electrs --conf /mnt/ext/electrs/electrs.conf
Config { log: StdErrLog { verbosity: Trace, quiet: false, timestamp: Millisecond, modules: [], writer: "stderr", color_choice: Auto }, network_type: bitcoin, db_path: "/mnt/ext/electrs/db/mainnet", daemon_dir: "/mnt/ext/bitcoin", daemon_rpc_addr: V4(127.0.0.1:8332), electrum_rpc_addr: V4(127.0.0.1:50001), monitoring_addr: V4(127.0.0.1:4224), jsonrpc_import: false, index_batch_size: 100, bulk_index_threads: 4, tx_cache_size: 10485760, txid_limit: 1000, server_banner: "Welcome to electrs 0.8.3 (Electrum Rust Server)!", blocktxids_cache_size: 10485760 }
2020-03-17T16:01:16.195+01:00 - DEBUG - Server listening on 127.0.0.1:4224
2020-03-17T16:01:16.200+01:00 - DEBUG - Running accept thread
2020-03-17T16:01:16.201+01:00 - INFO - NetworkInfo { version: 190001, subversion: "/Satoshi:0.19.0.1/", relayfee: 0.00001 }
2020-03-17T16:01:16.203+01:00 - INFO - BlockchainInfo { chain: "main", blocks: 621975, headers: 621975, bestblockhash: "0000000000000000000f7c880758832ea9c6a2b56de20908857dd1f660aebf57", pruned: false, initialblockdownload: false }
2020-03-17T16:01:16.205+01:00 - DEBUG - opening DB at "/mnt/ext/electrs/db/mainnet"
2020-03-17T16:01:16.568+01:00 - TRACE - lastest indexed blockhash: 0000000000000000000387a2bc36d07d064a8cd379efc6c65b94bda024d88901
2020-03-17T16:01:23.993+01:00 - DEBUG - applying 621968 new headers from height 0

So, relayfee from bitcoind is recognized correctly as 0.00001. Querying electrs, however, gives the following a 24 blocks fee of 0.00000995:

$ ncat localhost 50001
{"jsonrpc":"2.0", "id":0, "method":"blockchain.estimatefee", "params":[24]}
{"id":0,"jsonrpc":"2.0","result":9.947916623787023e-6}

For completeness' sake, here's my electrs config:

# RaspiBolt: electrs configuration
# /mnt/ext/electrs/electrs.conf

# RPC user / password
cookie = "raspibolt:xxxxxxxxxxxxx"

# Bitcoin Core settings
network = "bitcoin"
daemon_dir= "/mnt/ext/bitcoin"
daemon_rpc_addr = "127.0.0.1:8332"

# Electrs settings
electrum_rpc_addr = "127.0.0.1:50001"
db_dir = "/mnt/ext/electrs/db"
txid_limit = 1000

# Logging
verbose = 4
timestamp = true
rust_backtrace = true

https://github.com/romanz/electrs/commit/6471ba1e2589ff9c415d3b596e104c3bc998356b#diff-8776af0b15949a59471d9d5910b92db7R197

self.relayfee is already in btc/kB, so maybe the / 1000.0 messes it up?

Should be fixed by 830797d (removed the division by 1000, and switched from f32 to f64).

Electrum client log shows at least 1000 sat:

I/n | network | fee_estimates {25: 1000, 10: 1000, 5: 9049, 2: 17452}

Compiled latest commit and tested on RaspiBolt. At least with current fee estimation I get a 0.00001 BTC fee for 24 blocks:

$ ncat localhost 50001
{"jsonrpc":"2.0", "id":0, "method":"blockchain.estimatefee", "params":[24]}
{"id":0,"jsonrpc":"2.0","result":0.00001}

:+1: thanks all. I guess that means you can merge this commit into master @romanz , and close this issue.

Thanks for testing!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

tiero picture tiero  路  4Comments

reynico picture reynico  路  5Comments

darklow picture darklow  路  8Comments

burguesia picture burguesia  路  4Comments

sangaman picture sangaman  路  6Comments