Skip to content

Commit

Permalink
Merge pull request #8067 from lightningnetwork/0-18-staging-rebased
Browse files Browse the repository at this point in the history
branch: merge 0.18 staging branch into master
  • Loading branch information
Roasbeef authored Oct 9, 2023
2 parents ec2377d + b994b6f commit 4f34606
Show file tree
Hide file tree
Showing 110 changed files with 8,078 additions and 5,394 deletions.
7 changes: 7 additions & 0 deletions .golangci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -268,3 +268,10 @@ issues:
# if the returned value doesn't match the type, so there's no need to
# check the convert.
- forcetypeassert

- path: mock*
linters:
# forcetypeassert is skipped for the mock because the test would fail
# if the returned value doesn't match the type, so there's no need to
# check the convert.
- forcetypeassert
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ itest-race: build-itest-race itest-only
itest-parallel: build-itest db-instance
@$(call print, "Running tests")
rm -rf itest/*.log itest/.logs-*; date
EXEC_SUFFIX=$(EXEC_SUFFIX) echo "$$(seq 0 $$(expr $(ITEST_PARALLELISM) - 1))" | xargs -P $(ITEST_PARALLELISM) -n 1 -I {} scripts/itest_part.sh {} $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)
EXEC_SUFFIX=$(EXEC_SUFFIX) scripts/itest_parallel.sh $(ITEST_PARALLELISM) $(NUM_ITEST_TRANCHES) $(TEST_FLAGS) $(ITEST_FLAGS)

itest-clean:
@$(call print, "Cleaning old itest processes")
Expand Down
3 changes: 2 additions & 1 deletion chainntnfs/bitcoindnotify/bitcoind.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,8 @@ func (b *BitcoindNotifier) Stop() error {
return nil
}

chainntnfs.Log.Info("bitcoind notifier shutting down")
chainntnfs.Log.Info("bitcoind notifier shutting down...")
defer chainntnfs.Log.Debug("bitcoind notifier shutdown complete")

// Shutdown the rpc client, this gracefully disconnects from bitcoind,
// and cleans up all related resources.
Expand Down
3 changes: 2 additions & 1 deletion chainntnfs/btcdnotify/btcd.go
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,8 @@ func (b *BtcdNotifier) Stop() error {
return nil
}

chainntnfs.Log.Info("btcd notifier shutting down")
chainntnfs.Log.Info("btcd notifier shutting down...")
defer chainntnfs.Log.Debug("btcd notifier shutdown complete")

// Shutdown the rpc client, this gracefully disconnects from btcd, and
// cleans up all related resources.
Expand Down
2 changes: 2 additions & 0 deletions chainntnfs/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ func (m *MempoolNotifier) ProcessRelevantSpendTx(tx *btcutil.Tx) {
// TearDown stops the notifier and cleans up resources.
func (m *MempoolNotifier) TearDown() {
Log.Infof("Stopping mempool notifier")
defer Log.Debug("mempool notifier stopped")

close(m.quit)
m.wg.Wait()
}
Expand Down
3 changes: 2 additions & 1 deletion chainntnfs/neutrinonotify/neutrino.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,8 @@ func (n *NeutrinoNotifier) Stop() error {
return nil
}

chainntnfs.Log.Info("neutrino notifier shutting down")
chainntnfs.Log.Info("neutrino notifier shutting down...")
defer chainntnfs.Log.Debug("neutrino notifier shutdown complete")

close(n.quit)
n.wg.Wait()
Expand Down
25 changes: 0 additions & 25 deletions chainreg/chaincode.go

This file was deleted.

94 changes: 1 addition & 93 deletions chainreg/chainparams.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
package chainreg

import (
"github.com/btcsuite/btcd/chaincfg"
bitcoinCfg "github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash"
bitcoinWire "github.com/btcsuite/btcd/wire"
"github.com/lightningnetwork/lnd/keychain"
litecoinCfg "github.com/ltcsuite/ltcd/chaincfg"
litecoinWire "github.com/ltcsuite/ltcd/wire"
)

// BitcoinNetParams couples the p2p parameters of a network with the
Expand All @@ -18,14 +14,6 @@ type BitcoinNetParams struct {
CoinType uint32
}

// LitecoinNetParams couples the p2p parameters of a network with the
// corresponding RPC port of a daemon running on the particular network.
type LitecoinNetParams struct {
*litecoinCfg.Params
RPCPort string
CoinType uint32
}

// BitcoinTestNetParams contains parameters specific to the 3rd version of the
// test network.
var BitcoinTestNetParams = BitcoinNetParams{
Expand Down Expand Up @@ -57,38 +45,6 @@ var BitcoinSigNetParams = BitcoinNetParams{
CoinType: keychain.CoinTypeTestnet,
}

// LitecoinSimNetParams contains parameters specific to the simulation test
// network.
var LitecoinSimNetParams = LitecoinNetParams{
Params: &litecoinCfg.TestNet4Params,
RPCPort: "18556",
CoinType: keychain.CoinTypeTestnet,
}

// LitecoinTestNetParams contains parameters specific to the 4th version of the
// test network.
var LitecoinTestNetParams = LitecoinNetParams{
Params: &litecoinCfg.TestNet4Params,
RPCPort: "19334",
CoinType: keychain.CoinTypeTestnet,
}

// LitecoinMainNetParams contains the parameters specific to the current
// Litecoin mainnet.
var LitecoinMainNetParams = LitecoinNetParams{
Params: &litecoinCfg.MainNetParams,
RPCPort: "9334",
CoinType: keychain.CoinTypeLitecoin,
}

// LitecoinRegTestNetParams contains parameters specific to a local litecoin
// regtest network.
var LitecoinRegTestNetParams = LitecoinNetParams{
Params: &litecoinCfg.RegressionNetParams,
RPCPort: "18334",
CoinType: keychain.CoinTypeTestnet,
}

// BitcoinRegTestNetParams contains parameters specific to a local bitcoin
// regtest network.
var BitcoinRegTestNetParams = BitcoinNetParams{
Expand All @@ -97,56 +53,8 @@ var BitcoinRegTestNetParams = BitcoinNetParams{
CoinType: keychain.CoinTypeTestnet,
}

// ApplyLitecoinParams applies the relevant chain configuration parameters that
// differ for litecoin to the chain parameters typed for btcsuite derivation.
// This function is used in place of using something like interface{} to
// abstract over _which_ chain (or fork) the parameters are for.
func ApplyLitecoinParams(params *BitcoinNetParams,
litecoinParams *LitecoinNetParams) {

params.Name = litecoinParams.Name
params.Net = bitcoinWire.BitcoinNet(litecoinParams.Net)
params.DefaultPort = litecoinParams.DefaultPort
params.CoinbaseMaturity = litecoinParams.CoinbaseMaturity

copy(params.GenesisHash[:], litecoinParams.GenesisHash[:])

// Address encoding magics
params.PubKeyHashAddrID = litecoinParams.PubKeyHashAddrID
params.ScriptHashAddrID = litecoinParams.ScriptHashAddrID
params.PrivateKeyID = litecoinParams.PrivateKeyID
params.WitnessPubKeyHashAddrID = litecoinParams.WitnessPubKeyHashAddrID
params.WitnessScriptHashAddrID = litecoinParams.WitnessScriptHashAddrID
params.Bech32HRPSegwit = litecoinParams.Bech32HRPSegwit

copy(params.HDPrivateKeyID[:], litecoinParams.HDPrivateKeyID[:])
copy(params.HDPublicKeyID[:], litecoinParams.HDPublicKeyID[:])

params.HDCoinType = litecoinParams.HDCoinType

checkPoints := make([]chaincfg.Checkpoint, len(litecoinParams.Checkpoints))
for i := 0; i < len(litecoinParams.Checkpoints); i++ {
var chainHash chainhash.Hash
copy(chainHash[:], litecoinParams.Checkpoints[i].Hash[:])

checkPoints[i] = chaincfg.Checkpoint{
Height: litecoinParams.Checkpoints[i].Height,
Hash: &chainHash,
}
}
params.Checkpoints = checkPoints

params.RPCPort = litecoinParams.RPCPort
params.CoinType = litecoinParams.CoinType
}

// IsTestnet tests if the givern params correspond to a testnet
// parameter configuration.
func IsTestnet(params *BitcoinNetParams) bool {
switch params.Params.Net {
case bitcoinWire.TestNet3, bitcoinWire.BitcoinNet(litecoinWire.TestNet4):
return true
default:
return false
}
return params.Params.Net == bitcoinWire.TestNet3
}
Loading

0 comments on commit 4f34606

Please sign in to comment.