Closed liorwavebl closed 5 months ago
I'm trying to broadcast segwit transactions with two outputs. When I'm trying to broadcast it, I'm receiving this error: non-mandatory-script-verify-flag (Script failed an OP_EQUALVERIFY operation)
non-mandatory-script-verify-flag (Script failed an OP_EQUALVERIFY operation)
The signing is done via this code snippet:
redeemTx := wire.NewMsgTx(wire.TxVersion) prevOut := wire.NewOutPoint(utxoHash, 0) redeemTxIn := wire.NewTxIn(prevOut, nil, nil) redeemTx.AddTxIn(redeemTxIn) redeemTXOut0 := wire.NewTxOut(outputs[0].amount, destPkScript0) redeemTx.AddTxOut(redeemTXOut0) redeemTXOut1 := wire.NewTxOut(outputs[1].amount, destPkScript1) redeemTx.AddTxOut(redeemTXOut1) a := txscript.NewMultiPrevOutFetcher(map[wire.OutPoint]*wire.TxOut{ *utxo: {}, }) sigHashes := txscript.NewTxSigHashes(redeemTx, a) totalAmount := outputs[0].amount + outputs[1].amount sigScript, err := txscript.WitnessSignature(redeemTx, sigHashes, 0, totalAmount, destPkScript1, txscript.SigHashAll, wif.PrivKey, true)
I'm trying to broadcast segwit transactions with two outputs. When I'm trying to broadcast it, I'm receiving this error:
non-mandatory-script-verify-flag (Script failed an OP_EQUALVERIFY operation)
The signing is done via this code snippet: