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

Rpc mempool: Support more fields in getmempoolinfo result. #70

Merged
merged 5 commits into from
Jul 19, 2022

Conversation

moodyjon
Copy link
Collaborator

Fixes #60

Field "loaded" only makes sense if the Mempool is being saved/loaded on restart. I don't see that happening.
Field "maxmempool" would need more configuration infrastructure, and could be supported if that were added.

The "usage" (memory) and "unbroadcastcount" were my attempt to mimic what's done in C++ bitcoin (https://github.com/bitcoin/bitcoin).

Manual test, showing rollover back to near 0 size, apparently on new block acceptance.

Mac-mini lbcd % ./lbcctl --rpcuser=xxx --rpcpass=yyy getmempoolinfo
{
  "size": 267,
  "bytes": 256195,
  "usage": 347789,
  "total_fee": 0.21047744,
  "mempoolminfee": 0.00001,
  "minrelaytxfee": 0.00001,
  "unbroadcastcount": 0
}
Mac-mini lbcd % ./lbcctl --rpcuser=xxx --rpcpass=yyy getmempoolinfo
{
  "size": 3,
  "bytes": 2260,
  "usage": 3223,
  "total_fee": 0.001164,
  "mempoolminfee": 0.00001,
  "minrelaytxfee": 0.00001,
  "unbroadcastcount": 0
}

Investigating automated tests next...

@coveralls
Copy link

coveralls commented Jul 14, 2022

Pull Request Test Coverage Report for Build 2691830427

  • 78 of 129 (60.47%) changed or added relevant lines in 4 files are covered.
  • 1064 unchanged lines in 6 files lost coverage.
  • Overall coverage increased (+0.08%) to 51.904%

Changes Missing Coverage Covered Lines Changed/Added Lines %
rpcserver.go 0 1 0.0%
server.go 0 5 0.0%
mempool/memusage.go 43 59 72.88%
mempool/mempool.go 35 64 54.69%
Files with Coverage Reduction New Missed Lines %
peer/peer.go 2 76.47%
btcec/signature.go 3 92.82%
btcjson/walletsvrcmds.go 14 95.92%
claimtrie/claimtrie.go 21 75.21%
rpcclient/wallet.go 362 0%
rpcserver.go 662 0.3%
Totals Coverage Status
Change from base Build 2653196456: 0.08%
Covered Lines: 22543
Relevant Lines: 43432

💛 - Coveralls

Copy link
Collaborator

@roylee17 roylee17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nitpick:

I think it looks better without this though. Only four call sites with additional params.
Or, at least, rename the util function without leading _

@lbry-bot lbry-bot assigned roylee17 and unassigned roylee17 Jul 14, 2022
@roylee17
Copy link
Collaborator

Looks good to me. And encouraged to upstream this to btcd as it's a general improvement.

…ions for max depth and switch completness. Toggle them when running in mempool_test.go. Drop support for reflect.Map, as it's not needed at this time.
@roylee17 roylee17 merged commit 7f9fe4b into lbryio:master Jul 19, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bring mempoolinfo up to date
3 participants