File tree Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Expand file tree Collapse file tree 2 files changed +9
-6
lines changed Original file line number Diff line number Diff line change @@ -244,11 +244,12 @@ pub(super) fn from_txdata<'txin>(
244
244
Ok ( (
245
245
Inner :: Script ( ms, ScriptType :: Tr ) ,
246
246
wit_stack,
247
- // Tr script spend code is stored in script spend. This is an internal hack to store the
248
- // encoded script instead yet another tagged enum for saving tap_script
249
- // We can recompute the script again by translating from nochecks to tap and re-encoding it
250
- // Having this hack seems simple because this is not exposed publicly and the internal code is
251
- // easy to audit
247
+ // Tapscript is returned as a "scriptcode". This is a hack, but avoids adding yet
248
+ // another enum just for taproot, and this function is not a publicly exposed API,
249
+ // so it's easy enough to keep track of all uses.
250
+ //
251
+ // In particular, this return value will be put into the `script_code` member of
252
+ // the `Interpreter` script; the iterpreter logic does the right thing with it.
252
253
Some ( tap_script) ,
253
254
) )
254
255
} else {
Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ use self::stack::Stack;
46
46
pub struct Interpreter < ' txin > {
47
47
inner : inner:: Inner ,
48
48
stack : Stack < ' txin > ,
49
- script_code : Option < bitcoin:: Script > , // taproot transactions don't have script code
49
+ /// For non-Taproot spends, the scriptCode; for Taproot script-spends, this
50
+ /// is the leaf script; for key-spends it is `None`.
51
+ script_code : Option < bitcoin:: Script > ,
50
52
age : u32 ,
51
53
height : u32 ,
52
54
}
You can’t perform that action at this time.
0 commit comments