Skip to content

Commit

Permalink
ltc: bitcoin -> litecoin branding in user accessible areas
Browse files Browse the repository at this point in the history
  • Loading branch information
losh11 committed Jun 21, 2023
1 parent 41ff2d2 commit 07772e3
Show file tree
Hide file tree
Showing 71 changed files with 382 additions and 383 deletions.
2 changes: 1 addition & 1 deletion CHANGES
@@ -1,5 +1,5 @@
============================================================================
User visible changes for ltcd
User visible changes for btcd
A full-node bitcoin implementation written in Go
============================================================================

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Expand Up @@ -11,8 +11,8 @@
# For more information how to use this docker image visit:
# https://github.com/ltcsuite/ltcd/tree/master/docs
#
# 8333 Mainnet Bitcoin peer-to-peer port
# 8334 Mainet RPC port
# 9333 Mainnet Litecoin peer-to-peer port
# 9334 Mainet RPC port

ARG ARCH=amd64
# using the SHA256 instead of tags
Expand Down
20 changes: 10 additions & 10 deletions config.go
Expand Up @@ -98,8 +98,8 @@ type config struct {
AddCheckpoints []string `long:"addcheckpoint" description:"Add a custom checkpoint. Format: '<height>:<hash>'"`
AddPeers []string `short:"a" long:"addpeer" description:"Add a peer to connect with at startup"`
AddrIndex bool `long:"addrindex" description:"Maintain a full address-based transaction index which makes the searchrawtransactions RPC available"`
AgentBlacklist []string `long:"agentblacklist" description:"A comma separated list of user-agent substrings which will cause btcd to reject any peers whose user-agent contains any of the blacklisted substrings."`
AgentWhitelist []string `long:"agentwhitelist" description:"A comma separated list of user-agent substrings which will cause btcd to require all peers' user-agents to contain one of the whitelisted substrings. The blacklist is applied before the blacklist, and an empty whitelist will allow all agents that do not fail the blacklist."`
AgentBlacklist []string `long:"agentblacklist" description:"A comma separated list of user-agent substrings which will cause ltcd to reject any peers whose user-agent contains any of the blacklisted substrings."`
AgentWhitelist []string `long:"agentwhitelist" description:"A comma separated list of user-agent substrings which will cause ltcd to require all peers' user-agents to contain one of the whitelisted substrings. The blacklist is applied before the blacklist, and an empty whitelist will allow all agents that do not fail the blacklist."`
BanDuration time.Duration `long:"banduration" description:"How long to ban misbehaving peers. Valid time units are {s, m, h}. Minimum 1 second"`
BanThreshold uint32 `long:"banthreshold" description:"Maximum allowed ban score before disconnecting and banning misbehaving peers."`
BlockMaxSize uint32 `long:"blockmaxsize" description:"Maximum block size in bytes to be used when creating a block"`
Expand All @@ -118,9 +118,9 @@ type config struct {
DropCfIndex bool `long:"dropcfindex" description:"Deletes the index used for committed filtering (CF) support from the database on start up and then exits."`
DropTxIndex bool `long:"droptxindex" description:"Deletes the hash-based transaction index from the database on start up and then exits."`
ExternalIPs []string `long:"externalip" description:"Add an ip to the list of local addresses we claim to listen on to peers"`
Generate bool `long:"generate" description:"Generate (mine) bitcoins using the CPU"`
Generate bool `long:"generate" description:"Generate (mine) litecoins using the CPU"`
FreeTxRelayLimit float64 `long:"limitfreerelay" description:"Limit relay of transactions with no transaction fee to the given amount in thousands of bytes per minute"`
Listeners []string `long:"listen" description:"Add an interface/port to listen for connections (default all interfaces port: 8333, testnet: 18333)"`
Listeners []string `long:"listen" description:"Add an interface/port to listen for connections (default all interfaces port: 9333, testnet: 19333)"`
LogDir string `long:"logdir" description:"Directory to log output."`
MaxOrphanTxs int `long:"maxorphantx" description:"Max number of orphan transactions to keep in memory"`
MaxPeers int `long:"maxpeers" description:"Max number of inbound and outbound peers"`
Expand Down Expand Up @@ -155,11 +155,11 @@ type config struct {
RPCKey string `long:"rpckey" description:"File containing the certificate key"`
RPCLimitPass string `long:"rpclimitpass" default-mask:"-" description:"Password for limited RPC connections"`
RPCLimitUser string `long:"rpclimituser" description:"Username for limited RPC connections"`
RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 8334, testnet: 18334)"`
RPCListeners []string `long:"rpclisten" description:"Add an interface/port to listen for RPC connections (default port: 9334, testnet: 19334)"`
RPCMaxClients int `long:"rpcmaxclients" description:"Max number of RPC clients for standard connections"`
RPCMaxConcurrentReqs int `long:"rpcmaxconcurrentreqs" description:"Max number of concurrent RPC requests that may be processed concurrently"`
RPCMaxWebsockets int `long:"rpcmaxwebsockets" description:"Max number of RPC websocket connections"`
RPCQuirks bool `long:"rpcquirks" description:"Mirror some JSON-RPC quirks of Bitcoin Core -- NOTE: Discouraged unless interoperability issues need to be worked around"`
RPCQuirks bool `long:"rpcquirks" description:"Mirror some JSON-RPC quirks of Litecoin Core -- NOTE: Discouraged unless interoperability issues need to be worked around"`
RPCPass string `short:"P" long:"rpcpass" default-mask:"-" description:"Password for RPC connections"`
RPCUser string `short:"u" long:"rpcuser" description:"Username for RPC connections"`
SigCacheMaxSize uint `long:"sigcachemaxsize" description:"The maximum number of entries in the signature verification cache"`
Expand Down Expand Up @@ -402,10 +402,10 @@ func newConfigParser(cfg *config, so *serviceOptions, options flags.Options) *fl
// line options.
//
// The configuration proceeds as follows:
// 1) Start with a default config with sane settings
// 2) Pre-parse the command line to check for an alternative config file
// 3) Load configuration file overwriting defaults with any specified options
// 4) Parse CLI options and overwrite/add any specified options
// 1. Start with a default config with sane settings
// 2. Pre-parse the command line to check for an alternative config file
// 3. Load configuration file overwriting defaults with any specified options
// 4. Parse CLI options and overwrite/add any specified options
//
// The above results in ltcd functioning properly without any config settings
// while still allowing the user to override settings with config files and
Expand Down
20 changes: 10 additions & 10 deletions ltcutil/address.go
Expand Up @@ -55,7 +55,7 @@ var (
)

// encodeAddress returns a human-readable payment address given a ripemd160 hash
// and netID which encodes the bitcoin network and address type. It is used
// and netID which encodes the litecoin network and address type. It is used
// in both pay-to-pubkey-hash (P2PKH) and pay-to-script-hash (P2SH) address
// encoding.
func encodeAddress(hash160 []byte, netID byte) string {
Expand Down Expand Up @@ -135,19 +135,19 @@ type Address interface {
ScriptAddress() []byte

// IsForNet returns whether or not the address is associated with the
// passed bitcoin network.
// passed litecoin network.
IsForNet(*chaincfg.Params) bool
}

// DecodeAddress decodes the string encoding of an address and returns
// the Address if addr is a valid encoding for a known address type.
//
// The bitcoin network the address is associated with is extracted if possible.
// The litecoin network the address is associated with is extracted if possible.
// When the address does not encode the network, such as in the case of a raw
// public key, the address will be associated with the passed defaultNet.
func DecodeAddress(addr string, defaultNet *chaincfg.Params) (Address, error) {
// Bech32 encoded segwit addresses start with a human-readable part
// (hrp) followed by '1'. For Bitcoin mainnet the hrp is "bc", and for
// (hrp) followed by '1'. For Litecoin mainnet the hrp is "bc", and for
// testnet it is "tb". If the address string has a prefix that matches
// one of the prefixes for the known networks, we try to decode it as
// a segwit address.
Expand Down Expand Up @@ -322,7 +322,7 @@ func (a *AddressPubKeyHash) ScriptAddress() []byte {
}

// IsForNet returns whether or not the pay-to-pubkey-hash address is associated
// with the passed bitcoin network.
// with the passed litecoin network.
func (a *AddressPubKeyHash) IsForNet(net *chaincfg.Params) bool {
return a.netID == net.PubKeyHashAddrID
}
Expand Down Expand Up @@ -389,7 +389,7 @@ func (a *AddressScriptHash) ScriptAddress() []byte {
}

// IsForNet returns whether or not the pay-to-script-hash address is associated
// with the passed bitcoin network.
// with the passed litecoin network.
func (a *AddressScriptHash) IsForNet(net *chaincfg.Params) bool {
return a.netID == net.ScriptHashAddrID
}
Expand Down Expand Up @@ -472,7 +472,7 @@ func (a *AddressPubKey) serialize() []byte {
// pay-to-pubkey-hash. Note that the public key format (uncompressed,
// compressed, etc) will change the resulting address. This is expected since
// pay-to-pubkey-hash is a hash of the serialized public key which obviously
// differs with the format. At the time of this writing, most Bitcoin addresses
// differs with the format. At the time of this writing, most Litecoin addresses
// are pay-to-pubkey-hash constructed from the uncompressed public key.
//
// Part of the Address interface.
Expand All @@ -488,7 +488,7 @@ func (a *AddressPubKey) ScriptAddress() []byte {
}

// IsForNet returns whether or not the pay-to-pubkey address is associated
// with the passed bitcoin network.
// with the passed litecoin network.
func (a *AddressPubKey) IsForNet(net *chaincfg.Params) bool {
return a.pubKeyHashID == net.PubKeyHashAddrID
}
Expand All @@ -515,7 +515,7 @@ func (a *AddressPubKey) SetFormat(pkFormat PubKeyFormat) {
// pay-to-pubkey-hash address. Note that the public key format (uncompressed,
// compressed, etc) will change the resulting address. This is expected since
// pay-to-pubkey-hash is a hash of the serialized public key which obviously
// differs with the format. At the time of this writing, most Bitcoin addresses
// differs with the format. At the time of this writing, most Litecoin addresses
// are pay-to-pubkey-hash constructed from the uncompressed public key.
func (a *AddressPubKey) AddressPubKeyHash() *AddressPubKeyHash {
addr := &AddressPubKeyHash{netID: a.pubKeyHashID}
Expand Down Expand Up @@ -557,7 +557,7 @@ func (a *AddressSegWit) ScriptAddress() []byte {
}

// IsForNet returns whether the AddressSegWit is associated with the passed
// bitcoin network.
// litecoin network.
//
// NOTE: This method is part of the Address interface.
func (a *AddressSegWit) IsForNet(net *chaincfg.Params) bool {
Expand Down
2 changes: 1 addition & 1 deletion ltcutil/address_test.go
Expand Up @@ -124,7 +124,7 @@ func TestAddresses(t *testing.T) {
net: &chaincfg.MainNetParams,
},
{
// Taken from bitcoind base58_keys_valid.
// Taken from litecoind base58_keys_valid.
name: "testnet p2sh",
addr: "Qec8RUd8PgAMi6dKDKdHQ7zu71kyQNeU5m",
encoded: "Qec8RUd8PgAMi6dKDKdHQ7zu71kyQNeU5m",
Expand Down
24 changes: 12 additions & 12 deletions ltcutil/amount.go
Expand Up @@ -11,12 +11,12 @@ import (
)

// AmountUnit describes a method of converting an Amount to something
// other than the base unit of a bitcoin. The value of the AmountUnit
// other than the base unit of a litecoin. The value of the AmountUnit
// is the exponent component of the decadic multiple to convert from
// an amount in bitcoin to an amount counted in units.
// an amount in litecoin to an amount counted in units.
type AmountUnit int

// These constants define various units used when describing a bitcoin
// These constants define various units used when describing a litecoin
// monetary amount.
const (
AmountMegaBTC AmountUnit = 6
Expand Down Expand Up @@ -49,8 +49,8 @@ func (u AmountUnit) String() string {
}
}

// Amount represents the base bitcoin monetary unit (colloquially referred
// to as a `Satoshi'). A single Amount is equal to 1e-8 of a bitcoin.
// Amount represents the base litecoin monetary unit (colloquially referred
// to as a `Satoshi'). A single Amount is equal to 1e-8 of a litecoin.
type Amount int64

// round converts a floating point number, which may or may not be representable
Expand All @@ -62,8 +62,8 @@ func round(f float64) Amount {
}

// NewAmount creates an Amount from a floating point value representing
// some value in bitcoin. NewAmount errors if f is NaN or +-Infinity, but
// does not check that the amount is within the total amount of bitcoin
// some value in litecoin. NewAmount errors if f is NaN or +-Infinity, but
// does not check that the amount is within the total amount of litecoin
// producible as f may not refer to an amount at a single moment in time.
//
// NewAmount is for specifically for converting BTC to Satoshi.
Expand All @@ -79,14 +79,14 @@ func NewAmount(f float64) (Amount, error) {
case math.IsInf(f, 1):
fallthrough
case math.IsInf(f, -1):
return 0, errors.New("invalid bitcoin amount")
return 0, errors.New("invalid litecoin amount")
}

return round(f * SatoshiPerBitcoin), nil
}

// ToUnit converts a monetary amount counted in bitcoin base units to a
// floating point value representing an amount of bitcoin.
// ToUnit converts a monetary amount counted in litecoin base units to a
// floating point value representing an amount of litecoin.
func (a Amount) ToUnit(u AmountUnit) float64 {
return float64(a) / math.Pow10(int(u+8))
}
Expand All @@ -96,7 +96,7 @@ func (a Amount) ToBTC() float64 {
return a.ToUnit(AmountBTC)
}

// Format formats a monetary amount counted in bitcoin base units as a
// Format formats a monetary amount counted in litecoin base units as a
// string for a given unit. The conversion will succeed for any unit,
// however, known units will be formated with an appended label describing
// the units with SI notation, or "Satoshi" for the base unit.
Expand All @@ -112,7 +112,7 @@ func (a Amount) String() string {

// MulF64 multiplies an Amount by a floating point value. While this is not
// an operation that must typically be done by a full node or wallet, it is
// useful for services that build on top of bitcoin (for example, calculating
// useful for services that build on top of litecoin (for example, calculating
// a fee by multiplying by a percentage).
func (a Amount) MulF64(f float64) Amount {
return round(float64(a) * f)
Expand Down
2 changes: 1 addition & 1 deletion ltcutil/base58/alphabet.go
Expand Up @@ -7,7 +7,7 @@
package base58

const (
// alphabet is the modified base58 alphabet used by Bitcoin.
// alphabet is the modified base58 alphabet used by Litecoin.
alphabet = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"

alphabetIdx0 = '1'
Expand Down
10 changes: 5 additions & 5 deletions ltcutil/base58/doc.go
Expand Up @@ -6,23 +6,23 @@
Package base58 provides an API for working with modified base58 and Base58Check
encodings.
Modified Base58 Encoding
# Modified Base58 Encoding
Standard base58 encoding is similar to standard base64 encoding except, as the
name implies, it uses a 58 character alphabet which results in an alphanumeric
string and allows some characters which are problematic for humans to be
excluded. Due to this, there can be various base58 alphabets.
The modified base58 alphabet used by Bitcoin, and hence this package, omits the
The modified base58 alphabet used by Litecoin, and hence this package, omits the
0, O, I, and l characters that look the same in many fonts and are therefore
hard to humans to distinguish.
Base58Check Encoding Scheme
# Base58Check Encoding Scheme
The Base58Check encoding scheme is primarily used for Bitcoin addresses at the
The Base58Check encoding scheme is primarily used for Litecoin addresses at the
time of this writing, however it can be used to generically encode arbitrary
byte arrays into human-readable strings along with a version byte that can be
used to differentiate the same payload. For Bitcoin addresses, the extra
used to differentiate the same payload. For Litecoin addresses, the extra
version is used to differentiate the network of otherwise identical public keys
which helps prevent using an address intended for one network on another.
*/
Expand Down
4 changes: 2 additions & 2 deletions ltcutil/bech32/bech32_test.go
Expand Up @@ -35,7 +35,7 @@ func TestBech32(t *testing.T) {
{"1checkupstagehandshakeupstreamerranterredcaperred2y9e3w", ErrInvalidSeparatorIndex(0)}, // empty hrp
{"11qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqc8247j", ErrInvalidLength(91)}, // too long

// Additional test vectors used in bitcoin core
// Additional test vectors used in litecoin core
{" 1nwldj5", ErrInvalidCharacter(' ')},
{"\x7f" + "1axkwrx", ErrInvalidCharacter(0x7f)},
{"\x801eym55h", ErrInvalidCharacter(0x80)},
Expand Down Expand Up @@ -104,7 +104,7 @@ func TestBech32M(t *testing.T) {
{"split1checkupstagehandshakeupstreamerranterredcaperredlc445v", nil},
{"?1v759aa", nil},

// Additional test vectors used in bitcoin core
// Additional test vectors used in litecoin core
{"\x201xj0phk", ErrInvalidCharacter('\x20')},
{"\x7f1g6xzxy", ErrInvalidCharacter('\x7f')},
{"\x801vctc34", ErrInvalidCharacter('\x80')},
Expand Down
10 changes: 5 additions & 5 deletions ltcutil/block.go
Expand Up @@ -27,7 +27,7 @@ func (e OutOfRangeError) Error() string {
return string(e)
}

// Block defines a bitcoin block that provides easier and more efficient
// Block defines a litecoin block that provides easier and more efficient
// manipulation of raw blocks. It also memoizes hashes for the block and its
// transactions on their first access so subsequent accesses don't have to
// repeat the relatively expensive hashing operations.
Expand Down Expand Up @@ -216,7 +216,7 @@ func (b *Block) SetHeight(height int32) {
b.blockHeight = height
}

// NewBlock returns a new instance of a bitcoin block given an underlying
// NewBlock returns a new instance of a litecoin block given an underlying
// wire.MsgBlock. See Block.
func NewBlock(msgBlock *wire.MsgBlock) *Block {
return &Block{
Expand All @@ -225,7 +225,7 @@ func NewBlock(msgBlock *wire.MsgBlock) *Block {
}
}

// NewBlockFromBytes returns a new instance of a bitcoin block given the
// NewBlockFromBytes returns a new instance of a litecoin block given the
// serialized bytes. See Block.
func NewBlockFromBytes(serializedBlock []byte) (*Block, error) {
br := bytes.NewReader(serializedBlock)
Expand All @@ -237,7 +237,7 @@ func NewBlockFromBytes(serializedBlock []byte) (*Block, error) {
return b, nil
}

// NewBlockFromReader returns a new instance of a bitcoin block given a
// NewBlockFromReader returns a new instance of a litecoin block given a
// Reader to deserialize the block. See Block.
func NewBlockFromReader(r io.Reader) (*Block, error) {
// Deserialize the bytes into a MsgBlock.
Expand All @@ -254,7 +254,7 @@ func NewBlockFromReader(r io.Reader) (*Block, error) {
return &b, nil
}

// NewBlockFromBlockAndBytes returns a new instance of a bitcoin block given
// NewBlockFromBlockAndBytes returns a new instance of a litecoin block given
// an underlying wire.MsgBlock and the serialized bytes for it. See Block.
func NewBlockFromBlockAndBytes(msgBlock *wire.MsgBlock, serializedBlock []byte) *Block {
return &Block{
Expand Down

0 comments on commit 07772e3

Please sign in to comment.