@blinklabs/dingo 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (188) hide show
  1. package/.dingo/blob/000001.sst +0 -0
  2. package/.dingo/blob/000001.vlog +0 -0
  3. package/.dingo/blob/DISCARD +0 -0
  4. package/.dingo/blob/KEYREGISTRY +2 -0
  5. package/.dingo/blob/MANIFEST +0 -0
  6. package/.dingo/metadata.sqlite +0 -0
  7. package/.github/workflows/golangci-lint.yml +1 -1
  8. package/.github/workflows/publish.yml +1 -7
  9. package/README.md +2 -1
  10. package/{dist/dingo_darwin_amd64_v1/dingo → dingo} +0 -0
  11. package/dingo.yaml.example +53 -0
  12. package/package.json +5 -5
  13. package/Dockerfile +0 -25
  14. package/Makefile +0 -53
  15. package/blockfetch.go +0 -144
  16. package/chain/chain.go +0 -504
  17. package/chain/chain_test.go +0 -468
  18. package/chain/errors.go +0 -80
  19. package/chain/event.go +0 -33
  20. package/chain/iter.go +0 -64
  21. package/chainsync/chainsync.go +0 -97
  22. package/chainsync.go +0 -223
  23. package/cmd/dingo/load.go +0 -52
  24. package/cmd/dingo/main.go +0 -118
  25. package/cmd/dingo/serve.go +0 -49
  26. package/config/cardano/node.go +0 -192
  27. package/config/cardano/node_test.go +0 -85
  28. package/config/cardano/preview/README.md +0 -4
  29. package/config/cardano/preview/alonzo-genesis.json +0 -196
  30. package/config/cardano/preview/byron-genesis.json +0 -117
  31. package/config/cardano/preview/config.json +0 -114
  32. package/config/cardano/preview/conway-genesis.json +0 -297
  33. package/config/cardano/preview/shelley-genesis.json +0 -68
  34. package/config.go +0 -245
  35. package/connmanager/connection_manager.go +0 -105
  36. package/connmanager/connection_manager_test.go +0 -185
  37. package/connmanager/event.go +0 -37
  38. package/connmanager/listener.go +0 -140
  39. package/connmanager/outbound.go +0 -93
  40. package/connmanager/socket.go +0 -55
  41. package/connmanager/unix.go +0 -78
  42. package/custom-p2p-topology.json +0 -24
  43. package/custom-p2p-topology.json.backup +0 -24
  44. package/custom-p2p-topology.json.mainnet +0 -37
  45. package/database/account.go +0 -138
  46. package/database/block.go +0 -362
  47. package/database/certs.go +0 -53
  48. package/database/commit_timestamp.go +0 -77
  49. package/database/database.go +0 -118
  50. package/database/database_test.go +0 -62
  51. package/database/drep.go +0 -27
  52. package/database/epoch.go +0 -121
  53. package/database/immutable/chunk.go +0 -182
  54. package/database/immutable/immutable.go +0 -350
  55. package/database/immutable/immutable_test.go +0 -59
  56. package/database/immutable/primary.go +0 -106
  57. package/database/immutable/secondary.go +0 -103
  58. package/database/immutable/testdata/08893.chunk +0 -0
  59. package/database/immutable/testdata/08893.primary +0 -0
  60. package/database/immutable/testdata/08893.secondary +0 -0
  61. package/database/immutable/testdata/08894.chunk +0 -0
  62. package/database/immutable/testdata/08894.primary +0 -0
  63. package/database/immutable/testdata/08894.secondary +0 -0
  64. package/database/immutable/testdata/README.md +0 -4
  65. package/database/plugin/blob/badger/commit_timestamp.go +0 -50
  66. package/database/plugin/blob/badger/database.go +0 -152
  67. package/database/plugin/blob/badger/logger.go +0 -63
  68. package/database/plugin/blob/badger/metrics.go +0 -98
  69. package/database/plugin/blob/blob.go +0 -19
  70. package/database/plugin/blob/store.go +0 -40
  71. package/database/plugin/log.go +0 -27
  72. package/database/plugin/metadata/metadata.go +0 -19
  73. package/database/plugin/metadata/sqlite/account.go +0 -224
  74. package/database/plugin/metadata/sqlite/certs.go +0 -58
  75. package/database/plugin/metadata/sqlite/commit_timestamp.go +0 -68
  76. package/database/plugin/metadata/sqlite/database.go +0 -218
  77. package/database/plugin/metadata/sqlite/epoch.go +0 -120
  78. package/database/plugin/metadata/sqlite/models/account.go +0 -81
  79. package/database/plugin/metadata/sqlite/models/auth_committee_hot.go +0 -26
  80. package/database/plugin/metadata/sqlite/models/deregistration_drep.go +0 -26
  81. package/database/plugin/metadata/sqlite/models/drep.go +0 -27
  82. package/database/plugin/metadata/sqlite/models/epoch.go +0 -31
  83. package/database/plugin/metadata/sqlite/models/models.go +0 -45
  84. package/database/plugin/metadata/sqlite/models/pool.go +0 -97
  85. package/database/plugin/metadata/sqlite/models/pparam_update.go +0 -27
  86. package/database/plugin/metadata/sqlite/models/pparams.go +0 -27
  87. package/database/plugin/metadata/sqlite/models/registration_drep.go +0 -28
  88. package/database/plugin/metadata/sqlite/models/resign_committee_cold.go +0 -27
  89. package/database/plugin/metadata/sqlite/models/stake_registration_delegation.go +0 -27
  90. package/database/plugin/metadata/sqlite/models/stake_vote_delegation.go +0 -27
  91. package/database/plugin/metadata/sqlite/models/stake_vote_registration_delegation.go +0 -27
  92. package/database/plugin/metadata/sqlite/models/tip.go +0 -26
  93. package/database/plugin/metadata/sqlite/models/update_drep.go +0 -27
  94. package/database/plugin/metadata/sqlite/models/utxo.go +0 -30
  95. package/database/plugin/metadata/sqlite/models/vote_delegation.go +0 -26
  96. package/database/plugin/metadata/sqlite/models/vote_registration_delegation.go +0 -26
  97. package/database/plugin/metadata/sqlite/pool.go +0 -240
  98. package/database/plugin/metadata/sqlite/pparams.go +0 -110
  99. package/database/plugin/metadata/sqlite/tip.go +0 -83
  100. package/database/plugin/metadata/sqlite/utxo.go +0 -292
  101. package/database/plugin/metadata/store.go +0 -168
  102. package/database/plugin/option.go +0 -190
  103. package/database/plugin/plugin.go +0 -20
  104. package/database/plugin/register.go +0 -118
  105. package/database/pparams.go +0 -145
  106. package/database/tip.go +0 -45
  107. package/database/txn.go +0 -147
  108. package/database/types/types.go +0 -74
  109. package/database/types/types_test.go +0 -83
  110. package/database/utxo.go +0 -263
  111. package/dist/artifacts.json +0 -1
  112. package/dist/checksums.txt +0 -22
  113. package/dist/config.yaml +0 -253
  114. package/dist/dingo-0.5.0-SNAPSHOT-d9431e4.tar.gz +0 -0
  115. package/dist/dingo-0.5.0-SNAPSHOT-d9431e4.tar.gz.sbom.json +0 -1
  116. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_arm64.tar.gz +0 -0
  117. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_arm64.tar.gz.sbom.json +0 -1
  118. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_x86_64.tar.gz +0 -0
  119. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_darwin_x86_64.tar.gz.sbom.json +0 -1
  120. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.apk +0 -0
  121. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.apk.sbom.json +0 -1
  122. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.deb +0 -0
  123. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.deb.sbom.json +0 -1
  124. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.rpm +0 -0
  125. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_amd64.rpm.sbom.json +0 -1
  126. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.apk +0 -0
  127. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.apk.sbom.json +0 -1
  128. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.deb +0 -0
  129. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.deb.sbom.json +0 -1
  130. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.rpm +0 -0
  131. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.rpm.sbom.json +0 -1
  132. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.tar.gz +0 -0
  133. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_arm64.tar.gz.sbom.json +0 -1
  134. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_x86_64.tar.gz +0 -0
  135. package/dist/dingo_0.5.0-SNAPSHOT-d9431e4_linux_x86_64.tar.gz.sbom.json +0 -1
  136. package/dist/dingo_darwin_arm64_v8.0/dingo +0 -0
  137. package/dist/dingo_linux_amd64_v1/dingo +0 -0
  138. package/dist/dingo_linux_arm64_v8.0/dingo +0 -0
  139. package/dist/homebrew/dingo.rb +0 -51
  140. package/dist/metadata.json +0 -1
  141. package/event/event.go +0 -141
  142. package/event/event_test.go +0 -115
  143. package/event/metrics.go +0 -44
  144. package/go.mod +0 -98
  145. package/go.sum +0 -358
  146. package/internal/config/config.go +0 -145
  147. package/internal/config/config_test.go +0 -118
  148. package/internal/node/load.go +0 -149
  149. package/internal/node/node.go +0 -176
  150. package/internal/version/version.go +0 -33
  151. package/ledger/certs.go +0 -113
  152. package/ledger/chainsync.go +0 -578
  153. package/ledger/eras/allegra.go +0 -154
  154. package/ledger/eras/alonzo.go +0 -156
  155. package/ledger/eras/babbage.go +0 -154
  156. package/ledger/eras/byron.go +0 -42
  157. package/ledger/eras/conway.go +0 -158
  158. package/ledger/eras/eras.go +0 -44
  159. package/ledger/eras/mary.go +0 -154
  160. package/ledger/eras/shelley.go +0 -164
  161. package/ledger/error.go +0 -19
  162. package/ledger/event.go +0 -50
  163. package/ledger/metrics.go +0 -53
  164. package/ledger/queries.go +0 -260
  165. package/ledger/slot.go +0 -127
  166. package/ledger/slot_test.go +0 -147
  167. package/ledger/state.go +0 -726
  168. package/ledger/view.go +0 -73
  169. package/localstatequery.go +0 -50
  170. package/localtxmonitor.go +0 -44
  171. package/localtxsubmission.go +0 -52
  172. package/mempool/consumer.go +0 -98
  173. package/mempool/mempool.go +0 -322
  174. package/node.go +0 -320
  175. package/peergov/event.go +0 -27
  176. package/peergov/peer.go +0 -67
  177. package/peergov/peergov.go +0 -290
  178. package/peersharing.go +0 -70
  179. package/preview-local-topology.json +0 -23
  180. package/topology/topology.go +0 -69
  181. package/topology/topology_test.go +0 -179
  182. package/tracing.go +0 -65
  183. package/txsubmission.go +0 -233
  184. package/utxorpc/query.go +0 -311
  185. package/utxorpc/submit.go +0 -395
  186. package/utxorpc/sync.go +0 -276
  187. package/utxorpc/utxorpc.go +0 -166
  188. package/utxorpc/watch.go +0 -310
Binary file
Binary file
Binary file
@@ -0,0 +1,2 @@
1
+ ��
2
+ � �-��G)�+��Hello Badger
Binary file
Binary file
@@ -20,4 +20,4 @@ jobs:
20
20
  with:
21
21
  go-version: 1.23.x
22
22
  - name: golangci-lint
23
- uses: golangci/golangci-lint-action@v7
23
+ uses: golangci/golangci-lint-action@v8
@@ -87,13 +87,7 @@ jobs:
87
87
  if: startsWith(github.ref, 'refs/tags/')
88
88
  run: |
89
89
  _filename=${{ env.APPLICATION_NAME }}-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}.tar.gz
90
- if [[ "${{ matrix.os }}" != "darwin" ]]; then
91
- tar czf ${_filename} ${{ env.APPLICATION_NAME }}
92
- fi
93
- if [[ "${{ matrix.os }}" == "darwin" ]]; then
94
- _filename=${{ env.APPLICATION_NAME }}-${{ env.RELEASE_TAG }}-${{ matrix.os }}-${{ matrix.arch }}.zip
95
- zip -r ${_filename} ${{ env.APPLICATION_NAME }}
96
- fi
90
+ tar czf ${_filename} ${{ env.APPLICATION_NAME }}
97
91
  curl \
98
92
  -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \
99
93
  -H "Content-Type: application/octet-stream" \
package/README.md CHANGED
@@ -19,9 +19,10 @@
19
19
 
20
20
  ## Running
21
21
 
22
- Dingo does not support a configuration file of its own and uses environment
22
+ Dingo supports configuration via both a YAML config file (`dingo.yaml`) and uses environment
23
23
  variables to modify its own behavior.
24
24
 
25
+ A sample configuration file is provided at `dingo.yaml.example`.You can copy and edit this file to configure Dingo for your local or production environment:
25
26
  This behavior can be changed via the following environment variables:
26
27
 
27
28
  - `CARDANO_BIND_ADDR`
@@ -0,0 +1,53 @@
1
+ # Example config file for dingo
2
+ # The values shown below correspond to the in-code defaults
3
+
4
+ # Public bind address for the Dingo server
5
+ bindAddr: "0.0.0.0"
6
+
7
+ # Path to the Cardano node configuration file
8
+ #
9
+ # Can be overridden with the config environment variable
10
+ cardanoConfig: "./config/cardano/preview/config.json"
11
+
12
+ # A directory which contains the ledger database files
13
+ databasePath: ".dingo"
14
+
15
+ # Path to the UNIX domain socket file used by the server
16
+ socketPath: "dingo.socket"
17
+
18
+ # Name of the Cardano network
19
+ network: "preview"
20
+
21
+ # TLS certificate file path (for HTTPS)
22
+ #
23
+ # Can be overridden with the TLS_CERT_FILE_PATH environment variable
24
+ tlsCertFilePath: ""
25
+
26
+ # TLS key file path (for HTTPS)
27
+ #
28
+ # Can be overridden with the TLS_KEY_FILE_PATH environment variable
29
+ tlsKeyFilePath: ""
30
+
31
+ # Path to the topology configuration file for Cardano node
32
+ topology: ""
33
+
34
+ # TCP port to bind for Prometheus metrics endpoint
35
+ metricsPort: 12798
36
+
37
+ # Internal/private address to bind for listening for Ouroboros NtC
38
+ privateBindAddr: "127.0.0.1"
39
+
40
+ # TCP port to bind for listening for Ouroboros NtC
41
+ privatePort: 3002
42
+
43
+ # TCP port to bind for listening for Ouroboros NtN
44
+ #
45
+ # Can be overridden with the port environment variable
46
+ relayPort: 3001
47
+
48
+ # TCP port to bind for listening for UTxO RPC
49
+ utxorpcPort: 9090
50
+
51
+ # Ignore prior chain history and start from current tip (default: false)
52
+ # This is experimental and may break — use with caution
53
+ intersectTip: false
package/package.json CHANGED
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "name": "@blinklabs/dingo",
3
- "version": "0.6.0",
3
+ "version": "0.8.0",
4
4
  "description": "Dingo is a Cardano blockchain data node",
5
5
  "main": "index.js",
6
+ "bin": "dingo",
6
7
  "scripts": {
7
8
  "postinstall": "golang-npm install",
8
- "preuninstall": "golang-npm uninstall",
9
- "test": "echo \"Error: no test specified\" && exit 1"
9
+ "preuninstall": "golang-npm uninstall"
10
10
  },
11
11
  "repository": {
12
12
  "type": "git",
@@ -23,11 +23,11 @@
23
23
  },
24
24
  "homepage": "https://github.com/blinklabs-io/dingo#readme",
25
25
  "dependencies": {
26
- "golang-npm": "^0.0.5"
26
+ "golang-npm": "^0.0.6"
27
27
  },
28
28
  "goBinary": {
29
29
  "name": "dingo",
30
30
  "path": "./bin",
31
- "url": "https://github.com/blinklabs-io/dingo/releases/download/v{{version}}/dingo-{{version}}-{{platform}}-{{arch}}.tar.gz"
31
+ "url": "https://github.com/blinklabs-io/dingo/releases/download/v{{version}}/dingo-v{{version}}-{{platform}}-{{arch}}.tar.gz"
32
32
  }
33
33
  }
package/Dockerfile DELETED
@@ -1,25 +0,0 @@
1
- FROM ghcr.io/blinklabs-io/go:1.24.2-1 AS build
2
-
3
- WORKDIR /code
4
- COPY go.* .
5
- RUN go mod download
6
- COPY . .
7
- RUN make build
8
-
9
- FROM ghcr.io/blinklabs-io/cardano-configs:20250213-1 AS cardano-configs
10
- FROM ghcr.io/blinklabs-io/txtop:0.12.3 AS txtop
11
-
12
- FROM debian:bookworm-slim AS dingo
13
- COPY --from=build /code/dingo /bin/
14
- COPY --from=cardano-configs /config/ /opt/cardano/config/
15
- COPY --from=txtop /bin/txtop /usr/local/bin/
16
- ENV CARDANO_CONFIG=/opt/cardano/config/preview/config.json
17
- ENV CARDANO_NETWORK=preview
18
- # Create database dir owned by container user
19
- VOLUME /data/db
20
- ENV CARDANO_DATABASE_PATH=/data/db
21
- # Create socket dir owned by container user
22
- VOLUME /ipc
23
- ENV CARDANO_NODE_SOCKET_PATH=/ipc/dingo.socket
24
- ENV CARDANO_SOCKET_PATH=/ipc/dingo.socket
25
- ENTRYPOINT ["dingo"]
package/Makefile DELETED
@@ -1,53 +0,0 @@
1
- # Determine root directory
2
- ROOT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
3
-
4
- # Gather all .go files for use in dependencies below
5
- GO_FILES=$(shell find $(ROOT_DIR) -name '*.go')
6
-
7
- # Gather list of expected binaries
8
- BINARIES=$(shell cd $(ROOT_DIR)/cmd && ls -1 | grep -v ^common)
9
-
10
- # Extract Go module name from go.mod
11
- GOMODULE=$(shell grep ^module $(ROOT_DIR)/go.mod | awk '{ print $$2 }')
12
-
13
- # Set version strings based on git tag and current ref
14
- GO_LDFLAGS=-ldflags "-s -w -X '$(GOMODULE)/internal/version.Version=$(shell git describe --tags --exact-match 2>/dev/null)' -X '$(GOMODULE)/internal/version.CommitHash=$(shell git rev-parse --short HEAD)'"
15
-
16
- .PHONY: build mod-tidy clean format golines test
17
-
18
- # Alias for building program binary
19
- build: $(BINARIES)
20
-
21
- # Builds and installs binary in ~/.local/bin
22
- install: build
23
- mkdir -p $(HOME)/.local/bin
24
- mv $(BINARIES) $(HOME)/.local/bin
25
-
26
- uninstall:
27
- rm -f $(HOME)/.local/bin/$(BINARIES)
28
-
29
- mod-tidy:
30
- # Needed to fetch new dependencies and add them to go.mod
31
- go mod tidy
32
-
33
- clean:
34
- rm -f $(BINARIES)
35
-
36
- format:
37
- go fmt ./...
38
- gofmt -s -w $(GO_FILES)
39
-
40
- golines:
41
- golines -w --ignore-generated --chain-split-dots --max-len=80 --reformat-tags .
42
-
43
- test: mod-tidy
44
- go test -v -race ./...
45
-
46
- # Build our program binaries
47
- # Depends on GO_FILES to determine when rebuild is needed
48
- $(BINARIES): mod-tidy $(GO_FILES)
49
- CGO_ENABLED=0 \
50
- go build \
51
- $(GO_LDFLAGS) \
52
- -o $(@) \
53
- ./cmd/$(@)
package/blockfetch.go DELETED
@@ -1,144 +0,0 @@
1
- // Copyright 2024 Blink Labs Software
2
- //
3
- // Licensed under the Apache License, Version 2.0 (the "License");
4
- // you may not use this file except in compliance with the License.
5
- // You may obtain a copy of the License at
6
- //
7
- // http://www.apache.org/licenses/LICENSE-2.0
8
- //
9
- // Unless required by applicable law or agreed to in writing, software
10
- // distributed under the License is distributed on an "AS IS" BASIS,
11
- // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
- // See the License for the specific language governing permissions and
13
- // limitations under the License.
14
-
15
- package dingo
16
-
17
- import (
18
- "fmt"
19
- "time"
20
-
21
- "github.com/blinklabs-io/dingo/event"
22
- "github.com/blinklabs-io/dingo/ledger"
23
- ouroboros "github.com/blinklabs-io/gouroboros"
24
- gledger "github.com/blinklabs-io/gouroboros/ledger"
25
- "github.com/blinklabs-io/gouroboros/protocol/blockfetch"
26
- ocommon "github.com/blinklabs-io/gouroboros/protocol/common"
27
- )
28
-
29
- func (n *Node) blockfetchServerConnOpts() []blockfetch.BlockFetchOptionFunc {
30
- return []blockfetch.BlockFetchOptionFunc{
31
- blockfetch.WithRequestRangeFunc(n.blockfetchServerRequestRange),
32
- }
33
- }
34
-
35
- func (n *Node) blockfetchClientConnOpts() []blockfetch.BlockFetchOptionFunc {
36
- return []blockfetch.BlockFetchOptionFunc{
37
- blockfetch.WithBlockFunc(n.blockfetchClientBlock),
38
- blockfetch.WithBatchDoneFunc(n.blockfetchClientBatchDone),
39
- blockfetch.WithBatchStartTimeout(2 * time.Second),
40
- blockfetch.WithBlockTimeout(2 * time.Second),
41
- // Set the recv queue size to 2x our block batch size
42
- blockfetch.WithRecvQueueSize(1000),
43
- }
44
- }
45
-
46
- func (n *Node) blockfetchServerRequestRange(
47
- ctx blockfetch.CallbackContext,
48
- start ocommon.Point,
49
- end ocommon.Point,
50
- ) error {
51
- // TODO: check if we have requested block range available and send NoBlocks if not (#397)
52
- chainIter, err := n.ledgerState.GetChainFromPoint(start, true)
53
- if err != nil {
54
- return err
55
- }
56
- // Start async process to send requested block range
57
- go func() {
58
- if err := ctx.Server.StartBatch(); err != nil {
59
- return
60
- }
61
- for {
62
- next, _ := chainIter.Next(false)
63
- if next == nil {
64
- break
65
- }
66
- if next.Block.Slot > end.Slot {
67
- break
68
- }
69
- blockBytes := next.Block.Cbor[:]
70
- err := ctx.Server.Block(
71
- next.Block.Type,
72
- blockBytes,
73
- )
74
- if err != nil {
75
- // TODO: push this error somewhere (#398)
76
- return
77
- }
78
- // Make sure we don't hang waiting for the next block if we've already hit the end
79
- if next.Block.Slot == end.Slot {
80
- break
81
- }
82
- }
83
- if err := ctx.Server.BatchDone(); err != nil {
84
- return
85
- }
86
- }()
87
- return nil
88
- }
89
-
90
- // blockfetchClientRequestRange is called by the ledger when it needs to request a range of block bodies
91
- func (n *Node) blockfetchClientRequestRange(
92
- connId ouroboros.ConnectionId,
93
- start ocommon.Point,
94
- end ocommon.Point,
95
- ) error {
96
- conn := n.connManager.GetConnectionById(connId)
97
- if conn == nil {
98
- return fmt.Errorf("failed to lookup connection ID: %s", connId.String())
99
- }
100
- if err := conn.BlockFetch().Client.GetBlockRange(start, end); err != nil {
101
- return err
102
- }
103
- return nil
104
- }
105
-
106
- func (n *Node) blockfetchClientBlock(
107
- ctx blockfetch.CallbackContext,
108
- blockType uint,
109
- block gledger.Block,
110
- ) error {
111
- // Generate event
112
- n.eventBus.Publish(
113
- ledger.BlockfetchEventType,
114
- event.NewEvent(
115
- ledger.BlockfetchEventType,
116
- ledger.BlockfetchEvent{
117
- Point: ocommon.NewPoint(
118
- block.SlotNumber(),
119
- block.Hash().Bytes(),
120
- ),
121
- Type: blockType,
122
- Block: block,
123
- },
124
- ),
125
- )
126
- return nil
127
- }
128
-
129
- func (n *Node) blockfetchClientBatchDone(
130
- ctx blockfetch.CallbackContext,
131
- ) error {
132
- // Generate event
133
- n.eventBus.Publish(
134
- ledger.BlockfetchEventType,
135
- event.NewEvent(
136
- ledger.BlockfetchEventType,
137
- ledger.BlockfetchEvent{
138
- ConnectionId: ctx.ConnectionId,
139
- BatchDone: true,
140
- },
141
- ),
142
- )
143
- return nil
144
- }