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

Function createAndStartPrivValidatorSocketClient

test/maverick/node/node.go:1443–1471  ·  view source on GitHub ↗
(
	listenAddr,
	chainID string,
	logger log.Logger,
)

Source from the content-addressed store, hash-verified

1441}
1442
1443func createAndStartPrivValidatorSocketClient(
1444 listenAddr,
1445 chainID string,
1446 logger log.Logger,
1447) (types.PrivValidator, error) {
1448 pve, err := privval.NewSignerListener(listenAddr, logger)
1449 if err != nil {
1450 return nil, fmt.Errorf("failed to start private validator: %w", err)
1451 }
1452
1453 pvsc, err := privval.NewSignerClient(pve, chainID)
1454 if err != nil {
1455 return nil, fmt.Errorf("failed to start private validator: %w", err)
1456 }
1457
1458 // try to get a pubkey from private validate first time
1459 _, err = pvsc.GetPubKey()
1460 if err != nil {
1461 return nil, fmt.Errorf("can't get pubkey: %w", err)
1462 }
1463
1464 const (
1465 retries = 50 // 50 * 100ms = 5s total
1466 timeout = 100 * time.Millisecond
1467 )
1468 pvscWithRetries := privval.NewRetrySignerClient(pvsc, retries, timeout)
1469
1470 return pvscWithRetries, nil
1471}
1472
1473// splitAndTrimEmpty slices s into all subslices separated by sep and returns a
1474// 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