You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
error code: -26
error message:
mandatory-script-verify-flag-failed (Script evaluated without error but finished with a false/empty top stack element) (code 16)
func Sign(tx *wire.MsgTx, privKey string, pkScripts [][]byte) error {
wif, err := btcutil.DecodeWIF(privKey)
if err != nil {
return err
}
for i, txin := range tx.TxIn {
script, err := txscript.SignatureScript(tx, i, pkScripts[i], txscript.SigHashAll, wif.PrivKey, false)
if err != nil {
return err
}
txin.SignatureScript = script
vm, err := txscript.NewEngine(pkScripts[i], tx, i,
txscript.StandardVerifyFlags, nil, nil, -1)
if err != nil {
return err
}
err = vm.Execute()
if err != nil {
return err
}
}
return nil
}
SignatureScript is ok
log.Tracef("%v", newLogClosure(func() string {
dis0, _ := vm.DisasmScript(0)
dis1, _ := vm.DisasmScript(1)
return fmt.Sprintf("scripts failed: script0: %s\n"+
"script1: %s", dis0, dis1)
}))
vm.Execute() err = return scriptError(ErrEvalFalse,
"false stack entry at end of script execution")
why???
The text was updated successfully, but these errors were encountered: