| 110 | } |
| 111 | |
| 112 | COutPoint ProcessBlock(const NodeContext& node, const std::shared_ptr<CBlock>& block) |
| 113 | { |
| 114 | auto& chainman{*Assert(node.chainman)}; |
| 115 | const auto old_height = WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight()); |
| 116 | bool new_block; |
| 117 | BlockValidationStateCatcher bvsc{block->GetHash()}; |
| 118 | node.validation_signals->RegisterValidationInterface(&bvsc); |
| 119 | const bool processed{chainman.ProcessNewBlock(block, true, true, &new_block)}; |
| 120 | const bool duplicate{!new_block && processed}; |
| 121 | assert(!duplicate); |
| 122 | node.validation_signals->UnregisterValidationInterface(&bvsc); |
| 123 | node.validation_signals->SyncWithValidationInterfaceQueue(); |
| 124 | const bool was_valid{bvsc.m_state && bvsc.m_state->IsValid()}; |
| 125 | assert(old_height + was_valid == WITH_LOCK(chainman.GetMutex(), return chainman.ActiveHeight())); |
| 126 | |
| 127 | if (was_valid) return {block->vtx[0]->GetHash(), 0}; |
| 128 | return {}; |
| 129 | } |
| 130 | |
| 131 | std::shared_ptr<CBlock> PrepareBlock(const NodeContext& node, |
| 132 | const node::BlockCreateOptions& assembler_options) |
no test coverage detected