-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathmain.go
More file actions
30 lines (25 loc) · 854 Bytes
/
Copy pathmain.go
File metadata and controls
30 lines (25 loc) · 854 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package main
import (
"flag"
"fmt"
"log"
"github.com/canopy-network/canopy-rpc-mock/mockserver"
)
func main() {
var (
blockCount = flag.Int("blocks", 50, "number of blocks to prebuild per chain")
numChains = flag.Int("chains", 3, "number of chains to serve")
startPort = flag.Int("start-port", 60000, "starting port for first chain")
startChainID = flag.Uint64("start-chain-id", 1, "starting chain ID")
)
flag.Parse()
servers := make([]*mockserver.Server, 0, *numChains)
for i := 0; i < *numChains; i++ {
chainID := *startChainID + uint64(i)
addr := fmt.Sprintf(":%d", *startPort+i)
srv := mockserver.New(chainID, mockserver.WithBlocks(*blockCount), mockserver.WithAddr(addr))
servers = append(servers, srv)
log.Printf("mock RPC server ready on %s (chainID=%d)", srv.URL, chainID)
}
select {} // block forever
}