<!--
{
  "availability" : [

  ],
  "documentType" : "symbol",
  "framework" : "BitcoinKernel",
  "identifier" : "/documentation/BitcoinKernel/BlockchainSync/init(manager:source:context:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "BitcoinKernel"
    ],
    "preciseIdentifier" : "s:13BitcoinKernel14BlockchainSyncV7manager6source7contextAcA17ChainstateManagerC_AA11BlockSource_pAA7ContextCtcfc"
  },
  "title" : "init(manager:source:context:)"
}
-->

# init(manager:source:context:)

Create a new sync engine.

```
init(manager: ChainstateManager, source: any BlockSource, context: Context)
```

## Parameters

`manager`

The kernel chainstate that will be advanced. Must be
configured with the same [`ChainType`](/documentation/BitcoinKernel/ChainType) the `source` is reporting
on — validating signet blocks against a mainnet chainstate will
surface as rejections in [`BlockchainSync.Update.State.failed(_:)`](/documentation/BitcoinKernel/BlockchainSync/Update/State-swift.enum/failed(_:)).

`source`

The block source providing remote chain data. Any
[`BlockSource`](/documentation/BitcoinKernel/BlockSource) conformer — HTTP ([`EsploraBlockSource`](/documentation/BitcoinKernel/EsploraBlockSource)), a
test mock, or a future P2P conformer — works identically.

`context`

The kernel context used to interrupt long-running
[`processBlock(_:)`](/documentation/BitcoinKernel/ChainstateManager/processBlock(_:)) calls on cancel.

## Discussion

The engine is a value-type configuration: constructing one does no
work. The sync loop starts on the first call to [`updates()`](/documentation/BitcoinKernel/BlockchainSync/updates()).