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>(
244244 Ok ( (
245245 Inner :: Script ( ms, ScriptType :: Tr ) ,
246246 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.
252253 Some ( tap_script) ,
253254 ) )
254255 } else {
Original file line number Diff line number Diff line change @@ -46,7 +46,9 @@ use self::stack::Stack;
4646pub struct Interpreter < ' txin > {
4747 inner : inner:: Inner ,
4848 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 > ,
5052 age : u32 ,
5153 height : u32 ,
5254}
You can’t perform that action at this time.
0 commit comments