Skip to content

Commit dc7f1e8

Browse files
committed
config: remove SigNet and SimNet related code
1 parent be7892a commit dc7f1e8

File tree

9 files changed

+24
-157
lines changed

9 files changed

+24
-157
lines changed

chain/block_filterer_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -282,7 +282,7 @@ func TestBlockFiltererOneInOneOut(t *testing.T) {
282282
req := &chain.FilterBlocksRequest{
283283
WatchedOutPoints: watchedOutPoints,
284284
}
285-
blockFilterer := chain.NewBlockFilterer(&chaincfg.SimNetParams, req)
285+
blockFilterer := chain.NewBlockFilterer(&chaincfg.RegressionNetParams, req)
286286

287287
// Filter block 100000, which should find matches for the watched
288288
// outpoints.

config.go

Lines changed: 17 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
package main
66

77
import (
8-
"encoding/hex"
98
"fmt"
109
"net"
1110
"os"
@@ -17,7 +16,6 @@ import (
1716
"time"
1817

1918
flags "github.com/jessevdk/go-flags"
20-
"github.com/lbryio/lbcd/chaincfg"
2119
"github.com/lbryio/lbcd/version"
2220
btcutil "github.com/lbryio/lbcutil"
2321
"github.com/lbryio/lbcwallet/internal/cfgutil"
@@ -46,27 +44,23 @@ var (
4644

4745
type config struct {
4846
// General application behavior
49-
ConfigFile *cfgutil.ExplicitString `short:"C" long:"configfile" description:"Path to configuration file"`
50-
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
51-
Create bool `long:"create" description:"Create the wallet if it does not exist"`
52-
CreateTemp bool `long:"createtemp" description:"Create a temporary simulation wallet (pass=password) in the data directory indicated; must call with --datadir"`
53-
AppDataDir *cfgutil.ExplicitString `short:"A" long:"appdata" description:"Application data directory for wallet config, databases and logs"`
54-
TestNet3 bool `long:"testnet" description:"Use the test Bitcoin network (version 3) (default client port: 19244, server port: 19245)"`
55-
Regtest bool `long:"regtest" description:"Use the regression test network (default client port: 29244, server port: 29245)"`
56-
SimNet bool `long:"simnet" description:"Use the simulation test network (default client port: 39244, server port: 39245)"`
57-
SigNet bool `long:"signet" description:"Use the signet test network (default client port: 49244, server port: 49245)"`
58-
SigNetChallenge string `long:"signetchallenge" description:"Connect to a custom signet network defined by this challenge instead of using the global default signet test network -- Can be specified multiple times"`
59-
SigNetSeedNode []string `long:"signetseednode" description:"Specify a seed node for the signet network instead of using the global default signet network seed nodes"`
60-
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"`
61-
LogDir string `long:"logdir" description:"Directory to log output."`
62-
Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"`
63-
DBTimeout time.Duration `long:"dbtimeout" description:"The timeout value to use when opening the wallet database."`
47+
ConfigFile *cfgutil.ExplicitString `short:"C" long:"configfile" description:"Path to configuration file"`
48+
ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"`
49+
Create bool `long:"create" description:"Create the wallet if it does not exist"`
50+
CreateTemp bool `long:"createtemp" description:"Create a temporary simulation wallet (pass=password) in the data directory indicated; must call with --datadir"`
51+
AppDataDir *cfgutil.ExplicitString `short:"A" long:"appdata" description:"Application data directory for wallet config, databases and logs"`
52+
TestNet3 bool `long:"testnet" description:"Use the test Bitcoin network (version 3) (default client port: 19244, server port: 19245)"`
53+
Regtest bool `long:"regtest" description:"Use the regression test network (default client port: 29244, server port: 29245)"`
54+
DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"`
55+
LogDir string `long:"logdir" description:"Directory to log output."`
56+
Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"`
57+
DBTimeout time.Duration `long:"dbtimeout" description:"The timeout value to use when opening the wallet database."`
6458

6559
// Wallet options
6660
WalletPass string `long:"walletpass" default-mask:"-" description:"The public wallet password -- Only required if the wallet was created with one"`
6761

6862
// RPC client options
69-
RPCConnect string `short:"c" long:"rpcconnect" description:"Hostname/IP and port of lbcd RPC server to connect to (default localhost:9245, testnet: localhost:19245, regtest: localhost:29245 simnet: localhost:39245)"`
63+
RPCConnect string `short:"c" long:"rpcconnect" description:"Hostname/IP and port of lbcd RPC server to connect to (default localhost:9245, testnet: localhost:19245, regtest: localhost:29245)"`
7064
CAFile *cfgutil.ExplicitString `long:"cafile" description:"File containing root certificates to authenticate a TLS connections with lbcd"`
7165
DisableClientTLS bool `long:"noclienttls" description:"Disable TLS for the RPC client"`
7266
SkipVerify bool `long:"skipverify" description:"Skip verifying TLS for the RPC client"`
@@ -75,18 +69,11 @@ type config struct {
7569
ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"`
7670

7771
// RPC server options
78-
//
79-
// The legacy server is still enabled by default (and eventually will be
80-
// replaced with the experimental server) so prepare for that change by
81-
// renaming the struct fields (but not the configuration options).
82-
//
83-
// Usernames can also be used for the consensus RPC client, so they
84-
// aren't considered legacy.
8572
RPCCert *cfgutil.ExplicitString `long:"rpccert" description:"File containing the certificate file"`
8673
RPCKey *cfgutil.ExplicitString `long:"rpckey" description:"File containing the certificate key"`
8774
OneTimeTLSKey bool `long:"onetimetlskey" description:"Generate a new TLS certpair at startup, but only write the certificate to disk"`
8875
DisableServerTLS bool `long:"noservertls" description:"Disable TLS for the RPC server"`
89-
LegacyRPCListeners []string `long:"rpclisten" description:"Listen for legacy RPC connections on this interface/port (default port: 9244, testnet: 19244, regtest: 29244, simnet: 29244)"`
76+
LegacyRPCListeners []string `long:"rpclisten" description:"Listen for legacy RPC connections on this interface/port (default port: 9244, testnet: 19244, regtest: 29244)"`
9077
LegacyRPCMaxClients int64 `long:"rpcmaxclients" description:"Max number of legacy RPC clients for standard connections"`
9178
LegacyRPCMaxWebsockets int64 `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"`
9279
RPCUser string `short:"u" long:"rpcuser" description:"Username for RPC and lbcd authentication"`
@@ -347,52 +334,8 @@ func loadConfig() (*config, []string, error) {
347334
activeNet = &netparams.RegTestParams
348335
numNets++
349336
}
350-
if cfg.SimNet {
351-
activeNet = &netparams.SimNetParams
352-
numNets++
353-
}
354-
if cfg.SigNet {
355-
activeNet = &netparams.SigNetParams
356-
numNets++
357-
358-
// Let the user overwrite the default signet parameters. The
359-
// challenge defines the actual signet network to join and the
360-
// seed nodes are needed for network discovery.
361-
sigNetChallenge := chaincfg.DefaultSignetChallenge
362-
sigNetSeeds := chaincfg.DefaultSignetDNSSeeds
363-
if cfg.SigNetChallenge != "" {
364-
challenge, err := hex.DecodeString(cfg.SigNetChallenge)
365-
if err != nil {
366-
str := "%s: Invalid signet challenge, hex " +
367-
"decode failed: %v"
368-
err := fmt.Errorf(str, funcName, err)
369-
fmt.Fprintln(os.Stderr, err)
370-
fmt.Fprintln(os.Stderr, usageMessage)
371-
return nil, nil, err
372-
}
373-
sigNetChallenge = challenge
374-
}
375-
376-
if len(cfg.SigNetSeedNode) > 0 {
377-
sigNetSeeds = make(
378-
[]chaincfg.DNSSeed, len(cfg.SigNetSeedNode),
379-
)
380-
for idx, seed := range cfg.SigNetSeedNode {
381-
sigNetSeeds[idx] = chaincfg.DNSSeed{
382-
Host: seed,
383-
HasFiltering: false,
384-
}
385-
}
386-
}
387-
388-
chainParams := chaincfg.CustomSignetParams(
389-
sigNetChallenge, sigNetSeeds,
390-
)
391-
activeNet.Params = &chainParams
392-
}
393337
if numNets > 1 {
394-
str := "%s: The testnet, signet and simnet params can't be " +
395-
"used together -- choose one"
338+
str := "%s: more than one networks has been specified"
396339
err := fmt.Errorf(str, "loadConfig")
397340
fmt.Fprintln(os.Stderr, err)
398341
parser.WriteHelp(os.Stderr)
@@ -433,9 +376,9 @@ func loadConfig() (*config, []string, error) {
433376
}
434377

435378
// Exit if you try to use a simulation wallet on anything other than
436-
// simnet, regtest or testnet3.
437-
if !(cfg.Regtest || cfg.SimNet || cfg.TestNet3) {
438-
errMsg += "for network other than simnet, regtest, or testnet3"
379+
// regtest or testnet3.
380+
if !(cfg.Regtest || cfg.TestNet3) {
381+
errMsg += "for network other than regtest, or testnet3"
439382
fmt.Fprintln(os.Stderr, errMsg)
440383
os.Exit(0)
441384
}

lbcwallet.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ func readCAFile() []byte {
214214
func startChainRPC(certs []byte) (*chain.RPCClient, error) {
215215
log.Infof("Attempting RPC client connection to %v", cfg.RPCConnect)
216216
rpcc, err := chain.NewRPCClient(activeNet.Params, cfg.RPCConnect,
217-
cfg.RPCPass, cfg.RPCPass, certs, cfg.DisableClientTLS,
217+
cfg.RPCUser, cfg.RPCPass, certs, cfg.DisableClientTLS,
218218
cfg.SkipVerify, 0)
219219
if err != nil {
220220
return nil, err

netparams/params.go

Lines changed: 0 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ package netparams
66

77
import (
88
"github.com/lbryio/lbcd/chaincfg"
9-
"github.com/lbryio/lbcd/wire"
109
)
1110

1211
// Params is used to group parameters for various networks such as the main
@@ -42,31 +41,3 @@ var RegTestParams = Params{
4241
RPCClientPort: "29245",
4342
RPCServerPort: "29244",
4443
}
45-
46-
// SimNetParams contains parameters specific to the simulation test network
47-
// (wire.SimNet).
48-
var SimNetParams = Params{
49-
Params: &chaincfg.SimNetParams,
50-
RPCClientPort: "39245",
51-
RPCServerPort: "39244",
52-
}
53-
54-
// SigNetParams contains parameters specific to the signet test network
55-
// (wire.SigNet).
56-
var SigNetParams = Params{
57-
Params: &chaincfg.SigNetParams,
58-
RPCClientPort: "49245",
59-
RPCServerPort: "49244",
60-
}
61-
62-
// SigNetWire is a helper function that either returns the given chain
63-
// parameter's net value if the parameter represents a signet network or 0 if
64-
// it's not. This is necessary because there can be custom signet networks that
65-
// have a different net value.
66-
func SigNetWire(params *chaincfg.Params) wire.BitcoinNet {
67-
if params.Name == chaincfg.SigNetParams.Name {
68-
return params.Net
69-
}
70-
71-
return 0
72-
}

sample-lbcwallet.conf

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,9 @@
44
; Bitcoin wallet settings
55
; ------------------------------------------------------------------------------
66

7-
; Use testnet (cannot be used with simnet=1).
7+
; Use testnet
88
; testnet=0
99

10-
; Use simnet (cannot be used with testnet=1).
11-
; simnet=0
12-
1310
; The directory to open and save wallet, transaction, and unspent transaction
1411
; output files. Two directories, `mainnet` and `testnet` are used in this
1512
; directory for mainnet and testnet wallets, respectively.

waddrmgr/migrations.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -318,14 +318,6 @@ func populateBirthdayBlock(ns walletdb.ReadWriteBucket) error {
318318
genesisTimestamp =
319319
chaincfg.RegressionNetParams.GenesisBlock.Header.Timestamp
320320

321-
case *chaincfg.SimNetParams.GenesisHash:
322-
genesisTimestamp =
323-
chaincfg.SimNetParams.GenesisBlock.Header.Timestamp
324-
325-
case *chaincfg.SigNetParams.GenesisHash:
326-
genesisTimestamp =
327-
chaincfg.SigNetParams.GenesisBlock.Header.Timestamp
328-
329321
default:
330322
return fmt.Errorf("unknown genesis hash %v", genesisHash)
331323
}

waddrmgr/scoped_manager.go

Lines changed: 1 addition & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ import (
1414
btcutil "github.com/lbryio/lbcutil"
1515
"github.com/lbryio/lbcutil/hdkeychain"
1616
"github.com/lbryio/lbcwallet/internal/zero"
17-
"github.com/lbryio/lbcwallet/netparams"
1817
"github.com/lbryio/lbcwallet/walletdb"
1918
)
2019

@@ -46,11 +45,6 @@ const (
4645
// HDVersionTestNetBIP0084 is the HDVersion for BIP-0084 on the test
4746
// network.
4847
HDVersionTestNetBIP0084 HDVersion = 0x045f1cf6 // vpub
49-
50-
// HDVersionSimNetBIP0044 is the HDVersion for BIP-0044 on the
51-
// simulation test network. There aren't any other versions defined for
52-
// the simulation test network.
53-
HDVersionSimNetBIP0044 HDVersion = 0x0420bd3a // spub
5448
)
5549

5650
const (
@@ -2169,9 +2163,7 @@ func (s *ScopedKeyManager) cloneKeyWithVersion(key *hdkeychain.ExtendedKey) (
21692163
return nil, fmt.Errorf("unsupported scope %v", s.scope)
21702164
}
21712165

2172-
case wire.TestNet, wire.TestNet3,
2173-
netparams.SigNetWire(s.rootManager.ChainParams()):
2174-
2166+
case wire.TestNet, wire.TestNet3:
21752167
switch s.scope {
21762168
case KeyScopeBIP0044:
21772169
version = HDVersionTestNetBIP0044
@@ -2183,21 +2175,6 @@ func (s *ScopedKeyManager) cloneKeyWithVersion(key *hdkeychain.ExtendedKey) (
21832175
return nil, fmt.Errorf("unsupported scope %v", s.scope)
21842176
}
21852177

2186-
case wire.SimNet:
2187-
switch s.scope {
2188-
case KeyScopeBIP0044:
2189-
version = HDVersionSimNetBIP0044
2190-
// We use the mainnet versions for simnet keys when the keys
2191-
// belong to a key scope which simnet doesn't have a defined
2192-
// version for.
2193-
case KeyScopeBIP0049:
2194-
version = HDVersionMainNetBIP0049
2195-
case KeyScopeBIP0084:
2196-
version = HDVersionMainNetBIP0084
2197-
default:
2198-
return nil, fmt.Errorf("unsupported scope %v", s.scope)
2199-
}
2200-
22012178
default:
22022179
return nil, fmt.Errorf("unsupported net %v", net)
22032180
}

wallet/import.go

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@ import (
99
"github.com/lbryio/lbcd/wire"
1010
btcutil "github.com/lbryio/lbcutil"
1111
"github.com/lbryio/lbcutil/hdkeychain"
12-
"github.com/lbryio/lbcwallet/netparams"
1312
"github.com/lbryio/lbcwallet/waddrmgr"
1413
"github.com/lbryio/lbcwallet/walletdb"
1514
)
@@ -38,8 +37,7 @@ func keyScopeFromPubKey(pubKey *hdkeychain.ExtendedKey,
3837
// force the standard BIP-0049 derivation scheme (nested witness pubkeys
3938
// everywhere), while a witness address type will force the standard
4039
// BIP-0084 derivation scheme.
41-
case waddrmgr.HDVersionMainNetBIP0044, waddrmgr.HDVersionTestNetBIP0044,
42-
waddrmgr.HDVersionSimNetBIP0044:
40+
case waddrmgr.HDVersionMainNetBIP0044, waddrmgr.HDVersionTestNetBIP0044:
4341

4442
if addrType == nil {
4543
return waddrmgr.KeyScope{}, nil, errors.New("address " +
@@ -109,20 +107,10 @@ func (w *Wallet) isPubKeyForNet(pubKey *hdkeychain.ExtendedKey) bool {
109107
version == waddrmgr.HDVersionMainNetBIP0049 ||
110108
version == waddrmgr.HDVersionMainNetBIP0084
111109

112-
case wire.TestNet, wire.TestNet3, netparams.SigNetWire(w.chainParams):
110+
case wire.TestNet, wire.TestNet3:
113111
return version == waddrmgr.HDVersionTestNetBIP0044 ||
114112
version == waddrmgr.HDVersionTestNetBIP0049 ||
115113
version == waddrmgr.HDVersionTestNetBIP0084
116-
117-
// For simnet, we'll also allow the mainnet versions since simnet
118-
// doesn't have defined versions for some of our key scopes, and the
119-
// mainnet versions are usually used as the default regardless of the
120-
// network/key scope.
121-
case wire.SimNet:
122-
return version == waddrmgr.HDVersionSimNetBIP0044 ||
123-
version == waddrmgr.HDVersionMainNetBIP0049 ||
124-
version == waddrmgr.HDVersionMainNetBIP0084
125-
126114
default:
127115
return false
128116
}

wallet/wallet.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -529,11 +529,10 @@ func (w *Wallet) syncWithChain(birthdayStamp *waddrmgr.BlockStamp) error {
529529
}
530530

531531
// isDevEnv determines whether the wallet is currently under a local developer
532-
// environment, e.g. simnet or regtest.
532+
// environment, e.g. regtest.
533533
func (w *Wallet) isDevEnv() bool {
534534
switch uint32(w.ChainParams().Net) {
535535
case uint32(chaincfg.RegressionNetParams.Net):
536-
case uint32(chaincfg.SimNetParams.Net):
537536
default:
538537
return false
539538
}

0 commit comments

Comments
 (0)