(cid *big.Int, commitment [32]byte)
| 490 | } |
| 491 | |
| 492 | func (e *ethAdaptor) Commit(cid *big.Int, commitment [32]byte) (err error) { |
| 493 | if !e.isConnecting() { |
| 494 | err = errors.New("not connecting to geth") |
| 495 | return |
| 496 | } |
| 497 | |
| 498 | // define how to parse parameters and execute proxy function |
| 499 | opCtx, opCancel := context.WithTimeout(e.ctx, e.setTimeout) |
| 500 | defer opCancel() |
| 501 | crs := e.crs |
| 502 | |
| 503 | f := func(ctx context.Context) (tx *types.Transaction, err error) { |
| 504 | idx := getIndex(ctx) |
| 505 | if idx == -1 { |
| 506 | err = errors.New("no client index in context") |
| 507 | } else { |
| 508 | tx, err = crs[idx].Commit(cid, commitment) |
| 509 | if err != nil { |
| 510 | err = &OnchainError{err: errors.Errorf(": %w", err), Idx: idx} |
| 511 | } else { |
| 512 | e.logger.Info(fmt.Sprintf("Commit %x", tx.Hash())) |
| 513 | } |
| 514 | } |
| 515 | if err != nil { |
| 516 | e.logger.Error(err) |
| 517 | } |
| 518 | return |
| 519 | } |
| 520 | return e.waitForReply(&request{opCtx: opCtx, f: f, reply: make(chan *response)}) |
| 521 | } |
| 522 | |
| 523 | func (e *ethAdaptor) Reveal(cid *big.Int, secret *big.Int) (err error) { |
| 524 | if !e.isConnecting() { |
nothing calls this directly
no test coverage detected