lbryio / lbcd

An alternative full node implementation of LBRY's blockchain written in Go (golang)
https://lbry.com/
ISC License
38 stars 25 forks source link

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

Closed moodyjon closed 2 years ago

moodyjon commented 2 years ago

Fixes https://github.com/lbryio/lbcd/issues/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 commented 2 years ago

Pull Request Test Coverage Report for Build 2691830427


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%
<!-- Total: 78 129 60.47% -->
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%
<!-- Total: 1064 -->
Totals Coverage Status
Change from base Build 2653196456: 0.08%
Covered Lines: 22543
Relevant Lines: 43432

💛 - Coveralls
roylee17 commented 2 years ago

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