Skip to content

chore: remove dead code #9780

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions channeldb/payments_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,19 +46,6 @@ var (
LegacyPayload: true,
}

testHop3 = &route.Hop{
PubKeyBytes: route.NewVertex(pub),
ChannelID: 12345,
OutgoingTimeLock: 111,
AmtToForward: 555,
CustomRecords: record.CustomSet{
65536: []byte{},
80001: []byte{},
},
AMP: record.NewAMP([32]byte{0x69}, [32]byte{0x42}, 1),
Metadata: []byte{1, 2, 3},
}

testRoute = route.Route{
TotalTimeLock: 123,
TotalAmount: 1234567,
Expand Down
4 changes: 0 additions & 4 deletions contractcourt/channel_arbitrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ var (
)

const (
// arbitratorBlockBufferSize is the size of the buffer we give to each
// channel arbitrator.
arbitratorBlockBufferSize = 20

// AnchorOutputValue is the output value for the anchor output of an
// anchor channel.
// See BOLT 03 for more details:
Expand Down
6 changes: 0 additions & 6 deletions contractcourt/contract_resolver.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,6 @@ var (
endian = binary.BigEndian
)

const (
// sweepConfTarget is the default number of blocks that we'll use as a
// confirmation target when sweeping.
sweepConfTarget = 6
)

// ContractResolver is an interface which packages a state machine which is
// able to carry out the necessary steps required to fully resolve a Bitcoin
// contract on-chain. Resolvers are fully encodable to ensure callers are able
Expand Down
6 changes: 0 additions & 6 deletions contractcourt/utxonursery.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,6 @@ import (

var byteOrder = binary.BigEndian

const (
// kgtnOutputConfTarget is the default confirmation target we'll use for
// sweeps of CSV delayed outputs.
kgtnOutputConfTarget = 6
)

var (
// ErrContractNotFound is returned when the nursery is unable to
// retrieve information about a queried contract.
Expand Down
7 changes: 0 additions & 7 deletions graph/notifications_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,13 +38,6 @@ var (

testFeatures = lnwire.NewFeatureVector(nil, lnwire.Features)

testHash = [32]byte{
0xb7, 0x94, 0x38, 0x5f, 0x2d, 0x1e, 0xf7, 0xab,
0x4d, 0x92, 0x73, 0xd1, 0x90, 0x63, 0x81, 0xb4,
0x4f, 0x2f, 0x6f, 0x25, 0x88, 0xa3, 0xef, 0xb9,
0x6a, 0x49, 0x18, 0x83, 0x31, 0x98, 0x47, 0x53,
}

testTime = time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)

priv1, _ = btcec.NewPrivateKey()
Expand Down
1 change: 0 additions & 1 deletion htlcswitch/mock.go
Original file line number Diff line number Diff line change
Expand Up @@ -925,7 +925,6 @@ func (f *mockChannelLink) ChannelPoint() wire.OutPoint {
func (f *mockChannelLink) Stop() {}
func (f *mockChannelLink) EligibleToForward() bool { return f.eligible }
func (f *mockChannelLink) MayAddOutgoingHtlc(lnwire.MilliSatoshi) error { return nil }
func (f *mockChannelLink) setLiveShortChanID(sid lnwire.ShortChannelID) { f.shortChanID = sid }
func (f *mockChannelLink) IsUnadvertised() bool { return f.unadvertised }
func (f *mockChannelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
f.eligible = true
Expand Down
14 changes: 0 additions & 14 deletions internal/musig2v040/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ import (
)

var (
testPrivBytes = hexToModNScalar("9e0699c91ca1e3b7e3c9ba71eb71c89890872be97576010fe593fbf3fd57e66d")

testMsg = hexToBytes("c301ba9de5d6053caad9f5eb46523f007702add2c62fa39de03146a36b8026b7")
)

Expand All @@ -27,18 +25,6 @@ func hexToBytes(s string) []byte {
return b
}

func hexToModNScalar(s string) *btcec.ModNScalar {
b, err := hex.DecodeString(s)
if err != nil {
panic("invalid hex in source file: " + s)
}
var scalar btcec.ModNScalar
if overflow := scalar.SetByteSlice(b); overflow {
panic("hex in source file overflows mod N scalar: " + s)
}
return &scalar
}

func genSigner(t *testing.B) signer {
privKey, err := btcec.NewPrivateKey()
if err != nil {
Expand Down
19 changes: 0 additions & 19 deletions internal/musig2v040/musig2_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,22 +274,6 @@ func mustParseHex(str string) []byte {
return b
}

func parseKey(xHex string) *btcec.PublicKey {
xB, err := hex.DecodeString(xHex)
if err != nil {
panic(err)
}

var x, y btcec.FieldVal
x.SetByteSlice(xB)
if !btcec.DecompressY(&x, false, &y) {
panic("x not on curve")
}
y.Normalize()

return btcec.NewPublicKey(&x, &y)
}

var (
signSetPrivKey, _ = btcec.PrivKeyFromBytes(
mustParseHex("7FB9E0E687ADA1EEBF7ECFE2F21E73EBDB51A7D450948DF" +
Expand All @@ -306,9 +290,6 @@ var (
signSetKey3 = mustParseHex("DFF1D77F2A671C5F36183726DB2341BE58FEAE1DA" +
"2DECED843240F7B502BA659")

invalidSetKey1 = mustParseHex("00000000000000000000000000000000" +
"00000000000000000000000000000007")

signExpected1 = mustParseHex("68537CC5234E505BD14061F8DA9E90C220A1818" +
"55FD8BDB7F127BB12403B4D3B")
signExpected2 = mustParseHex("2DF67BFFF18E3DE797E13C6475C963048138DAE" +
Expand Down
4 changes: 0 additions & 4 deletions internal/musig2v040/nonces.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,6 @@ var (
byteOrder = binary.BigEndian
)

// zeroSecNonce is a secret nonce that's all zeroes. This is used to check that
// we're not attempting to re-use a nonce, and also protect callers from it.
var zeroSecNonce [SecNonceSize]byte

// Nonces holds the public and secret nonces required for musig2.
//
// TODO(roasbeef): methods on this to help w/ parsing, etc?
Expand Down
115 changes: 0 additions & 115 deletions lntest/harness.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ const (
// outputs from the miner.
defaultMinerFeeRate = 7500

// numBlocksSendOutput specifies the number of blocks to mine after
// sending outputs from the miner.
numBlocksSendOutput = 2

// numBlocksOpenChannel specifies the number of blocks mined when
// opening a channel.
numBlocksOpenChannel = 6
Expand Down Expand Up @@ -215,39 +211,6 @@ func (h *HarnessTest) Context() context.Context {
return h.runCtx
}

// setupWatchOnlyNode initializes a node with the watch-only accounts of an
// associated remote signing instance.
func (h *HarnessTest) setupWatchOnlyNode(name string,
signerNode *node.HarnessNode, password []byte) *node.HarnessNode {

// Prepare arguments for watch-only node connected to the remote signer.
remoteSignerArgs := []string{
"--remotesigner.enable",
fmt.Sprintf("--remotesigner.rpchost=localhost:%d",
signerNode.Cfg.RPCPort),
fmt.Sprintf("--remotesigner.tlscertpath=%s",
signerNode.Cfg.TLSCertPath),
fmt.Sprintf("--remotesigner.macaroonpath=%s",
signerNode.Cfg.AdminMacPath),
}

// Fetch watch-only accounts from the signer node.
resp := signerNode.RPC.ListAccounts(&walletrpc.ListAccountsRequest{})
watchOnlyAccounts, err := walletrpc.AccountsToWatchOnly(resp.Accounts)
require.NoErrorf(h, err, "unable to find watch only accounts for %s",
name)

// Create a new watch-only node with remote signer configuration.
return h.NewNodeRemoteSigner(
name, remoteSignerArgs, password,
&lnrpc.WatchOnly{
MasterKeyBirthdayTimestamp: 0,
MasterKeyFingerprint: nil,
Accounts: watchOnlyAccounts,
},
)
}

// createAndSendOutput send amt satoshis from the internal mining node to the
// targeted lightning node using a P2WKH address. No blocks are mined so
// transactions will sit unconfirmed in mempool.
Expand Down Expand Up @@ -439,31 +402,6 @@ func (h *HarnessTest) shutdownAllNodes() {
require.NoError(h, err, "failed to shutdown all nodes")
}

// cleanupStandbyNode is a function should be called with defer whenever a
// subtest is created. It will reset the standby nodes configs, snapshot the
// states, and validate the node has a clean state.
func (h *HarnessTest) cleanupStandbyNode(hn *node.HarnessNode) {
// Remove connections made from this test.
h.removeConnectionns(hn)

// Delete all payments made from this test.
hn.RPC.DeleteAllPayments()

// Check the node's current state with timeout.
//
// NOTE: we need to do this in a `wait` because it takes some time for
// the node to update its internal state. Once the RPCs are synced we
// can then remove this wait.
err := wait.NoError(func() error {
// Update the node's internal state.
hn.UpdateState()

// Check the node is in a clean state for the following tests.
return h.validateNodeState(hn)
}, wait.DefaultTimeout)
require.NoError(h, err, "timeout checking node's state")
}

// removeConnectionns will remove all connections made on the standby nodes
// expect the connections between Alice and Bob.
func (h *HarnessTest) removeConnectionns(hn *node.HarnessNode) {
Expand Down Expand Up @@ -808,59 +746,6 @@ func (h *HarnessTest) SetMinRelayFeerate(fee chainfee.SatPerKVByte) {
h.feeService.SetMinRelayFeerate(fee)
}

// validateNodeState checks that the node doesn't have any uncleaned states
// which will affect its following tests.
func (h *HarnessTest) validateNodeState(hn *node.HarnessNode) error {
errStr := func(subject string) error {
return fmt.Errorf("%s: found %s channels, please close "+
"them properly", hn.Name(), subject)
}
// If the node still has open channels, it's most likely that the
// current test didn't close it properly.
if hn.State.OpenChannel.Active != 0 {
return errStr("active")
}
if hn.State.OpenChannel.Public != 0 {
return errStr("public")
}
if hn.State.OpenChannel.Private != 0 {
return errStr("private")
}
if hn.State.OpenChannel.Pending != 0 {
return errStr("pending open")
}

// The number of pending force close channels should be zero.
if hn.State.CloseChannel.PendingForceClose != 0 {
return errStr("pending force")
}

// The number of waiting close channels should be zero.
if hn.State.CloseChannel.WaitingClose != 0 {
return errStr("waiting close")
}

// Ths number of payments should be zero.
if hn.State.Payment.Total != 0 {
return fmt.Errorf("%s: found uncleaned payments, please "+
"delete all of them properly", hn.Name())
}

// The number of public edges should be zero.
if hn.State.Edge.Public != 0 {
return fmt.Errorf("%s: found active public egdes, please "+
"clean them properly", hn.Name())
}

// The number of edges should be zero.
if hn.State.Edge.Total != 0 {
return fmt.Errorf("%s: found active edges, please "+
"clean them properly", hn.Name())
}

return nil
}

// GetChanPointFundingTxid takes a channel point and converts it into a chain
// hash.
func (h *HarnessTest) GetChanPointFundingTxid(
Expand Down
8 changes: 0 additions & 8 deletions lnwallet/channel_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9165,14 +9165,6 @@ func checkExpectedHtlcs(t *testing.T, actual []*paymentDescriptor,
}
}

// heights represents the heights on a payment descriptor.
type heights struct {
localAdd uint64
localRemove uint64
remoteAdd uint64
remoteRemove uint64
}

// TestChannelUnsignedAckedFailure tests that unsigned acked updates are
// properly restored after signing for them and disconnecting.
//
Expand Down
9 changes: 0 additions & 9 deletions lnwallet/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -510,15 +510,6 @@ func privkeyFromHex(keyHex string) (*btcec.PrivateKey, error) {

}

// blockFromHex parses a full Bitcoin block from a hex encoded string.
func blockFromHex(blockHex string) (*btcutil.Block, error) {
bytes, err := hex.DecodeString(blockHex)
if err != nil {
return nil, err
}
return btcutil.NewBlockFromBytes(bytes)
}

// txFromHex parses a full Bitcoin transaction from a hex encoded string.
func txFromHex(txHex string) (*btcutil.Tx, error) {
bytes, err := hex.DecodeString(txHex)
Expand Down
16 changes: 5 additions & 11 deletions lnwire/lnwire_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,13 @@ var (
"319d18e949ddfa2965fb6caa1bf0314f882d7")
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a" +
"88121167221b6700d72a0ead154c03be696a292d24ae")
testRScalar = new(btcec.ModNScalar)
testSScalar = new(btcec.ModNScalar)
_ = testRScalar.SetByteSlice(testRBytes)
_ = testSScalar.SetByteSlice(testSBytes)
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
testSchnorrSigStr, _ = hex.DecodeString("04E7F9037658A92AFEB4F2" +
"5BAE5339E3DDCA81A353493827D26F16D92308E49E2A25E9220867" +
"8A2DF86970DA91B03A8AF8815A8A60498B358DAF560B347AA557")
testSchnorrSig, _ = NewSigFromSchnorrRawSignature(testSchnorrSigStr)
testRScalar = new(btcec.ModNScalar)
testSScalar = new(btcec.ModNScalar)
_ = testRScalar.SetByteSlice(testRBytes)
_ = testSScalar.SetByteSlice(testSBytes)
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
)

const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

// generateRandomBytes returns a slice of n random bytes.
func generateRandomBytes(n int) ([]byte, error) {
b := make([]byte, n)
Expand Down
5 changes: 0 additions & 5 deletions sweep/fee_bumper.go
Original file line number Diff line number Diff line change
Expand Up @@ -412,11 +412,6 @@ func NewTxPublisher(cfg TxPublisherConfig) *TxPublisher {
return tp
}

// isNeutrinoBackend checks if the wallet backend is neutrino.
func (t *TxPublisher) isNeutrinoBackend() bool {
return t.cfg.Wallet.BackEnd() == "neutrino"
}

// Broadcast is used to publish the tx created from the given inputs. It will
// register the broadcast request and return a chan to the caller to subscribe
// the broadcast result. The initial broadcast is guaranteed to be
Expand Down
1 change: 0 additions & 1 deletion sweep/test_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import (

var (
defaultTestTimeout = 5 * time.Second
processingDelay = 1 * time.Second
mockChainHash, _ = chainhash.NewHashFromStr("00aabbccddeeff")
mockChainHeight = int32(100)
)
Expand Down
1 change: 0 additions & 1 deletion watchtower/wtclient/session_queue.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,6 @@ type sessionQueueConfig struct {
type sessionQueue struct {
started sync.Once
stopped sync.Once
forced sync.Once

cfg *sessionQueueConfig
log btclog.Logger
Expand Down
Loading