File tree Expand file tree Collapse file tree 1 file changed +6
-6
lines changed
Expand file tree Collapse file tree 1 file changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -41,17 +41,17 @@ namespace chain {
4141
4242// static
4343// Zero-based opcode position of the last executed op_codeseparator before
44- // currently executed signature opcode (0xffffffff if none) [bip342].
44+ // currently executed signature opcode (0xffffffff if none) [bip342]. Previous
45+ // versions require the next opcode, but this requires the position. Since the
46+ // op_codeseparator implementation sets offset to next, it must be decremented.
4547uint32_t transaction::subscript_v1 (const script& script) NOEXCEPT
4648{
4749 if (script.ops ().empty ())
4850 return chain::default_separators;
4951
50- const auto start = script.ops ().begin ();
51- const auto span = std::distance (start, script.offset );
52- const auto slot = possible_narrow_and_sign_cast<uint32_t >(span);
53- const auto none = is_zero (slot) && start->code () != opcode::codeseparator;
54- return none ? chain::default_separators : slot;
52+ const auto next = std::distance (script.ops ().begin (), script.offset );
53+ return is_zero (next) ? chain::default_separators :
54+ possible_narrow_and_sign_cast<uint32_t >(sub1 (next));
5555}
5656
5757// ext_flags and annex flag are combined into one byte, who knows why.
You can’t perform that action at this time.
0 commit comments