Skip to content

Commit f5d5b59

Browse files
committed
WIP: add supply verifier manager to main server config
1 parent f7ba10f commit f5d5b59

File tree

2 files changed

+33
-0
lines changed

2 files changed

+33
-0
lines changed

config.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/lightninglabs/taproot-assets/tapgarden"
2020
"github.com/lightninglabs/taproot-assets/universe"
2121
"github.com/lightninglabs/taproot-assets/universe/supplycommit"
22+
"github.com/lightninglabs/taproot-assets/universe/supplyverifier"
2223
"github.com/lightningnetwork/lnd"
2324
"github.com/lightningnetwork/lnd/build"
2425
"github.com/lightningnetwork/lnd/signal"
@@ -197,6 +198,11 @@ type Config struct {
197198
// attestations of the total supply of an asset.
198199
SupplyCommitManager *supplycommit.Manager
199200

201+
// SupplyVerifyManager is a service that is used to verify supply
202+
// commitments for assets. Supply commitments are issuer published
203+
// attestations of the total supply of an asset.
204+
SupplyVerifyManager *supplyverifier.Manager
205+
200206
UniverseArchive *universe.Archive
201207

202208
UniverseSyncer universe.Syncer

tapcfg/server.go

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import (
2525
"github.com/lightninglabs/taproot-assets/tapscript"
2626
"github.com/lightninglabs/taproot-assets/universe"
2727
"github.com/lightninglabs/taproot-assets/universe/supplycommit"
28+
"github.com/lightninglabs/taproot-assets/universe/supplyverifier"
2829
"github.com/lightningnetwork/lnd"
2930
"github.com/lightningnetwork/lnd/clock"
3031
"github.com/lightningnetwork/lnd/signal"
@@ -624,6 +625,31 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
624625
},
625626
)
626627

628+
// Set up the supply verifier, which validates supply commitment leaves
629+
// published by asset issuers.
630+
//
631+
// Initialize the database backend for the supply syncer.
632+
supplySyncerDb := tapdb.NewTransactionExecutor(
633+
db, func(tx *sql.Tx) tapdb.BaseUniverseStore {
634+
return db.WithTx(tx)
635+
},
636+
)
637+
supplySyncerStore := tapdb.NewSupplySyncerStore(supplySyncerDb)
638+
639+
// Create the supply syncer which is used by the supply verifier.
640+
supplySyncer := supplyverifier.NewSupplySyncer(
641+
tap.NewRpcSupplySync, supplySyncerStore,
642+
)
643+
644+
supplyVerifyManager := supplyverifier.NewManager(
645+
supplyverifier.ManagerCfg{
646+
Chain: chainBridge,
647+
//SupplyCommitView: supplyCommitStore,
648+
SupplySyncer: supplySyncer,
649+
DaemonAdapters: lndFsmDaemonAdapters,
650+
},
651+
)
652+
627653
return &tap.Config{
628654
DebugLevel: cfg.DebugLevel,
629655
RuntimeID: runtimeID,
@@ -678,6 +704,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
678704
ChainPorter: chainPorter,
679705
FsmDaemonAdapters: lndFsmDaemonAdapters,
680706
SupplyCommitManager: supplyCommitManager,
707+
SupplyVerifyManager: supplyVerifyManager,
681708
UniverseArchive: uniArchive,
682709
UniverseSyncer: universeSyncer,
683710
UniverseFederation: universeFederation,

0 commit comments

Comments
 (0)