-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
txscript/engine: add execution StepCallback #1980
Conversation
Pull Request Test Coverage Report for Build 5785035301
💛 - Coveralls |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super useful! I do something like this at times locally to be able to print out debug information to introspect into a stack when tests fail.
Rebased and addressed comments. PTAL @Roasbeef @kcalvinalvin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK 3033ba3
Rebased. PTAL @Roasbeef |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looking pretty good, left some final comments. I think we should also add a basic test for txscript.NewDebugEngine
as protection against regressions here. Can be a simple P2PKH spend or something like that.
363479f
to
552cb80
Compare
We add a new stepCallback as optional function closure on the Engine that will be called every time a step has been performed during script execution. It is accessed by calling the NewDebugEngine constructor. This is only meant to be used in debugging.
Add a simple test that make sure the stack and alt stack is correctly set in the callback from script execution.
552cb80
to
5c5bef0
Compare
Rabased. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 🎿
|
||
// TestDebugEngine checks that the StepCallbck called during debug script | ||
// execution contains the expected data. | ||
func TestDebugEngine(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
We add a new StepCallback as optional function closure on the Engine that will be called every time a step has been performed during script execution.
This is only meant to be used in debugging.
More specifically, this is used for Tapsim: https://github.com/halseth/tapsim