| 656 | } |
| 657 | |
| 658 | bool GetNodeStateStats(NodeId nodeid, CNodeStateStats &stats) { |
| 659 | LOCK(cs_main); |
| 660 | CNodeState *state = State(nodeid); |
| 661 | if (state == nullptr) |
| 662 | return false; |
| 663 | stats.nMisbehavior = state->nMisbehavior; |
| 664 | stats.nSyncHeight = state->pindexBestKnownBlock ? state->pindexBestKnownBlock->nHeight : -1; |
| 665 | stats.nCommonHeight = state->pindexLastCommonBlock ? state->pindexLastCommonBlock->nHeight : -1; |
| 666 | for (const QueuedBlock& queue : state->vBlocksInFlight) { |
| 667 | if (queue.pindex) |
| 668 | stats.vHeightInFlight.push_back(queue.pindex->nHeight); |
| 669 | } |
| 670 | return true; |
| 671 | } |
| 672 | |
| 673 | ////////////////////////////////////////////////////////////////////////////// |
| 674 | // |
no test coverage detected