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

Method Commit

onchain/eth_set.go:492–521  ·  view source on GitHub ↗
(cid *big.Int, commitment [32]byte)

Source from the content-addressed store, hash-verified

490}
491
492func (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
523func (e *ethAdaptor) Reveal(cid *big.Int, secret *big.Int) (err error) {
524 if !e.isConnecting() {

Callers

nothing calls this directly

Calls 8

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

Tested by

no test coverage detected