Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sign error #1430

Open
200787128 opened this issue May 30, 2019 · 1 comment
Open

Sign error #1430

200787128 opened this issue May 30, 2019 · 1 comment

Comments

@200787128
Copy link

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???

@200787128
Copy link
Author

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)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant