This is a much more conservative pull request than my previous smart-fees request.
It only tries to solve the problem: what fee (or priority) is needed to get into a block right now?
It adds two new RPC calls: estimatefee and estimatepriority.
Test plan:
Run qa/rpc-tests/estimatefee.sh : EXPECT: runs successfully (it is a -regtest integration test).
Restart bitcoind with this patch. Then run:
bitcoin-cli -rpcwait estimatefee : EXPECT: -1 (not enough data to estimate) bitcoin-cli -rpcwait estimatepriority : EXPECT: -1 (not enough data)
Leave it running an hour or two, and repeat. EXPECT: reasonable fee/priority estimate.
Test different medians; EXPECT: estimatefee 0.1 is less than or equal to estimatefee 0.5. Same for priority.
Test saving/restoring mempool/estimation state: shutdown bitcoind, and restart. EXPECT: same estimates as before.
Test Bitcoin-Qt fee/priority estimation:
Run with a wallet that has a combination of big/old and small/new unspent transaction inputs. Turn on coin control. Test send: EXPECT: coin control values Do the Right Thing (fee turns red if not enough fee is included, preiority turns red if not enough priority to qualify, etc).