Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use max of start-chain-from and last known point #1471

Merged
merged 1 commit into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ changes.
- **BREAKING** Changes to the `hydra-node` API `/commit` endpoint [#1463](https://github.com/input-output-hk/hydra/pull/1463):
- Removed the check that prevented committing UTxOs from an internal `hydra-node` wallet.
- `SpendingNodeUtxoForbidden` error was removed.

- Change `--start-chain-from` to always use the newer point when also a head state is known.

## [0.17.0] - 2024-05-20

Expand Down
19 changes: 19 additions & 0 deletions docs/docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,26 @@ hydra-node \
--node-socket devnet/node.socket \
```

:::info
The `hydra-node` is compatible with the Cardano `mainnet` network, and can consequently operate using **real funds**. Please be sure to read the [known issues](/docs/known-issues) to fully understand the limitations and consequences of running Hydra nodes on mainnet. To choose `mainnet`, use `--mainnet` instead of `--testnet-magic`.
:::

Using the direct node connection, the `hydra-node` does synchronize the chain and observes Hydra protocol transactions. On first startup, it will start observing from the chain's tip. Once a Hydra head has been observed, the point of the last known state change is used automatically.

You can manually set the intersection point using `--start-chain-from <slot>.<hash>` which specifies a `slot` and block header `hash`. For example:

```shell
hydra-node \
--testnet-magic 2 \
--node-socket preview/node.socket \
--start-chain-from 49533501.e364500a42220ea47314215679b7e42e9bbb81fa69d1366fe738d8aef900f7ee
```

To synchronize from the genesis block, use `--start-chain-from 0`.

:::info
If the `hydra-node` already tracks a head in its `state` and `--start-chain-from` is given, the **newer** point is used.
:::

## Offline mode

Expand Down
2 changes: 1 addition & 1 deletion hydra-node/src/Hydra/Chain/Direct.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ withDirectChain tracer config ctx wallet chainStateHistory callback action = do
queue <- newTQueueIO
-- Select a chain point from which to start synchronizing
chainPoint <- maybe (queryTip networkId nodeSocket) pure $ do
(min <$> startChainFrom <*> persistedPoint)
(max <$> startChainFrom <*> persistedPoint)
<|> persistedPoint
<|> startChainFrom

Expand Down
10 changes: 6 additions & 4 deletions hydra-node/src/Hydra/Options.hs
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,12 @@ startChainFromParser =
( long "start-chain-from"
<> metavar "SLOT.HEADER_HASH"
<> help
"The id of the block we want to start observing the chain from. \
\If not given, uses the chain tip at startup. Composed by the slot \
\number, a separator ('.') and the hash of the block header. \
\For example: 52970883.d36a9936ae7a07f5f4bdc9ad0b23761cb7b14f35007e54947e27a1510f897f04."
"The id of the block we want to start observing the chain from. Only \
\used if the last known head state is older than given point. If not \
\given and no known head state, the chain tip is used. Composed by the \
\slot number, a separator ('.') and the hash of the block header. For \
\example: \
\52970883.d36a9936ae7a07f5f4bdc9ad0b23761cb7b14f35007e54947e27a1510f897f04."
)
where
readChainPoint :: String -> Maybe ChainPoint
Expand Down