@@ -270,12 +270,8 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
270270
271271 </ div >
272272
273- < div class ="content "> < div class ='highlight '> < pre > < span class ="hljs-type "> uint64_t</ span > since = < span class ="hljs-number "> 0</ span > ;
274- < span class ="hljs-type "> bool</ span > has_since = < span class ="hljs-literal "> false</ span > ;
275- < span class ="hljs-keyword "> if</ span > (args_bytes_seg.size == BLAKE160_SIZE + < span class ="hljs-keyword "> sizeof</ span > (< span class ="hljs-type "> uint64_t</ span > )) {
276- since = *(< span class ="hljs-type "> uint64_t</ span > *)&args_bytes_seg.ptr[BLAKE160_SIZE];
277- has_since = < span class ="hljs-literal "> true</ span > ;
278- }</ pre > </ div > </ div >
273+ < div class ="content "> < div class ='highlight '> < pre > < span class ="hljs-keyword "> if</ span > (args_bytes_seg.size == BLAKE160_SIZE + < span class ="hljs-keyword "> sizeof</ span > (< span class ="hljs-type "> uint64_t</ span > )) {
274+ < span class ="hljs-type "> uint64_t</ span > since = *(< span class ="hljs-type "> uint64_t</ span > *)&args_bytes_seg.ptr[BLAKE160_SIZE];</ pre > </ div > </ div >
279275
280276 </ li >
281277
@@ -286,6 +282,25 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
286282 < div class ="sswrap ">
287283 < a class ="ss " href ="#section-11 "> §</ a >
288284 </ div >
285+ < p > Check lock period logic, we have prepared a handy utility function for this.</ p >
286+
287+ </ div >
288+
289+ < div class ="content "> < div class ='highlight '> < pre > ret = check_since(since);
290+ < span class ="hljs-keyword "> if</ span > (ret != CKB_SUCCESS) {
291+ < span class ="hljs-keyword "> return</ span > ret;
292+ }
293+ }</ pre > </ div > </ div >
294+
295+ </ li >
296+
297+
298+ < li id ="section-12 ">
299+ < div class ="annotation ">
300+
301+ < div class ="sswrap ">
302+ < a class ="ss " href ="#section-12 "> §</ a >
303+ </ div >
289304 < p > Load the first witness, or the witness of the same index as the first input using
290305current script.</ p >
291306
@@ -304,11 +319,11 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
304319 </ li >
305320
306321
307- < li id ="section-12 ">
322+ < li id ="section-13 ">
308323 < div class ="annotation ">
309324
310325 < div class ="sswrap ">
311- < a class ="ss " href ="#section-12 "> §</ a >
326+ < a class ="ss " href ="#section-13 "> §</ a >
312327 </ div >
313328 < p > We will treat the first witness as WitnessArgs object, and extract the lock field
314329from the object.</ p >
@@ -328,11 +343,11 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
328343 </ li >
329344
330345
331- < li id ="section-13 ">
346+ < li id ="section-14 ">
332347 < div class ="annotation ">
333348
334349 < div class ="sswrap ">
335- < a class ="ss " href ="#section-13 "> §</ a >
350+ < a class ="ss " href ="#section-14 "> §</ a >
336351 </ div >
337352 < p > This is more of a safe guard, since lock is a field in witness, it
338353cannot exceed the maximum size of the enclosing witness, this way
@@ -348,11 +363,11 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
348363 </ li >
349364
350365
351- < li id ="section-14 ">
366+ < li id ="section-15 ">
352367 < div class ="annotation ">
353368
354369 < div class ="sswrap ">
355- < a class ="ss " href ="#section-14 "> §</ a >
370+ < a class ="ss " href ="#section-15 "> §</ a >
356371 </ div >
357372 < p > Keep the full lock field somewhere, since later we will modify this field in place.</ p >
358373
@@ -365,11 +380,11 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
365380 </ li >
366381
367382
368- < li id ="section-15 ">
383+ < li id ="section-16 ">
369384 < div class ="annotation ">
370385
371386 < div class ="sswrap ">
372- < a class ="ss " href ="#section-15 "> §</ a >
387+ < a class ="ss " href ="#section-16 "> §</ a >
373388 </ div >
374389 < p > Extract multisig script flags.</ p >
375390
@@ -398,11 +413,11 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
398413 </ li >
399414
400415
401- < li id ="section-16 ">
416+ < li id ="section-17 ">
402417 < div class ="annotation ">
403418
404419 < div class ="sswrap ">
405- < a class ="ss " href ="#section-16 "> §</ a >
420+ < a class ="ss " href ="#section-17 "> §</ a >
406421 </ div >
407422 < p > Based on the number of public keys and thresholds, we can calculate
408423the required length of the lock field.</ p >
@@ -419,11 +434,11 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
419434 </ li >
420435
421436
422- < li id ="section-17 ">
437+ < li id ="section-18 ">
423438 < div class ="annotation ">
424439
425440 < div class ="sswrap ">
426- < a class ="ss " href ="#section-17 "> §</ a >
441+ < a class ="ss " href ="#section-18 "> §</ a >
427442 </ div >
428443 < p > Perform hash check of the < code > multisig_script</ code > part, notice the signature part
429444is not included here.</ p >
@@ -437,27 +452,6 @@ <h1 id="secp256k1-blake160-multisig-all">secp256k1-blake160-multisig-all</h1>
437452
438453 < span class ="hljs-keyword "> if</ span > (< span class ="hljs-built_in "> memcmp</ span > (args_bytes_seg.ptr, temp, BLAKE160_SIZE) != < span class ="hljs-number "> 0</ span > ) {
439454 < span class ="hljs-keyword "> return</ span > ERROR_MULTSIG_SCRIPT_HASH;
440- }
441-
442- < span class ="hljs-keyword "> if</ span > (has_since) {</ pre > </ div > </ div >
443-
444- </ li >
445-
446-
447- < li id ="section-18 ">
448- < div class ="annotation ">
449-
450- < div class ="sswrap ">
451- < a class ="ss " href ="#section-18 "> §</ a >
452- </ div >
453- < p > Check lock period logic, we have prepared a handy utility function for this.</ p >
454-
455- </ div >
456-
457- < div class ="content "> < div class ='highlight '> < pre > ret = check_since(since);
458- < span class ="hljs-keyword "> if</ span > (ret != CKB_SUCCESS) {
459- < span class ="hljs-keyword "> return</ span > ret;
460- }
461455 }</ pre > </ div > </ div >
462456
463457 </ li >
0 commit comments