Skip to content

Commit

Permalink
fix: return error when upload to ipfs fails (#350)
Browse files Browse the repository at this point in the history
Signed-off-by: tcar <[email protected]>
  • Loading branch information
tcar121293 authored Aug 21, 2024
1 parent ff55000 commit 8aff649
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 3 additions & 1 deletion chains/btc/executor/executor.go
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ func (e *Executor) executeResourceProps(props []*BtcTransferProposal, resource c
// we need to sign each input individually
tssProcesses := make([]tss.TssProcess, len(tx.TxIn))
for i := range tx.TxIn {
sessionID := fmt.Sprintf("%s-%d", sessionID, i)
signingHash, err := txscript.CalcTaprootSignatureHash(sigHashes, txscript.SigHashDefault, tx, i, prevOutputFetcher)
sessionID := hex.EncodeToString(signingHash)
if err != nil {
return err
}
Expand Down Expand Up @@ -304,13 +304,15 @@ func (e *Executor) outputs(tx *wire.MsgTx, proposals []*BtcTransferProposal) (ui
cid, err := e.uploader.Upload(dataToUpload)
if err != nil {
log.Error().Err(err).Msg("Error occured while uploading metadata to ipfs")
return 0, err
}

// Store the CID in OP_RETURN
opReturnData := []byte("syg_" + cid)
opReturnScript, err := txscript.NullDataScript(opReturnData)
if err != nil {
log.Error().Err(err).Msg("Error occured while constructiong OP_RETURN data")
return 0, err
}

opReturnOut := wire.NewTxOut(0, opReturnScript)
Expand Down
3 changes: 1 addition & 2 deletions tss/frost/signing/signing.go
Original file line number Diff line number Diff line change
Expand Up @@ -195,12 +195,11 @@ func (s *Signing) processEndMessage(ctx context.Context) error {
select {
case <-s.Done:
{
s.Log.Info().Msg("Successfully generated signature")

result, err := s.Handler.Result()
if err != nil {
return err
}
s.Log.Info().Msg("Successfully generated signature")
signature, _ := result.(taproot.Signature)

s.resultChn <- Signature{
Expand Down

0 comments on commit 8aff649

Please sign in to comment.