Skip to content

Commit 5db9047

Browse files
chore: remove dead code
1 parent 334a7d1 commit 5db9047

File tree

16 files changed

+5
-224
lines changed

16 files changed

+5
-224
lines changed

channeldb/payments_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,6 @@ var (
4646
LegacyPayload: true,
4747
}
4848

49-
testHop3 = &route.Hop{
50-
PubKeyBytes: route.NewVertex(pub),
51-
ChannelID: 12345,
52-
OutgoingTimeLock: 111,
53-
AmtToForward: 555,
54-
CustomRecords: record.CustomSet{
55-
65536: []byte{},
56-
80001: []byte{},
57-
},
58-
AMP: record.NewAMP([32]byte{0x69}, [32]byte{0x42}, 1),
59-
Metadata: []byte{1, 2, 3},
60-
}
61-
6249
testRoute = route.Route{
6350
TotalTimeLock: 123,
6451
TotalAmount: 1234567,

contractcourt/channel_arbitrator.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ var (
3838
)
3939

4040
const (
41-
// arbitratorBlockBufferSize is the size of the buffer we give to each
42-
// channel arbitrator.
43-
arbitratorBlockBufferSize = 20
44-
4541
// AnchorOutputValue is the output value for the anchor output of an
4642
// anchor channel.
4743
// See BOLT 03 for more details:

contractcourt/contract_resolver.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,6 @@ var (
1818
endian = binary.BigEndian
1919
)
2020

21-
const (
22-
// sweepConfTarget is the default number of blocks that we'll use as a
23-
// confirmation target when sweeping.
24-
sweepConfTarget = 6
25-
)
26-
2721
// ContractResolver is an interface which packages a state machine which is
2822
// able to carry out the necessary steps required to fully resolve a Bitcoin
2923
// contract on-chain. Resolvers are fully encodable to ensure callers are able

contractcourt/utxonursery.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,6 @@ import (
160160

161161
var byteOrder = binary.BigEndian
162162

163-
const (
164-
// kgtnOutputConfTarget is the default confirmation target we'll use for
165-
// sweeps of CSV delayed outputs.
166-
kgtnOutputConfTarget = 6
167-
)
168-
169163
var (
170164
// ErrContractNotFound is returned when the nursery is unable to
171165
// retrieve information about a queried contract.

graph/notifications_test.go

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,6 @@ var (
3838

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

41-
testHash = [32]byte{
42-
0xb7, 0x94, 0x38, 0x5f, 0x2d, 0x1e, 0xf7, 0xab,
43-
0x4d, 0x92, 0x73, 0xd1, 0x90, 0x63, 0x81, 0xb4,
44-
0x4f, 0x2f, 0x6f, 0x25, 0x88, 0xa3, 0xef, 0xb9,
45-
0x6a, 0x49, 0x18, 0x83, 0x31, 0x98, 0x47, 0x53,
46-
}
47-
4841
testTime = time.Date(2018, time.January, 9, 14, 00, 00, 0, time.UTC)
4942

5043
priv1, _ = btcec.NewPrivateKey()

htlcswitch/mock.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -925,7 +925,6 @@ func (f *mockChannelLink) ChannelPoint() wire.OutPoint {
925925
func (f *mockChannelLink) Stop() {}
926926
func (f *mockChannelLink) EligibleToForward() bool { return f.eligible }
927927
func (f *mockChannelLink) MayAddOutgoingHtlc(lnwire.MilliSatoshi) error { return nil }
928-
func (f *mockChannelLink) setLiveShortChanID(sid lnwire.ShortChannelID) { f.shortChanID = sid }
929928
func (f *mockChannelLink) IsUnadvertised() bool { return f.unadvertised }
930929
func (f *mockChannelLink) UpdateShortChanID() (lnwire.ShortChannelID, error) {
931930
f.eligible = true

internal/musig2v040/bench_test.go

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@ import (
1414
)
1515

1616
var (
17-
testPrivBytes = hexToModNScalar("9e0699c91ca1e3b7e3c9ba71eb71c89890872be97576010fe593fbf3fd57e66d")
18-
1917
testMsg = hexToBytes("c301ba9de5d6053caad9f5eb46523f007702add2c62fa39de03146a36b8026b7")
2018
)
2119

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

30-
func hexToModNScalar(s string) *btcec.ModNScalar {
31-
b, err := hex.DecodeString(s)
32-
if err != nil {
33-
panic("invalid hex in source file: " + s)
34-
}
35-
var scalar btcec.ModNScalar
36-
if overflow := scalar.SetByteSlice(b); overflow {
37-
panic("hex in source file overflows mod N scalar: " + s)
38-
}
39-
return &scalar
40-
}
41-
4228
func genSigner(t *testing.B) signer {
4329
privKey, err := btcec.NewPrivateKey()
4430
if err != nil {

internal/musig2v040/musig2_test.go

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -274,22 +274,6 @@ func mustParseHex(str string) []byte {
274274
return b
275275
}
276276

277-
func parseKey(xHex string) *btcec.PublicKey {
278-
xB, err := hex.DecodeString(xHex)
279-
if err != nil {
280-
panic(err)
281-
}
282-
283-
var x, y btcec.FieldVal
284-
x.SetByteSlice(xB)
285-
if !btcec.DecompressY(&x, false, &y) {
286-
panic("x not on curve")
287-
}
288-
y.Normalize()
289-
290-
return btcec.NewPublicKey(&x, &y)
291-
}
292-
293277
var (
294278
signSetPrivKey, _ = btcec.PrivKeyFromBytes(
295279
mustParseHex("7FB9E0E687ADA1EEBF7ECFE2F21E73EBDB51A7D450948DF" +
@@ -306,9 +290,6 @@ var (
306290
signSetKey3 = mustParseHex("DFF1D77F2A671C5F36183726DB2341BE58FEAE1DA" +
307291
"2DECED843240F7B502BA659")
308292

309-
invalidSetKey1 = mustParseHex("00000000000000000000000000000000" +
310-
"00000000000000000000000000000007")
311-
312293
signExpected1 = mustParseHex("68537CC5234E505BD14061F8DA9E90C220A1818" +
313294
"55FD8BDB7F127BB12403B4D3B")
314295
signExpected2 = mustParseHex("2DF67BFFF18E3DE797E13C6475C963048138DAE" +

internal/musig2v040/nonces.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,6 @@ var (
3636
byteOrder = binary.BigEndian
3737
)
3838

39-
// zeroSecNonce is a secret nonce that's all zeroes. This is used to check that
40-
// we're not attempting to re-use a nonce, and also protect callers from it.
41-
var zeroSecNonce [SecNonceSize]byte
42-
4339
// Nonces holds the public and secret nonces required for musig2.
4440
//
4541
// TODO(roasbeef): methods on this to help w/ parsing, etc?

lntest/harness.go

Lines changed: 0 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,6 @@ const (
3838
// outputs from the miner.
3939
defaultMinerFeeRate = 7500
4040

41-
// numBlocksSendOutput specifies the number of blocks to mine after
42-
// sending outputs from the miner.
43-
numBlocksSendOutput = 2
44-
4541
// numBlocksOpenChannel specifies the number of blocks mined when
4642
// opening a channel.
4743
numBlocksOpenChannel = 6
@@ -215,39 +211,6 @@ func (h *HarnessTest) Context() context.Context {
215211
return h.runCtx
216212
}
217213

218-
// setupWatchOnlyNode initializes a node with the watch-only accounts of an
219-
// associated remote signing instance.
220-
func (h *HarnessTest) setupWatchOnlyNode(name string,
221-
signerNode *node.HarnessNode, password []byte) *node.HarnessNode {
222-
223-
// Prepare arguments for watch-only node connected to the remote signer.
224-
remoteSignerArgs := []string{
225-
"--remotesigner.enable",
226-
fmt.Sprintf("--remotesigner.rpchost=localhost:%d",
227-
signerNode.Cfg.RPCPort),
228-
fmt.Sprintf("--remotesigner.tlscertpath=%s",
229-
signerNode.Cfg.TLSCertPath),
230-
fmt.Sprintf("--remotesigner.macaroonpath=%s",
231-
signerNode.Cfg.AdminMacPath),
232-
}
233-
234-
// Fetch watch-only accounts from the signer node.
235-
resp := signerNode.RPC.ListAccounts(&walletrpc.ListAccountsRequest{})
236-
watchOnlyAccounts, err := walletrpc.AccountsToWatchOnly(resp.Accounts)
237-
require.NoErrorf(h, err, "unable to find watch only accounts for %s",
238-
name)
239-
240-
// Create a new watch-only node with remote signer configuration.
241-
return h.NewNodeRemoteSigner(
242-
name, remoteSignerArgs, password,
243-
&lnrpc.WatchOnly{
244-
MasterKeyBirthdayTimestamp: 0,
245-
MasterKeyFingerprint: nil,
246-
Accounts: watchOnlyAccounts,
247-
},
248-
)
249-
}
250-
251214
// createAndSendOutput send amt satoshis from the internal mining node to the
252215
// targeted lightning node using a P2WKH address. No blocks are mined so
253216
// transactions will sit unconfirmed in mempool.
@@ -439,31 +402,6 @@ func (h *HarnessTest) shutdownAllNodes() {
439402
require.NoError(h, err, "failed to shutdown all nodes")
440403
}
441404

442-
// cleanupStandbyNode is a function should be called with defer whenever a
443-
// subtest is created. It will reset the standby nodes configs, snapshot the
444-
// states, and validate the node has a clean state.
445-
func (h *HarnessTest) cleanupStandbyNode(hn *node.HarnessNode) {
446-
// Remove connections made from this test.
447-
h.removeConnectionns(hn)
448-
449-
// Delete all payments made from this test.
450-
hn.RPC.DeleteAllPayments()
451-
452-
// Check the node's current state with timeout.
453-
//
454-
// NOTE: we need to do this in a `wait` because it takes some time for
455-
// the node to update its internal state. Once the RPCs are synced we
456-
// can then remove this wait.
457-
err := wait.NoError(func() error {
458-
// Update the node's internal state.
459-
hn.UpdateState()
460-
461-
// Check the node is in a clean state for the following tests.
462-
return h.validateNodeState(hn)
463-
}, wait.DefaultTimeout)
464-
require.NoError(h, err, "timeout checking node's state")
465-
}
466-
467405
// removeConnectionns will remove all connections made on the standby nodes
468406
// expect the connections between Alice and Bob.
469407
func (h *HarnessTest) removeConnectionns(hn *node.HarnessNode) {
@@ -808,59 +746,6 @@ func (h *HarnessTest) SetMinRelayFeerate(fee chainfee.SatPerKVByte) {
808746
h.feeService.SetMinRelayFeerate(fee)
809747
}
810748

811-
// validateNodeState checks that the node doesn't have any uncleaned states
812-
// which will affect its following tests.
813-
func (h *HarnessTest) validateNodeState(hn *node.HarnessNode) error {
814-
errStr := func(subject string) error {
815-
return fmt.Errorf("%s: found %s channels, please close "+
816-
"them properly", hn.Name(), subject)
817-
}
818-
// If the node still has open channels, it's most likely that the
819-
// current test didn't close it properly.
820-
if hn.State.OpenChannel.Active != 0 {
821-
return errStr("active")
822-
}
823-
if hn.State.OpenChannel.Public != 0 {
824-
return errStr("public")
825-
}
826-
if hn.State.OpenChannel.Private != 0 {
827-
return errStr("private")
828-
}
829-
if hn.State.OpenChannel.Pending != 0 {
830-
return errStr("pending open")
831-
}
832-
833-
// The number of pending force close channels should be zero.
834-
if hn.State.CloseChannel.PendingForceClose != 0 {
835-
return errStr("pending force")
836-
}
837-
838-
// The number of waiting close channels should be zero.
839-
if hn.State.CloseChannel.WaitingClose != 0 {
840-
return errStr("waiting close")
841-
}
842-
843-
// Ths number of payments should be zero.
844-
if hn.State.Payment.Total != 0 {
845-
return fmt.Errorf("%s: found uncleaned payments, please "+
846-
"delete all of them properly", hn.Name())
847-
}
848-
849-
// The number of public edges should be zero.
850-
if hn.State.Edge.Public != 0 {
851-
return fmt.Errorf("%s: found active public egdes, please "+
852-
"clean them properly", hn.Name())
853-
}
854-
855-
// The number of edges should be zero.
856-
if hn.State.Edge.Total != 0 {
857-
return fmt.Errorf("%s: found active edges, please "+
858-
"clean them properly", hn.Name())
859-
}
860-
861-
return nil
862-
}
863-
864749
// GetChanPointFundingTxid takes a channel point and converts it into a chain
865750
// hash.
866751
func (h *HarnessTest) GetChanPointFundingTxid(

lnwallet/channel_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9165,14 +9165,6 @@ func checkExpectedHtlcs(t *testing.T, actual []*paymentDescriptor,
91659165
}
91669166
}
91679167

9168-
// heights represents the heights on a payment descriptor.
9169-
type heights struct {
9170-
localAdd uint64
9171-
localRemove uint64
9172-
remoteAdd uint64
9173-
remoteRemove uint64
9174-
}
9175-
91769168
// TestChannelUnsignedAckedFailure tests that unsigned acked updates are
91779169
// properly restored after signing for them and disconnecting.
91789170
//

lnwallet/test_utils.go

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -510,15 +510,6 @@ func privkeyFromHex(keyHex string) (*btcec.PrivateKey, error) {
510510

511511
}
512512

513-
// blockFromHex parses a full Bitcoin block from a hex encoded string.
514-
func blockFromHex(blockHex string) (*btcutil.Block, error) {
515-
bytes, err := hex.DecodeString(blockHex)
516-
if err != nil {
517-
return nil, err
518-
}
519-
return btcutil.NewBlockFromBytes(bytes)
520-
}
521-
522513
// txFromHex parses a full Bitcoin transaction from a hex encoded string.
523514
func txFromHex(txHex string) (*btcutil.Tx, error) {
524515
bytes, err := hex.DecodeString(txHex)

lnwire/lnwire_test.go

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,19 +30,13 @@ var (
3030
"319d18e949ddfa2965fb6caa1bf0314f882d7")
3131
testSBytes, _ = hex.DecodeString("299105481d63e0f4bc2a" +
3232
"88121167221b6700d72a0ead154c03be696a292d24ae")
33-
testRScalar = new(btcec.ModNScalar)
34-
testSScalar = new(btcec.ModNScalar)
35-
_ = testRScalar.SetByteSlice(testRBytes)
36-
_ = testSScalar.SetByteSlice(testSBytes)
37-
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
38-
testSchnorrSigStr, _ = hex.DecodeString("04E7F9037658A92AFEB4F2" +
39-
"5BAE5339E3DDCA81A353493827D26F16D92308E49E2A25E9220867" +
40-
"8A2DF86970DA91B03A8AF8815A8A60498B358DAF560B347AA557")
41-
testSchnorrSig, _ = NewSigFromSchnorrRawSignature(testSchnorrSigStr)
33+
testRScalar = new(btcec.ModNScalar)
34+
testSScalar = new(btcec.ModNScalar)
35+
_ = testRScalar.SetByteSlice(testRBytes)
36+
_ = testSScalar.SetByteSlice(testSBytes)
37+
testSig = ecdsa.NewSignature(testRScalar, testSScalar)
4238
)
4339

44-
const letterBytes = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
45-
4640
// generateRandomBytes returns a slice of n random bytes.
4741
func generateRandomBytes(n int) ([]byte, error) {
4842
b := make([]byte, n)

sweep/fee_bumper.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -412,11 +412,6 @@ func NewTxPublisher(cfg TxPublisherConfig) *TxPublisher {
412412
return tp
413413
}
414414

415-
// isNeutrinoBackend checks if the wallet backend is neutrino.
416-
func (t *TxPublisher) isNeutrinoBackend() bool {
417-
return t.cfg.Wallet.BackEnd() == "neutrino"
418-
}
419-
420415
// Broadcast is used to publish the tx created from the given inputs. It will
421416
// register the broadcast request and return a chan to the caller to subscribe
422417
// the broadcast result. The initial broadcast is guaranteed to be

sweep/test_utils.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313

1414
var (
1515
defaultTestTimeout = 5 * time.Second
16-
processingDelay = 1 * time.Second
1716
mockChainHash, _ = chainhash.NewHashFromStr("00aabbccddeeff")
1817
mockChainHeight = int32(100)
1918
)

watchtower/wtclient/session_queue.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,6 @@ type sessionQueueConfig struct {
9898
type sessionQueue struct {
9999
started sync.Once
100100
stopped sync.Once
101-
forced sync.Once
102101

103102
cfg *sessionQueueConfig
104103
log btclog.Logger

0 commit comments

Comments
 (0)