File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -480,6 +480,21 @@ trait SigmaProp {
480480 * 2. new ErgoTree created with with ErgoTree.DefaultHeader, EmptyConstant and SigmaPropConstant as the root
481481 *
482482 * Thus obtained ErgoTree is serialized using DefaultSerializer and compared with `box.propositionBytes`.
483+ * Here, propBytes uses very specific ErgoTree with header == 0, and hence ErgoTree.version == 0.
484+ * However, `box.propositionBytes`, contain bytes of ErgoTree from `box`, and version of that
485+ * tree depends on how the `box` was created.
486+ * A better way to compare `box.propositionBytes` and `prop.propBytes` is to use the following code:
487+ * ```
488+ * val propBytes = prop.propBytes
489+ * val treeBytes = box.propositionBytes
490+ * if (treeBytes(0) == 0) {
491+ * treeBytes == propBytes
492+ * } else {
493+ * // offset = 1 + <number of VLQ encoded bytes to store propositionBytes.size>
494+ * val offset = if (propositionBytes.size > 127) 3 else 2
495+ * propBytes.slice(1, propBytes.size) == propositionBytes.slice(offset, propositionBytes.size)
496+ * }
497+ * ```
483498 */
484499 def propBytes : Coll [Byte ]
485500
You can’t perform that action at this time.
0 commit comments