@@ -23,6 +23,7 @@ import (
2323 "github.com/lightninglabs/taproot-assets/tapgarden"
2424 "github.com/lightninglabs/taproot-assets/tapscript"
2525 "github.com/lightninglabs/taproot-assets/universe"
26+ "github.com/lightninglabs/taproot-assets/universe/supplycommit"
2627 "github.com/lightningnetwork/lnd"
2728 "github.com/lightningnetwork/lnd/clock"
2829 "github.com/lightningnetwork/lnd/signal"
@@ -161,6 +162,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
161162 groupVerifier := tapgarden .GenGroupVerifier (
162163 context .Background (), assetMintingStore ,
163164 )
165+
164166 uniArchiveCfg := universe.ArchiveConfig {
165167 // nolint: lll
166168 NewBaseTree : func (id universe.Identifier ) universe.StorageBackend {
@@ -583,6 +585,38 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
583585 "access status: %w" , err )
584586 }
585587
588+ // Construct the supply commit manager, which is used to
589+ // formulate universe supply commitment transactions.
590+ //
591+ // Construct database backends for the supply commitment state machines.
592+ supplyCommitDb := tapdb .NewTransactionExecutor (
593+ db , func (tx * sql.Tx ) tapdb.SupplyCommitStore {
594+ return db .WithTx (tx )
595+ },
596+ )
597+ supplyCommitStore := tapdb .NewSupplyCommitMachine (supplyCommitDb )
598+
599+ // Construct the supply tree database backend.
600+ supplyTreeDb := tapdb .NewTransactionExecutor (
601+ db , func (tx * sql.Tx ) tapdb.BaseUniverseStore {
602+ return db .WithTx (tx )
603+ },
604+ )
605+ supplyTreeStore := tapdb .NewSupplyTreeStore (supplyTreeDb )
606+
607+ // Create the supply commitment state machine manager, which is used to
608+ // manage the supply commitment state machines for each asset group.
609+ supplyCommitManager := supplycommit .NewMultiStateMachineManager (
610+ supplycommit.MultiStateMachineManagerCfg {
611+ TreeView : supplyTreeStore ,
612+ Commitments : supplyCommitStore ,
613+ Wallet : walletAnchor ,
614+ KeyRing : keyRing ,
615+ Chain : chainBridge ,
616+ StateLog : supplyCommitStore ,
617+ },
618+ )
619+
586620 return & tap.Config {
587621 DebugLevel : cfg .DebugLevel ,
588622 RuntimeID : runtimeID ,
@@ -633,6 +667,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
633667 AssetWallet : assetWallet ,
634668 CoinSelect : coinSelect ,
635669 ChainPorter : chainPorter ,
670+ SupplyCommitManager : supplyCommitManager ,
636671 UniverseArchive : uniArchive ,
637672 UniverseSyncer : universeSyncer ,
638673 UniverseFederation : universeFederation ,
0 commit comments