Skip to content

Commit 405073e

Browse files
committed
supplycommit: add DefaultCommitConfTarget constant
Introduces `DefaultCommitConfTarget`, a constant for the default confirmation target (in blocks) for a supply commitment transaction. This constant provides a sensible default for fee estimation, ensuring that the commitment transaction is confirmed in a timely manner without overpaying. Centralizing this value makes it easier to manage and adjust in the future. If we don't set `CommitConfTarget` field in state machine env to a reasonable value fee estimation will fail.
1 parent 3d79355 commit 405073e

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

universe/supplycommit/env.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,12 @@ import (
2020
"github.com/lightningnetwork/lnd/lnwallet/chainfee"
2121
)
2222

23+
const (
24+
// DefaultCommitConfTarget is the default confirmation target used when
25+
// crafting the commitment transaction. This is used in fee estimation.
26+
DefaultCommitConfTarget = 6
27+
)
28+
2329
// SupplySubTree is an enum that represents the different types of supply sub
2430
// trees within the main supply tree. The sub trees are used to track how the
2531
// supply shifts in response to: mints, burns, and ignores.

universe/supplycommit/state_machine_test.go

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,13 +142,14 @@ func newSupplyCommitTestHarness(t *testing.T,
142142
mockErrReporter := &mockErrorReporter{}
143143

144144
env := &Environment{
145-
AssetSpec: cfg.assetSpec,
146-
TreeView: mockTreeView,
147-
Commitments: mockCommits,
148-
Wallet: mockWallet,
149-
KeyRing: mockKey,
150-
Chain: mockChain,
151-
StateLog: mockStateLog,
145+
AssetSpec: cfg.assetSpec,
146+
TreeView: mockTreeView,
147+
Commitments: mockCommits,
148+
Wallet: mockWallet,
149+
KeyRing: mockKey,
150+
Chain: mockChain,
151+
StateLog: mockStateLog,
152+
CommitConfTarget: DefaultCommitConfTarget,
152153
}
153154

154155
fsmCfg := Config{

0 commit comments

Comments
 (0)