mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-30 14:05:23 +00:00
06a544ac85
The forking facility has been replaced by ForkedChain - frames and layers are two other mechanisms that mostly do the same thing at the aristo level, without quite providing the functionality FC needs - this cleanup will make that integration easier.
45 lines
1.5 KiB
Nim
45 lines
1.5 KiB
Nim
# nimbus-eth1
|
|
# Copyright (c) 2023-2024 Status Research & Development GmbH
|
|
# Licensed under either of
|
|
# * Apache License, version 2.0, ([LICENSE-APACHE](LICENSE-APACHE) or
|
|
# http://www.apache.org/licenses/LICENSE-2.0)
|
|
# * MIT license ([LICENSE-MIT](LICENSE-MIT) or
|
|
# http://opensource.org/licenses/MIT)
|
|
# at your option. This file may not be copied, modified, or distributed
|
|
# except according to those terms.
|
|
|
|
import
|
|
".."/[aristo_desc, aristo_layers]
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# Public functions
|
|
# ------------------------------------------------------------------------------
|
|
|
|
proc deltaMerge*(
|
|
upper: LayerRef; # Think of `top`, `nil` is ok
|
|
lower: LayerRef; # Think of `balancer`, `nil` is ok
|
|
): LayerRef =
|
|
## Merge argument `upper` into the `lower` filter instance.
|
|
##
|
|
## Note that the namimg `upper` and `lower` indicate that the filters are
|
|
## stacked and the database access is `upper -> lower -> backend`.
|
|
##
|
|
if lower.isNil:
|
|
# Degenerate case: `upper` is void
|
|
upper
|
|
|
|
elif upper.isNil:
|
|
# Degenerate case: `lower` is void
|
|
lower
|
|
|
|
else:
|
|
# Can modify `lower` which is the prefered action mode but applies only
|
|
# in cases where the `lower` argument is not shared.
|
|
lower.vTop = upper.vTop
|
|
layersMergeOnto(upper, lower[])
|
|
lower
|
|
|
|
# ------------------------------------------------------------------------------
|
|
# End
|
|
# ------------------------------------------------------------------------------
|