Basic constructor macro for bip32-key-tree structures.
(make-bip32-key-tree [:root-key <root-key>] [:root-depth <root-depth>] [:root-index <root-index>] [:root-parent <root-parent>] [:index-tree <index-tree>])
This is the usual way to construct bip32-key-tree structures. It simply conses together a structure with the specified fields.
This macro generates a new bip32-key-tree structure from scratch. See also change-bip32-key-tree, which can "change" an existing structure, instead.
This is an ordinary
Macro:
(defmacro make-bip32-key-tree (&rest args) (std::make-aggregate 'bip32-key-tree args '((:root-key) (:root-depth) (:root-index) (:root-parent) (:index-tree)) 'make-bip32-key-tree nil))
Function:
(defun bip32-key-tree (root-key root-depth root-index root-parent index-tree) (declare (xargs :guard (and (bip32-ext-key-p root-key) (bytep root-depth) (ubyte32p root-index) (byte-listp root-parent) (bip32-index-treep index-tree)))) (declare (xargs :guard (and (bip32-valid-keys-p root-key index-tree) (bip32-valid-depths-p root-depth index-tree) (implies (equal root-depth 0) (equal root-index 0)) (equal (len root-parent) 4) (implies (equal root-depth 0) (equal root-parent (list 0 0 0 0)))))) (let ((__function__ 'bip32-key-tree)) (declare (ignorable __function__)) (b* ((root-key (mbe :logic (bip32-ext-key-fix root-key) :exec root-key)) (root-depth (mbe :logic (byte-fix root-depth) :exec root-depth)) (root-index (mbe :logic (ubyte32-fix root-index) :exec root-index)) (root-parent (mbe :logic (byte-list-fix root-parent) :exec root-parent)) (index-tree (mbe :logic (bip32-index-tree-fix index-tree) :exec index-tree))) (let ((root-index (mbe :logic (if (equal root-depth 0) 0 root-index) :exec root-index)) (root-parent (mbe :logic (if (or (equal root-depth 0) (not (equal (len root-parent) 4))) (list 0 0 0 0) root-parent) :exec root-parent)) (index-tree (mbe :logic (if (and (bip32-valid-keys-p root-key index-tree) (bip32-valid-depths-p root-depth index-tree)) index-tree (list nil)) :exec index-tree))) (list root-key root-depth root-index root-parent index-tree)))))