message: Fix lockorder issue when requesting an xthin failover block
diff: @@ -448,6 +448,7 @@ bool CGrapheneBlock::process(CNode *pfrom,
  int missingCount = 0;
  int unnecessaryCount = 0;
  bool collision = false;
  + bool fRequestFailover = false;
  std::set<uint256> passingTxHashes;
  std::map<uint64_t, uint256> mapPartialTxHash;
  std::vector<uint256> memPoolHashes;
  @@ -530,18 +531,17 @@ bool CGrapheneBlock::process(CNode *pfrom,
  }
  catch (const std::runtime_error &e)
  {
  - RequestFailoverBlock(pfrom, header.GetHash());
  +
  + fRequestFailover = true;
  LOG(GRAPHENE, "Graphene set could not be reconciled; requesting failover for peer %s: %s\n",
  pfrom->GetLogName(), e.what());
  graphenedata.ClearGrapheneBlockData(pfrom, header.GetHash());
  graphenedata.IncrementDecodeFailures();
  -
  - return true;
  }
  // Reconstruct the block if there are no hashes to re-request
  - if (setHashesToRequest.empty())
  + if (setHashesToRequest.empty() && !fRequestFailover)
  {
  bool mutated;
  uint256 merkleroot = ComputeMerkleRoot(pfrom->grapheneBlockHashes, &mutated);
  @@ -557,6 +557,13 @@ bool CGrapheneBlock::process(CNode *pfrom,
  } // End locking cs_orphancache, mempool.cs and cs_xval
  LOG(GRAPHENE, "Total in-memory graphene bytes size is %ld bytes\n", graphenedata.GetGrapheneBlockBytes());
  + // This must be checked outside of the above section or deadlock may occur.
  + if (fRequestFailover)
  + {
  + RequestFailoverBlock(pfrom, header.GetHash());
  + return true;
  + }
  +
  // These must be checked outside of the mempool.cs lock or deadlock may occur.
  // A merkle root mismatch here does not cause a ban because and expedited node will forward an graphene
  // without checking the merkle root, therefore we don't want to ban our expedited nodes. Just request
  