Trying to spend UTXO with P2SH

I have a more complex script however i noticed that it returns false. Therefore, I tried the simplest signature check and it returns false as well. This is the locking script:

my_public_key = my_private_key.pub
redeem_script = CScript([my_public_key,OP_CHECKSIG])

txout_scriptPubKey = [OP_HASH160, Hash160(redeem_script), OP_EQUAL]

This is the unlocking script:

my_sig = create_OP_CHECKSIG_signature(tx, CScript(txin_scriptPubKey), my_private_key)
txin.scriptSig = CScript([my_sig,redeem_script])

It returns: VerifyScriptError: P2SH inner scriptPubKey returned false.

I don't get what's happening, it works for non signature type custom scripts. Any help is appreciated.



from Recent Questions - Bitcoin Stack Exchange https://ift.tt/Ebz8iC7
via IFTTT

Popular posts from this blog

Bitcoin Mining Could Be Strengthening The Ruble, Russian Central Bank Says

Crypto Exec Warns Tokenization Is Moving Faster Than Expected

Bitwise Clients Pour $69M Into Solana as Bulls Fight to Reclaim $200 Resistance Zone