(startBlock int64, commitDuration int64, revealDuration int64, revealThreshold int64)
| 459 | } |
| 460 | |
| 461 | func (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 | |
| 492 | func (e *ethAdaptor) Commit(cid *big.Int, commitment [32]byte) (err error) { |
| 493 | if !e.isConnecting() { |
nothing calls this directly
no test coverage detected