diff --git a/chain/block_filterer_test.go b/chain/block_filterer_test.go index 2923337..2985b02 100644 --- a/chain/block_filterer_test.go +++ b/chain/block_filterer_test.go @@ -282,7 +282,7 @@ func TestBlockFiltererOneInOneOut(t *testing.T) { req := &chain.FilterBlocksRequest{ WatchedOutPoints: watchedOutPoints, } - blockFilterer := chain.NewBlockFilterer(&chaincfg.SimNetParams, req) + blockFilterer := chain.NewBlockFilterer(&chaincfg.RegressionNetParams, req) // Filter block 100000, which should find matches for the watched // outpoints. diff --git a/config.go b/config.go index cbb0e62..a95b03b 100644 --- a/config.go +++ b/config.go @@ -5,7 +5,6 @@ package main import ( - "encoding/hex" "fmt" "net" "os" @@ -17,7 +16,6 @@ import ( "time" flags "github.com/jessevdk/go-flags" - "github.com/lbryio/lbcd/chaincfg" "github.com/lbryio/lbcd/version" btcutil "github.com/lbryio/lbcutil" "github.com/lbryio/lbcwallet/internal/cfgutil" @@ -46,27 +44,23 @@ var ( type config struct { // General application behavior - ConfigFile *cfgutil.ExplicitString `short:"C" long:"configfile" description:"Path to configuration file"` - ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` - Create bool `long:"create" description:"Create the wallet if it does not exist"` - CreateTemp bool `long:"createtemp" description:"Create a temporary simulation wallet (pass=password) in the data directory indicated; must call with --datadir"` - AppDataDir *cfgutil.ExplicitString `short:"A" long:"appdata" description:"Application data directory for wallet config, databases and logs"` - TestNet3 bool `long:"testnet" description:"Use the test Bitcoin network (version 3) (default client port: 19244, server port: 19245)"` - Regtest bool `long:"regtest" description:"Use the regression test network (default client port: 29244, server port: 29245)"` - SimNet bool `long:"simnet" description:"Use the simulation test network (default client port: 39244, server port: 39245)"` - SigNet bool `long:"signet" description:"Use the signet test network (default client port: 49244, server port: 49245)"` - 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"` - SigNetSeedNode []string `long:"signetseednode" description:"Specify a seed node for the signet network instead of using the global default signet network seed nodes"` - DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"` - LogDir string `long:"logdir" description:"Directory to log output."` - Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"` - DBTimeout time.Duration `long:"dbtimeout" description:"The timeout value to use when opening the wallet database."` + ConfigFile *cfgutil.ExplicitString `short:"C" long:"configfile" description:"Path to configuration file"` + ShowVersion bool `short:"V" long:"version" description:"Display version information and exit"` + Create bool `long:"create" description:"Create the wallet if it does not exist"` + CreateTemp bool `long:"createtemp" description:"Create a temporary simulation wallet (pass=password) in the data directory indicated; must call with --datadir"` + AppDataDir *cfgutil.ExplicitString `short:"A" long:"appdata" description:"Application data directory for wallet config, databases and logs"` + TestNet3 bool `long:"testnet" description:"Use the test Bitcoin network (version 3) (default client port: 19244, server port: 19245)"` + Regtest bool `long:"regtest" description:"Use the regression test network (default client port: 29244, server port: 29245)"` + DebugLevel string `short:"d" long:"debuglevel" description:"Logging level {trace, debug, info, warn, error, critical}"` + LogDir string `long:"logdir" description:"Directory to log output."` + Profile string `long:"profile" description:"Enable HTTP profiling on given port -- NOTE port must be between 1024 and 65536"` + DBTimeout time.Duration `long:"dbtimeout" description:"The timeout value to use when opening the wallet database."` // Wallet options WalletPass string `long:"walletpass" default-mask:"-" description:"The public wallet password -- Only required if the wallet was created with one"` // RPC client options - 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)"` + 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)"` CAFile *cfgutil.ExplicitString `long:"cafile" description:"File containing root certificates to authenticate a TLS connections with lbcd"` DisableClientTLS bool `long:"noclienttls" description:"Disable TLS for the RPC client"` SkipVerify bool `long:"skipverify" description:"Skip verifying TLS for the RPC client"` @@ -75,18 +69,11 @@ type config struct { ProxyPass string `long:"proxypass" default-mask:"-" description:"Password for proxy server"` // RPC server options - // - // The legacy server is still enabled by default (and eventually will be - // replaced with the experimental server) so prepare for that change by - // renaming the struct fields (but not the configuration options). - // - // Usernames can also be used for the consensus RPC client, so they - // aren't considered legacy. RPCCert *cfgutil.ExplicitString `long:"rpccert" description:"File containing the certificate file"` RPCKey *cfgutil.ExplicitString `long:"rpckey" description:"File containing the certificate key"` OneTimeTLSKey bool `long:"onetimetlskey" description:"Generate a new TLS certpair at startup, but only write the certificate to disk"` DisableServerTLS bool `long:"noservertls" description:"Disable TLS for the RPC server"` - LegacyRPCListeners []string `long:"rpclisten" description:"Listen for legacy RPC connections on this interface/port (default port: 9244, testnet: 19244, regtest: 29244, simnet: 29244)"` + LegacyRPCListeners []string `long:"rpclisten" description:"Listen for legacy RPC connections on this interface/port (default port: 9244, testnet: 19244, regtest: 29244)"` LegacyRPCMaxClients int64 `long:"rpcmaxclients" description:"Max number of legacy RPC clients for standard connections"` LegacyRPCMaxWebsockets int64 `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"` RPCUser string `short:"u" long:"rpcuser" description:"Username for RPC and lbcd authentication"` @@ -347,52 +334,8 @@ func loadConfig() (*config, []string, error) { activeNet = &netparams.RegTestParams numNets++ } - if cfg.SimNet { - activeNet = &netparams.SimNetParams - numNets++ - } - if cfg.SigNet { - activeNet = &netparams.SigNetParams - numNets++ - - // Let the user overwrite the default signet parameters. The - // challenge defines the actual signet network to join and the - // seed nodes are needed for network discovery. - sigNetChallenge := chaincfg.DefaultSignetChallenge - sigNetSeeds := chaincfg.DefaultSignetDNSSeeds - if cfg.SigNetChallenge != "" { - challenge, err := hex.DecodeString(cfg.SigNetChallenge) - if err != nil { - str := "%s: Invalid signet challenge, hex " + - "decode failed: %v" - err := fmt.Errorf(str, funcName, err) - fmt.Fprintln(os.Stderr, err) - fmt.Fprintln(os.Stderr, usageMessage) - return nil, nil, err - } - sigNetChallenge = challenge - } - - if len(cfg.SigNetSeedNode) > 0 { - sigNetSeeds = make( - []chaincfg.DNSSeed, len(cfg.SigNetSeedNode), - ) - for idx, seed := range cfg.SigNetSeedNode { - sigNetSeeds[idx] = chaincfg.DNSSeed{ - Host: seed, - HasFiltering: false, - } - } - } - - chainParams := chaincfg.CustomSignetParams( - sigNetChallenge, sigNetSeeds, - ) - activeNet.Params = &chainParams - } if numNets > 1 { - str := "%s: The testnet, signet and simnet params can't be " + - "used together -- choose one" + str := "%s: more than one networks has been specified" err := fmt.Errorf(str, "loadConfig") fmt.Fprintln(os.Stderr, err) parser.WriteHelp(os.Stderr) @@ -433,9 +376,9 @@ func loadConfig() (*config, []string, error) { } // Exit if you try to use a simulation wallet on anything other than - // simnet, regtest or testnet3. - if !(cfg.Regtest || cfg.SimNet || cfg.TestNet3) { - errMsg += "for network other than simnet, regtest, or testnet3" + // regtest or testnet3. + if !(cfg.Regtest || cfg.TestNet3) { + errMsg += "for network other than regtest, or testnet3" fmt.Fprintln(os.Stderr, errMsg) os.Exit(0) } diff --git a/lbcwallet.go b/lbcwallet.go index f0b9a83..7bdf443 100644 --- a/lbcwallet.go +++ b/lbcwallet.go @@ -214,7 +214,7 @@ func readCAFile() []byte { func startChainRPC(certs []byte) (*chain.RPCClient, error) { log.Infof("Attempting RPC client connection to %v", cfg.RPCConnect) rpcc, err := chain.NewRPCClient(activeNet.Params, cfg.RPCConnect, - cfg.RPCPass, cfg.RPCPass, certs, cfg.DisableClientTLS, + cfg.RPCUser, cfg.RPCPass, certs, cfg.DisableClientTLS, cfg.SkipVerify, 0) if err != nil { return nil, err diff --git a/netparams/params.go b/netparams/params.go index c310598..fdf3223 100644 --- a/netparams/params.go +++ b/netparams/params.go @@ -6,7 +6,6 @@ package netparams import ( "github.com/lbryio/lbcd/chaincfg" - "github.com/lbryio/lbcd/wire" ) // Params is used to group parameters for various networks such as the main @@ -42,31 +41,3 @@ var RegTestParams = Params{ RPCClientPort: "29245", RPCServerPort: "29244", } - -// SimNetParams contains parameters specific to the simulation test network -// (wire.SimNet). -var SimNetParams = Params{ - Params: &chaincfg.SimNetParams, - RPCClientPort: "39245", - RPCServerPort: "39244", -} - -// SigNetParams contains parameters specific to the signet test network -// (wire.SigNet). -var SigNetParams = Params{ - Params: &chaincfg.SigNetParams, - RPCClientPort: "49245", - RPCServerPort: "49244", -} - -// SigNetWire is a helper function that either returns the given chain -// parameter's net value if the parameter represents a signet network or 0 if -// it's not. This is necessary because there can be custom signet networks that -// have a different net value. -func SigNetWire(params *chaincfg.Params) wire.BitcoinNet { - if params.Name == chaincfg.SigNetParams.Name { - return params.Net - } - - return 0 -} diff --git a/sample-lbcwallet.conf b/sample-lbcwallet.conf index 72a495c..1f9ccd5 100644 --- a/sample-lbcwallet.conf +++ b/sample-lbcwallet.conf @@ -4,12 +4,9 @@ ; Bitcoin wallet settings ; ------------------------------------------------------------------------------ -; Use testnet (cannot be used with simnet=1). +; Use testnet ; testnet=0 -; Use simnet (cannot be used with testnet=1). -; simnet=0 - ; The directory to open and save wallet, transaction, and unspent transaction ; output files. Two directories, `mainnet` and `testnet` are used in this ; directory for mainnet and testnet wallets, respectively. diff --git a/waddrmgr/migrations.go b/waddrmgr/migrations.go index 460277e..bfc0716 100644 --- a/waddrmgr/migrations.go +++ b/waddrmgr/migrations.go @@ -318,14 +318,6 @@ func populateBirthdayBlock(ns walletdb.ReadWriteBucket) error { genesisTimestamp = chaincfg.RegressionNetParams.GenesisBlock.Header.Timestamp - case *chaincfg.SimNetParams.GenesisHash: - genesisTimestamp = - chaincfg.SimNetParams.GenesisBlock.Header.Timestamp - - case *chaincfg.SigNetParams.GenesisHash: - genesisTimestamp = - chaincfg.SigNetParams.GenesisBlock.Header.Timestamp - default: return fmt.Errorf("unknown genesis hash %v", genesisHash) } diff --git a/waddrmgr/scoped_manager.go b/waddrmgr/scoped_manager.go index 45a83a9..717cdec 100644 --- a/waddrmgr/scoped_manager.go +++ b/waddrmgr/scoped_manager.go @@ -14,7 +14,6 @@ import ( btcutil "github.com/lbryio/lbcutil" "github.com/lbryio/lbcutil/hdkeychain" "github.com/lbryio/lbcwallet/internal/zero" - "github.com/lbryio/lbcwallet/netparams" "github.com/lbryio/lbcwallet/walletdb" ) @@ -46,11 +45,6 @@ const ( // HDVersionTestNetBIP0084 is the HDVersion for BIP-0084 on the test // network. HDVersionTestNetBIP0084 HDVersion = 0x045f1cf6 // vpub - - // HDVersionSimNetBIP0044 is the HDVersion for BIP-0044 on the - // simulation test network. There aren't any other versions defined for - // the simulation test network. - HDVersionSimNetBIP0044 HDVersion = 0x0420bd3a // spub ) const ( @@ -2169,9 +2163,7 @@ func (s *ScopedKeyManager) cloneKeyWithVersion(key *hdkeychain.ExtendedKey) ( return nil, fmt.Errorf("unsupported scope %v", s.scope) } - case wire.TestNet, wire.TestNet3, - netparams.SigNetWire(s.rootManager.ChainParams()): - + case wire.TestNet, wire.TestNet3: switch s.scope { case KeyScopeBIP0044: version = HDVersionTestNetBIP0044 @@ -2183,21 +2175,6 @@ func (s *ScopedKeyManager) cloneKeyWithVersion(key *hdkeychain.ExtendedKey) ( return nil, fmt.Errorf("unsupported scope %v", s.scope) } - case wire.SimNet: - switch s.scope { - case KeyScopeBIP0044: - version = HDVersionSimNetBIP0044 - // We use the mainnet versions for simnet keys when the keys - // belong to a key scope which simnet doesn't have a defined - // version for. - case KeyScopeBIP0049: - version = HDVersionMainNetBIP0049 - case KeyScopeBIP0084: - version = HDVersionMainNetBIP0084 - default: - return nil, fmt.Errorf("unsupported scope %v", s.scope) - } - default: return nil, fmt.Errorf("unsupported net %v", net) } diff --git a/wallet/import.go b/wallet/import.go index 40465ba..f7bc7a4 100644 --- a/wallet/import.go +++ b/wallet/import.go @@ -9,7 +9,6 @@ import ( "github.com/lbryio/lbcd/wire" btcutil "github.com/lbryio/lbcutil" "github.com/lbryio/lbcutil/hdkeychain" - "github.com/lbryio/lbcwallet/netparams" "github.com/lbryio/lbcwallet/waddrmgr" "github.com/lbryio/lbcwallet/walletdb" ) @@ -38,8 +37,7 @@ func keyScopeFromPubKey(pubKey *hdkeychain.ExtendedKey, // force the standard BIP-0049 derivation scheme (nested witness pubkeys // everywhere), while a witness address type will force the standard // BIP-0084 derivation scheme. - case waddrmgr.HDVersionMainNetBIP0044, waddrmgr.HDVersionTestNetBIP0044, - waddrmgr.HDVersionSimNetBIP0044: + case waddrmgr.HDVersionMainNetBIP0044, waddrmgr.HDVersionTestNetBIP0044: if addrType == nil { return waddrmgr.KeyScope{}, nil, errors.New("address " + @@ -109,20 +107,10 @@ func (w *Wallet) isPubKeyForNet(pubKey *hdkeychain.ExtendedKey) bool { version == waddrmgr.HDVersionMainNetBIP0049 || version == waddrmgr.HDVersionMainNetBIP0084 - case wire.TestNet, wire.TestNet3, netparams.SigNetWire(w.chainParams): + case wire.TestNet, wire.TestNet3: return version == waddrmgr.HDVersionTestNetBIP0044 || version == waddrmgr.HDVersionTestNetBIP0049 || version == waddrmgr.HDVersionTestNetBIP0084 - - // For simnet, we'll also allow the mainnet versions since simnet - // doesn't have defined versions for some of our key scopes, and the - // mainnet versions are usually used as the default regardless of the - // network/key scope. - case wire.SimNet: - return version == waddrmgr.HDVersionSimNetBIP0044 || - version == waddrmgr.HDVersionMainNetBIP0049 || - version == waddrmgr.HDVersionMainNetBIP0084 - default: return false } diff --git a/wallet/wallet.go b/wallet/wallet.go index 1d8c5d9..eae630c 100644 --- a/wallet/wallet.go +++ b/wallet/wallet.go @@ -529,11 +529,10 @@ func (w *Wallet) syncWithChain(birthdayStamp *waddrmgr.BlockStamp) error { } // isDevEnv determines whether the wallet is currently under a local developer -// environment, e.g. simnet or regtest. +// environment, e.g. regtest. func (w *Wallet) isDevEnv() bool { switch uint32(w.ChainParams().Net) { case uint32(chaincfg.RegressionNetParams.Net): - case uint32(chaincfg.SimNetParams.Net): default: return false }