Skip to content

Commit 886aba2

Browse files
committed
supplycommit: add ChainParams to supply commit state machine env
This allows derivation of PSBT BIP32 paths for a keychain.KeyDescriptor using network-specific parameters. The new field is unread in this commit but will be used later.
1 parent f4f9de7 commit 886aba2

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

tapcfg/server.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -614,6 +614,7 @@ func genServerConfig(cfg *Config, cfgLogger btclog.Logger,
614614
KeyRing: keyRing,
615615
Chain: chainBridge,
616616
StateLog: supplyCommitStore,
617+
ChainParams: *tapChainParams.Params,
617618
},
618619
)
619620

universe/supplycommit/env.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import (
88
"github.com/btcsuite/btcd/btcec/v2"
99
"github.com/btcsuite/btcd/btcutil"
1010
"github.com/btcsuite/btcd/btcutil/psbt"
11+
"github.com/btcsuite/btcd/chaincfg"
1112
"github.com/btcsuite/btcd/txscript"
1213
"github.com/btcsuite/btcd/wire"
1314
"github.com/lightninglabs/taproot-assets/asset"
@@ -407,6 +408,10 @@ type Environment struct {
407408
// CommitConfTarget is the confirmation target used when crafting the
408409
// commitment transaction.
409410
CommitConfTarget uint32
411+
412+
// ChainParams is the chain parameters for the chain that we're
413+
// operating on.
414+
ChainParams chaincfg.Params
410415
}
411416

412417
// SupplyCommitTxn encapsulates the details of the transaction that creates a

universe/supplycommit/multi_sm_manager.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import (
77
"time"
88

99
"github.com/btcsuite/btcd/btcec/v2"
10+
"github.com/btcsuite/btcd/chaincfg"
1011
"github.com/lightninglabs/taproot-assets/asset"
1112
"github.com/lightninglabs/taproot-assets/fn"
1213
"github.com/lightninglabs/taproot-assets/mssmt"
@@ -48,6 +49,10 @@ type MultiStateMachineManagerCfg struct {
4849
// state machine. This is used to persist the state of the state machine
4950
// across restarts.
5051
StateLog StateMachineStore
52+
53+
// ChainParams is the chain parameters for the chain that we're
54+
// operating on.
55+
ChainParams chaincfg.Params
5156
}
5257

5358
// MultiStateMachineManager is a manager for multiple supply commitment state
@@ -136,6 +141,7 @@ func (m *MultiStateMachineManager) fetchStateMachine(
136141
Chain: m.cfg.Chain,
137142
StateLog: m.cfg.StateLog,
138143
CommitConfTarget: DefaultCommitConfTarget,
144+
ChainParams: m.cfg.ChainParams,
139145
}
140146

141147
// TODO(ffranr): Get initial state from disk here.

0 commit comments

Comments
 (0)