@@ -38,8 +38,7 @@ type Options struct {
3838 Denom string // e.g., upc
3939 GenesisDomain string // e.g., donut.rpc.push.org
4040 BinPath string // pchaind path
41- SnapshotRPCPrimary string // e.g., https://donut.rpc.push.org
42- SnapshotRPCSecondary string // optional; if empty uses primary
41+ SnapshotRPC string // e.g., https://donut.rpc.push.org
4342 Progress func (string ) // optional callback for progress messages
4443}
4544
@@ -154,10 +153,10 @@ func (s *svc) Init(ctx context.Context, opts Options) error {
154153 progress ("Using fullnode peers for state sync..." )
155154 peers := fullnodePeers
156155
157- // Set snapshot RPC primary (use first fullnode)
158- snapPrimary := opts .SnapshotRPCPrimary
159- if snapPrimary == "" {
160- snapPrimary = fullnodeRPCs [0 ]
156+ // Set snapshot RPC (use first fullnode if not specified )
157+ snapshotRPC := opts .SnapshotRPC
158+ if snapshotRPC == "" {
159+ snapshotRPC = fullnodeRPCs [0 ]
161160 }
162161
163162 // Configure peers via config store
@@ -179,34 +178,15 @@ func (s *svc) Init(ctx context.Context, opts Options) error {
179178 }
180179 }
181180
182- // Configure state sync parameters using snapshot RPC (reuse variable from above)
181+ // Configure state sync parameters using snapshot RPC
183182 progress ("Configuring state sync parameters..." )
184- tp , err := s .stp .ComputeTrust (ctx , snapPrimary )
183+ tp , err := s .stp .ComputeTrust (ctx , snapshotRPC )
185184 if err != nil {
186185 return fmt .Errorf ("compute trust params: %w" , err )
187186 }
188- // Build and filter RPC servers to those that accept JSON-RPC POST (light client requirement)
189- // Add both primary and secondary (fallback to node1 if secondary not provided)
190- candidates := []string {hostToStateSyncURL (snapPrimary )}
191- snapSecondary := opts .SnapshotRPCSecondary
192- if snapSecondary == "" {
193- // Default to fullnode-2 as secondary witness if not specified
194- snapSecondary = fullnodeRPCs [1 ]
195- }
196- if snapSecondary != snapPrimary {
197- candidates = append (candidates , hostToStateSyncURL (snapSecondary ))
198- }
199-
200- rpcServers := s .pickWorkingRPCs (ctx , candidates )
201- if len (rpcServers ) == 0 {
202- return fmt .Errorf ("no working RPC servers for state sync (JSON-RPC POST failed)" )
203- }
204- // Ensure we provide two entries (primary + witness). Only duplicate as last resort.
205- if len (rpcServers ) == 1 {
206- // Try adding fullnode-2 as fallback
207- fallback := "http://34.72.243.200:26657" // fullnode-2
208- rpcServers = append (rpcServers , fallback )
209- }
187+ // Build RPC servers list (state sync requires at least 2 entries for verification)
188+ rpcURL := hostToStateSyncURL (snapshotRPC )
189+ rpcServers := []string {rpcURL , rpcURL } // Duplicate single endpoint for 2-entry requirement
210190 progress ("Backing up configuration..." )
211191 if _ , err := cfgs .Backup (); err == nil { /* best-effort */
212192 }
0 commit comments