MCPcopy Create free account
hub / github.com/DOSNetwork/core / StartCommitReveal

Method StartCommitReveal

onchain/eth_set.go:461–490  ·  view source on GitHub ↗
(startBlock int64, commitDuration int64, revealDuration int64, revealThreshold int64)

Source from the content-addressed store, hash-verified

459}
460
461func (e *ethAdaptor) StartCommitReveal(startBlock int64, commitDuration int64, revealDuration int64, revealThreshold int64) (err error) {
462 if !e.isConnecting() {
463 err = errors.New("not connecting to geth")
464 return
465 }
466
467 // define how to parse parameters and execute proxy function
468 opCtx, opCancel := context.WithTimeout(e.ctx, e.setTimeout)
469 defer opCancel()
470 crs := e.crs
471
472 f := func(ctx context.Context) (tx *types.Transaction, err error) {
473 idx := getIndex(ctx)
474 if idx == -1 {
475 err = errors.New("no client index in context")
476 } else {
477 tx, err = crs[idx].StartCommitReveal(big.NewInt(startBlock), big.NewInt(commitDuration), big.NewInt(revealDuration), big.NewInt(revealThreshold))
478 if err != nil {
479 err = &OnchainError{err: errors.Errorf(": %w", err), Idx: idx}
480 } else {
481 e.logger.Info(fmt.Sprintf("StartCommitReveal %x", tx.Hash()))
482 }
483 }
484 if err != nil {
485 e.logger.Error(err)
486 }
487 return
488 }
489 return e.waitForReply(&request{opCtx: opCtx, f: f, reply: make(chan *response)})
490}
491
492func (e *ethAdaptor) Commit(cid *big.Int, commitment [32]byte) (err error) {
493 if !e.isConnecting() {

Callers

nothing calls this directly

Calls 8

isConnectingMethod · 0.95
waitForReplyMethod · 0.95
getIndexFunction · 0.85
NewMethod · 0.65
StartCommitRevealMethod · 0.65
InfoMethod · 0.65
ErrorMethod · 0.65
HashMethod · 0.45

Tested by

no test coverage detected