<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "BitcoinKernel",
  "identifier" : "/documentation/BitcoinKernel/ChainstateManager/processBlock(_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "BitcoinKernel"
    ],
    "preciseIdentifier" : "s:13BitcoinKernel17ChainstateManagerC12processBlockySb7success_Sb5isNewtAA0F0CF"
  },
  "title" : "processBlock(_:)"
}
-->

# processBlock(_:)

Processes a block for validation and potential inclusion in the
active chain — the workhorse of every sync run.

```
func processBlock(_ block: Block) -> (success: Bool, isNew: Bool)
```

## Parameters

`block`

The block to process.

## Return Value

A tuple of `(success, isNew)`. `success` is `true` if the
kernel accepted the block OR already had it; inspect the post-call
[`bestEntry`](/documentation/BitcoinKernel/ChainstateManager/bestEntry) to see whether this block became the new tip. `isNew`
is `true` if the kernel had not previously seen this block.

## Discussion

Runs `CheckBlock` + `ContextualCheckBlock` + `ConnectBlock` from
Bitcoin Core’s [`validation.cpp`](https://github.com/bitcoin/bitcoin/blob/master/src/validation.cpp).
On success, the chainstate advances; on a chain-reorg scenario the
kernel may internally switch to a new best chain without any extra
caller action. This call can take seconds on mainnet-sized blocks
and is interruptible via [`interrupt()`](/documentation/BitcoinKernel/Context/interrupt()).