MCPcopy Create free account
hub / github.com/DeAI-Artist/Linkis / createAndStartPrivValidatorSocketClient

Function createAndStartPrivValidatorSocketClient

node/node.go:1449–1477  ·  view source on GitHub ↗
(
	listenAddr,
	chainID string,
	logger log.Logger,
)

Source from the content-addressed store, hash-verified

1447}
1448
1449func createAndStartPrivValidatorSocketClient(
1450 listenAddr,
1451 chainID string,
1452 logger log.Logger,
1453) (types.PrivValidator, error) {
1454 pve, err := privval.NewSignerListener(listenAddr, logger)
1455 if err != nil {
1456 return nil, fmt.Errorf("failed to start private validator: %w", err)
1457 }
1458
1459 pvsc, err := privval.NewSignerClient(pve, chainID)
1460 if err != nil {
1461 return nil, fmt.Errorf("failed to start private validator: %w", err)
1462 }
1463
1464 // try to get a pubkey from private validate first time
1465 _, err = pvsc.GetPubKey()
1466 if err != nil {
1467 return nil, fmt.Errorf("can't get pubkey: %w", err)
1468 }
1469
1470 const (
1471 retries = 50 // 50 * 100ms = 5s total
1472 timeout = 100 * time.Millisecond
1473 )
1474 pvscWithRetries := privval.NewRetrySignerClient(pvsc, retries, timeout)
1475
1476 return pvscWithRetries, nil
1477}
1478
1479// splitAndTrimEmpty slices s into all subslices separated by sep and returns a
1480// slice of the string s with all leading and trailing Unicode code points

Callers 1

NewNodeFunction · 0.70

Calls 4

GetPubKeyMethod · 0.95
NewSignerListenerFunction · 0.92
NewSignerClientFunction · 0.92
NewRetrySignerClientFunction · 0.92

Tested by

no test coverage detected