Why do I have more unconfirmed tx than getmempool info reports? I presently have 39 unconfirmed tx that I've sent according to my local bitcoind:

$ bitcoin-cli listunspent 0 0  | grep account | wc -l
39


(note: the above command gives the correct answer because the tx were sent to the same bitcoind wallet.)

I made a script to watch the mempool size via getmempoolinfo and record the high and low amounts.  Here is output:

  size: 9359
  bytes: 9165998

  size_low: 16
  size_low_when: 2017-08-22T14:29:49-07:00

  size_hi: 71196
  size_hi_when: 2017-08-22T13:46:14-07:00

  bytes_low: 3063
  bytes_low_when: 2017-08-22T14:29:49-07:00

  bytes_hi: 53361196
  bytes_hi_when: 2017-08-22T13:46:14-07:00

  last_block_found: 2017-08-23T01:13:02-07:00


Notice that the smallest size that has been seen is 16.  This comes from the "size" output of getmempool info, which according to the help docs indicates the number of tx in the mempool.

Seemingly then, getmempoolinfo was (for a brief time at least) reporting fewer tx in the mempool than the number of my own sent tx that are still unconfirmed.

How is that possible?   Is this a bitcoind bug, or am I misunderstanding something?

$ bitcoin-cli help getmempoolinfo
getmempoolinfo

Returns details on the active state of the TX memory pool.

Result:
{
  "size": xxxxx                (numeric) Current tx count
  "bytes": xxxxx               (numeric) Sum of all tx sizes
}
You are misunderstanding how listunspent and getmempoolinfo works. listunspent is for your wallet only and is a wallet only RPC command. It will only show things that pertain to your wallet. However getmempoolinfo is a node RPC. It will show what your node sees, which is almost always going to be more than just the things in your wallet. These two commands are completely unrelated and work independent of each other. There is no relation between these two commands.