Skip to content

Commit de3db34

Browse files
Roasbeefguggero
authored andcommitted
universe: add new MultiverseLeafDesc and MultiverseLeaf types
These will be used in the database to modify the existing FetchMultiverseLeaves call to use a single DB query.
1 parent 716053b commit de3db34

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

universe/interface.go

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/btcsuite/btcd/btcec/v2/schnorr"
1414
"github.com/btcsuite/btcd/wire"
1515
"github.com/lightninglabs/taproot-assets/asset"
16+
"github.com/lightninglabs/taproot-assets/fn"
1617
"github.com/lightninglabs/taproot-assets/mssmt"
1718
"github.com/lightninglabs/taproot-assets/proof"
1819
)
@@ -364,6 +365,11 @@ type Root struct {
364365
GroupedAssets map[asset.ID]uint64
365366
}
366367

368+
// MultiverseLeafDesc can be used to uniquely identify a Multiverse leave
369+
// (which is a Universe root). A leaf for a given Universe tree (proof type
370+
// assumed) can be identified by either the asset ID or the target group key.
371+
type MultiverseLeafDesc = fn.Either[asset.ID, btcec.PublicKey]
372+
367373
// MultiverseRoot is the ms-smt root for a multiverse. This root can be used to
368374
// authenticate any leaf proofs.
369375
type MultiverseRoot struct {
@@ -374,6 +380,16 @@ type MultiverseRoot struct {
374380
mssmt.Node
375381
}
376382

383+
// MultiverseLeaf is the leaf within a Multiverse, this stores a value which is
384+
// derived from the root of a normal Universe tree.
385+
type MultiverseLeaf struct {
386+
// ID contains the information to uniquely identify the multiverse
387+
// root: assetID/groupKey and the proof type.
388+
ID Identifier
389+
390+
*mssmt.LeafNode
391+
}
392+
377393
// MultiverseArchive is an interface used to keep track of the set of universe
378394
// roots that we know of. The BaseBackend interface is used to interact with a
379395
// particular base universe, while this is used to obtain aggregate information

0 commit comments

Comments
 (0)