Skip to content

Commit

Permalink
universe: add new MultiverseLeafDesc and MultiverseLeaf types
Browse files Browse the repository at this point in the history
These will be used in the database to modify the existing
FetchMultiverseLeaves call to use a single DB query.
  • Loading branch information
Roasbeef authored and guggero committed Dec 4, 2023
1 parent 0785550 commit 7eb48d7
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions universe/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/btcsuite/btcd/btcec/v2/schnorr"
"github.com/btcsuite/btcd/wire"
"github.com/lightninglabs/taproot-assets/asset"
"github.com/lightninglabs/taproot-assets/fn"
"github.com/lightninglabs/taproot-assets/mssmt"
"github.com/lightninglabs/taproot-assets/proof"
)
Expand Down Expand Up @@ -284,6 +285,11 @@ type Root struct {
GroupedAssets map[asset.ID]uint64
}

// MultiverseLeafDesc can be used to uniquely identify a Multiverse leave
// (which is a Universe root). A leaf for a given Universe tree (proof type
// assumed) can be identified by either the asset ID or the target group key.
type MultiverseLeafDesc = fn.Either[asset.ID, btcec.PublicKey]

// MultiverseRoot is the ms-smt root for a multiverse. This root can be used to
// authenticate any leaf proofs.
type MultiverseRoot struct {
Expand All @@ -294,6 +300,16 @@ type MultiverseRoot struct {
mssmt.Node
}

// MultiverseLeaf is the leaf within a Multiverse, this stores a value which is
// derived from the root of a normal Universe tree.
type MultiverseLeaf struct {
// ID contains the information to uniquely identify the multiverse
// root: assetID/groupKey and the proof type.
ID Identifier

*mssmt.LeafNode
}

// MultiverseArchive is an interface used to keep track of the set of universe
// roots that we know of. The BaseBackend interface is used to interact with a
// particular base universe, while this is used to obtain aggregate information
Expand Down

0 comments on commit 7eb48d7

Please sign in to comment.