Skip to content

Commit 0fd548f

Browse files
committed
tapcfg: use higher re-org safe depth value for testnet
Fixes #1007 by using a higher value for testnet, if the user doesn't supply their own custom number.
1 parent fca9d11 commit 0fd548f

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

tapcfg/config.go

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,11 @@ const (
111111
// wait for before considering a transaction safely buried in the chain.
112112
defaultReOrgSafeDepth = 6
113113

114+
// testnetDefaultReOrgSafeDepth is the default number of confirmations
115+
// we'll wait before considering a transaction safely buried in the
116+
// testnet chain.
117+
testnetDefaultReOrgSafeDepth = 120
118+
114119
// defaultUniverseMaxQps is the default maximum number of queries per
115120
// second for the universe server. This permis 100 queries per second
116121
// by default.
@@ -275,7 +280,7 @@ type UniverseConfig struct {
275280
UniverseQueriesBurst int `long:"req-burst-budget" description:"The burst budget for the universe query rate limiting."`
276281
}
277282

278-
// AddressConfig is the config that houses any address Book related config
283+
// AddrBookConfig is the config that houses any address Book related config
279284
// values.
280285
type AddrBookConfig struct {
281286
DisableSyncer bool `long:"disable-syncer" description:"If true, tapd will not try to sync issuance proofs for unknown assets when creating an address."`
@@ -840,6 +845,14 @@ func ValidateConfig(cfg Config, cfgLogger btclog.Logger) (*Config, error) {
840845
"config: %w", err)
841846
}
842847

848+
// Use a way higher re-org safe depth value for testnet (if the user
849+
// didn't specify a custom value).
850+
if cfg.ActiveNetParams.Net == chaincfg.TestNet3Params.Net &&
851+
cfg.ReOrgSafeDepth == defaultReOrgSafeDepth {
852+
853+
cfg.ReOrgSafeDepth = testnetDefaultReOrgSafeDepth
854+
}
855+
843856
// All good, return the sanitized result.
844857
return &cfg, nil
845858
}

0 commit comments

Comments
 (0)