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
fprintf(stderr, "If executed with no arguments, an empty script and empty stack is provided\n");
112
133
fprintf(stderr, "If executed with a --dataset, the --txin and --tx values are prepopulated with values from the given dataset; though this may be overridden using subsequent --tx/--txin= statements. To see available datasets, type %s --dataset or %s -X\n", argv[0], argv[0]);
113
134
fprintf(stderr, "To debug transaction signatures, you need to either provide the transaction hex (the WHOLE hex, not just the txid) "
@@ -117,12 +138,13 @@ int main(int argc, char* const* argv)
117
138
fprintf(stderr, "By providing a txin as well as a tx and no script or stack, btcdeb will attempt to set up a debug session for the verification of the given input by pulling the appropriate values out of the respective transactions. you do not need amounts for --tx in this case\n");
118
139
fprintf(stderr, "You can modify verification flags using the --modify-flags command. separate flags using comma (,). prefix with + to enable, - to disable. e.g. --modify-flags=\"-NULLDUMMY,-MINIMALIF\"\n");
119
140
fprintf(stderr, "You can set the environment variables DEBUG_SIGHASH, DEBUG_SIGNING, and DEBUG_SEGWIT to increase verbosity for the respective areas.\n");
120
-
printf("The standard (enabled by default) flags can be reviewed by typing %s --default-flags or %s -d", argv[0], argv[0]);
141
+
fprintf(stderr, "The standard (enabled by default) flags can be reviewed by typing %s --default-flags or %s -d", argv[0], argv[0]);
142
+
fprintf(stderr, "The --verbose flag will turn btcdeb into a helpful hintful chatter-box in various situations.\n");
121
143
return0;
122
144
} elseif (ca.m.count('d')) {
123
145
printf("The standard (enabled by default) flags are:\n・ %s\n", svf_string(STANDARD_SCRIPT_VERIFY_FLAGS, "\n・ ").c_str());
124
146
return0;
125
-
} elseif (ca.m.count('v')) {
147
+
} elseif (ca.m.count('V')) {
126
148
printf("btcdeb (\"The Bitcoin Script Debugger\") version %d.%d.%d\n", CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION);
127
149
return0;
128
150
} elseif (ca.m.count('X')) {
@@ -137,32 +159,35 @@ int main(int argc, char* const* argv)
137
159
// populate --tx from dataset
138
160
std::string data = string_from_file(std::string("doc/txs/") + dataset + "-tx");
139
161
ca.m['x'] = data;
140
-
btc_logf("loaded spending transaction from dataset %s\n", dataset.c_str());
162
+
if (verbose) printf("loaded spending (output) transaction from dataset %s\n", dataset.c_str());
141
163
}
142
164
if (!ca.m.count('i')) {
143
165
// populate --txin from dataset
144
166
std::string data = string_from_file(std::string("doc/txs/") + dataset + "-in");
145
167
ca.m['i'] = data;
146
-
btc_logf("loaded spending transaction from dataset %s\n", dataset.c_str());
168
+
if (verbose) printf("loaded funding (input) transaction from dataset %s\n", dataset.c_str());
147
169
}
148
170
} catch (const std::runtime_error& err) {
149
171
fprintf(stderr, "error loading from dataset \"%s\": %s\n", dataset.c_str(), err.what());
150
172
return1;
151
173
}
152
174
} elseif (!quiet) {
153
-
btc_logf("btcdeb %d.%d.%d -- type `%s -h` for start up options\n", CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, argv[0]);
175
+
printf("btcdeb %d.%d.%d -- type `%s -h` for start up options\n", CLIENT_VERSION_MAJOR, CLIENT_VERSION_MINOR, CLIENT_VERSION_REVISION, argv[0]);
154
176
}
155
177
156
178
if (!pipe_in) {
157
-
if (std::getenv("DEBUG_SIGHASH")) btc_sighash_logf = btc_logf_stderr;
158
-
if (std::getenv("DEBUG_SIGNING")) btc_sign_logf = btc_logf_stderr;
159
-
if (std::getenv("DEBUG_SEGWIT")) btc_segwit_logf = btc_logf_stderr;
179
+
std::set<std::string> debug_set;
180
+
setup_debug_set(ca.m['D'], debug_set);
181
+
if (get_debug_flag("sighash", debug_set)) btc_sighash_logf = btc_logf_stderr;
182
+
if (get_debug_flag("signing", debug_set)) btc_sign_logf = btc_logf_stderr;
183
+
if (get_debug_flag("segwit", debug_set)) btc_segwit_logf = btc_logf_stderr;
184
+
btc_logf("notice: btcdeb has gotten quieter; use --verbose if necessary (this message is temporary)\n");
@@ -212,7 +237,7 @@ int main(int argc, char* const* argv)
212
237
CScript script;
213
238
if (script_str) {
214
239
if (instance.parse_script(script_str)) {
215
-
if (!quiet) btc_logf("valid script\n");
240
+
if (verbose) btc_logf("valid script\n");
216
241
} else {
217
242
fprintf(stderr, "invalid script\n");
218
243
return1;
@@ -289,6 +314,14 @@ int main(int argc, char* const* argv)
289
314
}
290
315
}
291
316
317
+
if (instance.has_preamble) {
318
+
if (verbose) btc_logf(
319
+
"*** note: there is a for-clarity preamble\n\n"
320
+
321
+
"This is a virtual script that btcdeb generates and presents to you so you can step through the validation process one step at a time. The input is simply the redeem script hash, whereas btcdeb presents it as a OP_DUP, OP_HASH160, <that hash>, OP_EQUALVERIFY script.\n"
322
+
); elseif (!quiet) btc_logf("note: there is a for-clarity preamble (use --verbose for details)\n");
if ((flags & SCRIPT_VERIFY_NULLDUMMY) && stacktop(-1).size()) {
1118
-
printf("\n* * * * * * *\n\nHint: with Segwit activation, the OP_CHECKMULTISIG extra argument must be set to the empty push value (0x). If you are experimenting with older scripts, you may run into a 'Dummy CHECKMULTISIG argument must be zero' error. To move past this, you need to modify the verification flags, disabling the NULLDUMMY flag specifically. I.e. call btcdeb again with -f\"-NULLDUMMY\"\n\n* * * * * * *\n\n");
1118
+
if (btcdeb_verbose) printf(
1119
+
"\n* * * * * * *\n\n"
1120
+
1121
+
"Hint: with Segwit activation, the OP_CHECKMULTISIG extra argument must be set to the empty push value (0x). If you are experimenting with older scripts, you may run into a 'Dummy CHECKMULTISIG argument must be zero' error. To move past this, you need to modify the verification flags, disabling the NULLDUMMY flag specifically. I.e. call btcdeb again with -f\"-NULLDUMMY\"\n\n"
1122
+
1123
+
"* * * * * * *\n\n"
1124
+
); elseprintf("Hint: with Segwit activation, the OP_CHECKMULTISIG extra argument must be empty (--verbose for details)\n");
0 commit comments