Improve IBD check

With the following regtest getblockchaininfo result bwt gets stuck at this loop. I don't know why Bitcoin Core is reporting initialblockdownload as true ... perhaps we should just compare blocks and headers ourselves? Although that could be prone to error the moment the node starts up and hasn't fetched new headers yet.

$ bitcoin-cli -regtest getblockchaininfo
{
  "chain": "regtest",
  "blocks": 106,
  "headers": 106,
  "bestblockhash": "584a14a4d71fa98be9297f7ff70754533f6778b9e3ab4ba9fb2340fbe3b1e88b",
  "difficulty": 4.656542373906925e-10,
  "mediantime": 1592948117,
  "verificationprogress": 1,
  "initialblockdownload": true,
  "chainwork": "00000000000000000000000000000000000000000000000000000000000000d6",
  "size_on_disk": 33373,
  "pruned": false,
  "softforks": {
    "bip34": {
      "type": "buried",
      "active": false,
      "height": 500
    },
    "bip66": {
      "type": "buried",
      "active": false,
      "height": 1251
    },
    "bip65": {
      "type": "buried",
      "active": false,
      "height": 1351
    },
    "csv": {
      "type": "buried",
      "active": false,
      "height": 432
    },
    "segwit": {
      "type": "buried",
      "active": true,
      "height": 0
    },
    "testdummy": {
      "type": "bip9",
      "bip9": {
        "status": "defined",
        "start_time": 0,
        "timeout": 9223372036854775807,
        "since": 0
      },
      "active": false
    }
  },
  "warnings": ""
}