remove Witness from Source WitnessV0PubKeyHash

Viewed 13

I'm trying to convert a script that is build on btcutil and wire with Witness (Segwit) to without Witness. Mine blockchain doesn't support Segwit. Now the most part is already done just stuck in the last part.

Can someone help me out to get this convert without witness

switch class {
        case txscript.WitnessV0PubKeyHashTy:
            tx.TxIn[i].Witness = wire.TxWitness{fullsig, pkData}
        default:
            return nil, wrapErr(
                ErrUnsupportedScriptType,
                fmt.Errorf("unupported script type: %s", class),
            )
        }

Now i made this to

switch class {
        case txscript.WitnessV0PubKeyHashTy:
            tx.TxIn[i].Witness = wire.TxWitness{fullsig, pkData}
        case txscript.PubKeyHashTy:
            tx.TxIn[i].Witness = wire.TxWitness{fullsig, pkData}
        default:
            return nil, wrapErr(
                ErrUnsupportedScriptType,
                fmt.Errorf("unupported script type: %s", class),
            )
        }

I can't find a way to get this line to convert:

tx.TxIn[i].Witness = wire.TxWitness{fullsig, pkData}
0 Answers
Related