Skip to content

Commit

Permalink
chore: added wait receipt for testing
Browse files Browse the repository at this point in the history
  • Loading branch information
Mikelle committed May 3, 2024
1 parent e418905 commit ccf759a
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions p2p/pkg/contracts/preconf/preconf.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,24 @@ func (p *preconfContract) StoreEncryptedCommitment(
return common.Hash{}, err
}

// todo: delete after testing
receipt, err := p.client.WaitForReceipt(ctx, txnHash)
if err != nil {
return common.Hash{}, err
}

p.logger.Info("preconf contract storeEncryptedCommitment successful", "txnHash", txnHash)
eventTopicHash := p.preconfABI.Events["EncryptedCommitmentStored"].ID

for _, log := range receipt.Logs {
if len(log.Topics) > 0 && log.Topics[0] == eventTopicHash {
commitmentIndex := log.Topics[1]
p.logger.Info("Encrypted commitment stored", "commitmentIndex", commitmentIndex.Hex())

return txnHash, nil
}
}

return txnHash, nil
}

Expand Down

0 comments on commit ccf759a

Please sign in to comment.