From b7f7b29b64a9e66b070dc134045cbff400be8a2c Mon Sep 17 00:00:00 2001 From: Martin Boehm Date: Tue, 20 Jun 2023 20:59:35 +0200 Subject: [PATCH] Fix port registry generation, regenerate ports table --- .../check-and-generate-port-registry.go | 31 ++-- docs/ports.md | 150 +++++++++--------- 2 files changed, 95 insertions(+), 86 deletions(-) diff --git a/contrib/scripts/check-and-generate-port-registry.go b/contrib/scripts/check-and-generate-port-registry.go index 048a28f3..ec894d7a 100755 --- a/contrib/scripts/check-and-generate-port-registry.go +++ b/contrib/scripts/check-and-generate-port-registry.go @@ -1,4 +1,4 @@ -//usr/bin/go run $0 $@ ; exit +// usr/bin/go run $0 $@ ; exit package main import ( @@ -36,6 +36,7 @@ type Config struct { Coin struct { Name string `json:"name"` Label string `json:"label"` + Alias string `json:"alias"` } Ports map[string]uint16 `json:"ports"` } @@ -69,21 +70,22 @@ func checkPorts() int { } if _, ok := v.Ports["blockbook_internal"]; !ok { - fmt.Printf("%s: missing blockbook_internal port\n", v.Coin.Name) + fmt.Printf("%s (%s): missing blockbook_internal port\n", v.Coin.Name, v.Coin.Alias) status = 1 } if _, ok := v.Ports["blockbook_public"]; !ok { - fmt.Printf("%s: missing blockbook_public port\n", v.Coin.Name) + fmt.Printf("%s (%s): missing blockbook_public port\n", v.Coin.Name, v.Coin.Alias) status = 1 } if _, ok := v.Ports["backend_rpc"]; !ok { - fmt.Printf("%s: missing backend_rpc port\n", v.Coin.Name) + fmt.Printf("%s (%s): missing backend_rpc port\n", v.Coin.Name, v.Coin.Alias) status = 1 } for _, port := range v.Ports { - if port > 0 { - ports[port] = append(ports[port], v.Coin.Name) + // ignore duplicities caused by consensus layer configs + if port > 0 && !strings.Contains(v.Coin.Alias, "_consensus") { + ports[port] = append(ports[port], v.Coin.Alias) } } } @@ -158,8 +160,12 @@ func loadPortInfo(dir string) (PortInfoSlice, error) { return nil, fmt.Errorf("%s: json: %s", path, err) } + // skip consensus layer configs + if strings.Contains(v.Coin.Alias, "_consensus") { + continue + } name := v.Coin.Label - if len(name) == 0 { + if len(name) == 0 || strings.Contains(v.Coin.Name, "Archive") { name = v.Coin.Name } item := &PortInfo{CoinName: name, BackendServicePorts: map[string]uint16{}} @@ -233,7 +239,7 @@ func writeMarkdown(output string, slice PortInfoSlice) error { fmt.Fprintf(&buf, "# Registry of ports\n\n") - header := []string{"coin", "blockbook internal port", "blockbook public port", "backend rpc port", "backend service ports (zmq)"} + header := []string{"coin", "blockbook public", "blockbook internal", "backend rpc", "backend service ports (zmq)"} writeTable(&buf, header, slice) fmt.Fprintf(&buf, "\n> NOTE: This document is generated from coin definitions in `configs/coins`.\n") @@ -263,11 +269,11 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) { for i, item := range slice { row := make([]string, len(header)) row[0] = item.CoinName - if item.BlockbookInternalPort > 0 { - row[1] = fmt.Sprintf("%d", item.BlockbookInternalPort) - } if item.BlockbookPublicPort > 0 { - row[2] = fmt.Sprintf("%d", item.BlockbookPublicPort) + row[1] = fmt.Sprintf("%d", item.BlockbookPublicPort) + } + if item.BlockbookInternalPort > 0 { + row[2] = fmt.Sprintf("%d", item.BlockbookInternalPort) } if item.BackendRPCPort > 0 { row[3] = fmt.Sprintf("%d", item.BackendRPCPort) @@ -284,6 +290,7 @@ func writeTable(w io.Writer, header []string, slice PortInfoSlice) { svcPorts = append(svcPorts, s) } + sort.Strings(svcPorts) row[4] = strings.Join(svcPorts, ", ") rows[i] = row diff --git a/docs/ports.md b/docs/ports.md index 02b8fc20..d61038cc 100644 --- a/docs/ports.md +++ b/docs/ports.md @@ -1,78 +1,80 @@ # Registry of ports -| coin | blockbook internal port | blockbook public port | backend rpc port | backend service ports (zmq) | -|-------------------------|-------------------------|-----------------------|------------------|-----------------------------| -| Bitcoin | 9030 | 9130 | 8030 | 38330 | -| Bitcoin Cash | 9031 | 9131 | 8031 | 38331 | -| Zcash | 9032 | 9132 | 8032 | 38332 | -| Dash | 9033 | 9133 | 8033 | 38333 | -| Litecoin | 9034 | 9134 | 8034 | 38334 | -| Bitcoin Gold | 9035 | 9135 | 8035 | 38335 | -| Ethereum | 9036 | 9136 | 8036 | 38336 p2p, 8136 http | -| Ethereum Classic | 9037 | 9137 | 8037 | | -| Dogecoin | 9038 | 9138 | 8038 | 38338 | -| Namecoin | 9039 | 9139 | 8039 | 38339 | -| Vertcoin | 9040 | 9140 | 8040 | 38340 | -| Monacoin | 9041 | 9141 | 8041 | 38341 | -| DigiByte | 9042 | 9142 | 8042 | 38342 | -| Myriad | 9043 | 9143 | 8043 | 38343 | -| GameCredits | 9044 | 9144 | 8044 | 38344 | -| Groestlcoin | 9045 | 9145 | 8045 | 38345 | -| Bitcoin Cash SV | 9046 | 9146 | 8046 | 38346 | -| Liquid | 9047 | 9147 | 8047 | 38347 | -| Fujicoin | 9048 | 9148 | 8048 | 38348 | -| PIVX | 9049 | 9149 | 8049 | 38349 | -| Firo | 9050 | 9150 | 8050 | 38350 | -| Koto | 9051 | 9151 | 8051 | 38351 | -| Bellcoin | 9052 | 9152 | 8052 | 38352 | -| NULS | 9053 | 9153 | 8053 | 38353 | -| Bitcore | 9054 | 9154 | 8054 | 38354 | -| Viacoin | 9055 | 9155 | 8055 | 38355 | -| VIPSTARCOIN | 9056 | 9156 | 8056 | 38356 | -| MonetaryUnit | 9057 | 9157 | 8057 | 38357 | -| Flux | 9058 | 9158 | 8058 | 38358 | -| Ravencoin | 9059 | 9159 | 8059 | 38359 | -| Ritocoin | 9060 | 9160 | 8060 | 38360 | -| Decred | 9061 | 9161 | 8061 | 38361 | -| SnowGem | 9062 | 9162 | 8062 | 38362 | -| BNB Smart Chain | 9064 | 9164 | 8064 | 38364 p2p, 8164 http | -| BNB Smart Chain Archive | 9065 | 9165 | 8065 | 38365 p2p, 8165 http | -| Flo | 9066 | 9166 | 8066 | 38366 | -| Polis | 9067 | 9167 | 8067 | 38367 | -| Qtum | 9088 | 9188 | 8088 | 38388 | -| Divi Project | 9089 | 9189 | 8089 | 38389 | -| CPUchain | 9090 | 9190 | 8090 | 38390 | -| DeepOnion | 9091 | 9191 | 8091 | 38391 | -| Unobtanium | 9092 | 9192 | 65535 | 38392 | -| Omotenashicoin | 9094 | 9194 | 8094 | 38394 | -| BitZeny | 9095 | 9195 | 8095 | 38395 | -| Trezarcoin | 9096 | 9196 | 8096 | 38396 | -| eCash | 9097 | 9197 | 8097 | 38397 | -| Avalanche | 9098 | 9198 | 8098 | 38398 p2p | -| Avalanche Archive | 9099 | 9199 | 8099 | 38399 p2p | -| Bitcoin Signet | 19020 | 19120 | 18020 | 48320 | -| Bitcoin Regtest | 19021 | 19121 | 18021 | 48321 | -| Ethereum Goerli | 19026 | 19126 | 18026 | 48326 p2p | -| Ethereum Sepolia | 19176 | 19176 | 18076 | 48376 p2p | -| Bitcoin Testnet | 19030 | 19130 | 18030 | 48330 | -| Bitcoin Cash Testnet | 19031 | 19131 | 18031 | 48331 | -| Zcash Testnet | 19032 | 19132 | 18032 | 48332 | -| Dash Testnet | 19033 | 19133 | 18033 | 48333 | -| Litecoin Testnet | 19034 | 19134 | 18034 | 48334 | -| Bitcoin Gold Testnet | 19035 | 19135 | 18035 | 48335 | -| Ethereum Ropsten | 19036 | 19136 | 18036 | 48336 p2p | -| Dogecoin Testnet | 19038 | 19138 | 18038 | 48338 | -| Vertcoin Testnet | 19040 | 19140 | 18040 | 48340 | -| Monacoin Testnet | 19041 | 19141 | 18041 | 48341 | -| DigiByte Testnet | 19042 | 19142 | 18042 | 48342 | -| Groestlcoin Testnet | 19045 | 19145 | 18045 | 48345 | -| Groestlcoin Regtest | 19046 | 19146 | 18046 | 48346 | -| Groestlcoin Signet | 19047 | 19147 | 18047 | 48347 | -| PIVX Testnet | 19049 | 19149 | 18049 | 48349 | -| Koto Testnet | 19051 | 19151 | 18051 | 48351 | -| Decred Testnet | 19061 | 19161 | 18061 | 48361 | -| Flo Testnet | 19066 | 19166 | 18066 | 48366 | -| Qtum Testnet | 19088 | 19188 | 18088 | 48388 | -| Omotenashicoin Testnet | 19089 | 19189 | 18089 | 48389 | +| coin | blockbook public | blockbook internal | backend rpc | backend service ports (zmq) | +|----------------------------------|------------------|--------------------|-------------|--------------------------------------| +| Ethereum Archive | 9116 | 9016 | 8016 | 38316 p2p, 8116 http, 8516 authrpc | +| Bitcoin | 9130 | 9030 | 8030 | 38330 | +| Bitcoin Cash | 9131 | 9031 | 8031 | 38331 | +| Zcash | 9132 | 9032 | 8032 | 38332 | +| Dash | 9133 | 9033 | 8033 | 38333 | +| Litecoin | 9134 | 9034 | 8034 | 38334 | +| Bitcoin Gold | 9135 | 9035 | 8035 | 38335 | +| Ethereum | 9136 | 9036 | 8036 | 38336 p2p, 8136 http, 8536 authrpc | +| Ethereum Classic | 9137 | 9037 | 8037 | 38337 p2p, 8137 http | +| Dogecoin | 9138 | 9038 | 8038 | 38338 | +| Namecoin | 9139 | 9039 | 8039 | 38339 | +| Vertcoin | 9140 | 9040 | 8040 | 38340 | +| Monacoin | 9141 | 9041 | 8041 | 38341 | +| DigiByte | 9142 | 9042 | 8042 | 38342 | +| Myriad | 9143 | 9043 | 8043 | 38343 | +| GameCredits | 9144 | 9044 | 8044 | 38344 | +| Groestlcoin | 9145 | 9045 | 8045 | 38345 | +| Bitcoin Cash SV | 9146 | 9046 | 8046 | 38346 | +| Liquid | 9147 | 9047 | 8047 | 38347 | +| Fujicoin | 9148 | 9048 | 8048 | 38348 | +| PIVX | 9149 | 9049 | 8049 | 38349 | +| Firo | 9150 | 9050 | 8050 | 38350 | +| Koto | 9151 | 9051 | 8051 | 38351 | +| Bellcoin | 9152 | 9052 | 8052 | 38352 | +| NULS | 9153 | 9053 | 8053 | 38353 | +| Bitcore | 9154 | 9054 | 8054 | 38354 | +| Viacoin | 9155 | 9055 | 8055 | 38355 | +| VIPSTARCOIN | 9156 | 9056 | 8056 | 38356 | +| MonetaryUnit | 9157 | 9057 | 8057 | 38357 | +| Flux | 9158 | 9058 | 8058 | 38358 | +| Ravencoin | 9159 | 9059 | 8059 | 38359 | +| Ritocoin | 9160 | 9060 | 8060 | 38360 | +| Decred | 9161 | 9061 | 8061 | 38361 | +| SnowGem | 9162 | 9062 | 8062 | 38362 | +| BNB Smart Chain | 9164 | 9064 | 8064 | 38364 p2p, 8164 http | +| BNB Smart Chain Archive | 9165 | 9065 | 8065 | 38365 p2p, 8165 http | +| Flo | 9166 | 9066 | 8066 | 38366 | +| Polis | 9167 | 9067 | 8067 | 38367 | +| Qtum | 9188 | 9088 | 8088 | 38388 | +| Divi Project | 9189 | 9089 | 8089 | 38389 | +| CPUchain | 9190 | 9090 | 8090 | 38390 | +| DeepOnion | 9191 | 9091 | 8091 | 38391 | +| Unobtanium | 9192 | 9092 | 65535 | 38392 | +| Omotenashicoin | 9194 | 9094 | 8094 | 38394 | +| BitZeny | 9195 | 9095 | 8095 | 38395 | +| Trezarcoin | 9196 | 9096 | 8096 | 38396 | +| eCash | 9197 | 9097 | 8097 | 38397 | +| Avalanche | 9198 | 9098 | 8098 | 38398 p2p | +| Avalanche Archive | 9199 | 9099 | 8099 | 38399 p2p | +| Ethereum Testnet Goerli Archive | 19106 | 19006 | 18006 | 18106 http, 18506 authrpc, 48306 p2p | +| Bitcoin Signet | 19120 | 19020 | 18020 | 48320 | +| Bitcoin Regtest | 19121 | 19021 | 18021 | 48321 | +| Ethereum Goerli | 19126 | 19026 | 18026 | 18126 http, 18526 authrpc, 48326 p2p | +| Bitcoin Testnet | 19130 | 19030 | 18030 | 48330 | +| Bitcoin Cash Testnet | 19131 | 19031 | 18031 | 48331 | +| Zcash Testnet | 19132 | 19032 | 18032 | 48332 | +| Dash Testnet | 19133 | 19033 | 18033 | 48333 | +| Litecoin Testnet | 19134 | 19034 | 18034 | 48334 | +| Bitcoin Gold Testnet | 19135 | 19035 | 18035 | 48335 | +| Dogecoin Testnet | 19138 | 19038 | 18038 | 48338 | +| Vertcoin Testnet | 19140 | 19040 | 18040 | 48340 | +| Monacoin Testnet | 19141 | 19041 | 18041 | 48341 | +| DigiByte Testnet | 19142 | 19042 | 18042 | 48342 | +| Groestlcoin Testnet | 19145 | 19045 | 18045 | 48345 | +| Groestlcoin Regtest | 19146 | 19046 | 18046 | 48346 | +| Groestlcoin Signet | 19147 | 19047 | 18047 | 48347 | +| PIVX Testnet | 19149 | 19049 | 18049 | 48349 | +| Koto Testnet | 19151 | 19051 | 18051 | 48351 | +| Decred Testnet | 19161 | 19061 | 18061 | 48361 | +| Flo Testnet | 19166 | 19066 | 18066 | 48366 | +| Ethereum Sepolia | 19176 | 19076 | 18076 | 18176 http, 18576 authrpc, 48376 p2p | +| Ethereum Testnet Sepolia Archive | 19186 | 19086 | 18086 | 18186 http, 18586 authrpc, 48386 p2p | +| Qtum Testnet | 19188 | 19088 | 18088 | 48388 | +| Omotenashicoin Testnet | 19189 | 19089 | 18089 | 48389 | > NOTE: This document is generated from coin definitions in `configs/coins`.