diff --git a/channeldb/payments_test.go b/channeldb/payments_test.go index b2a0292a49..cbc2b1a9d0 100644 --- a/channeldb/payments_test.go +++ b/channeldb/payments_test.go @@ -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, diff --git a/contractcourt/channel_arbitrator.go b/contractcourt/channel_arbitrator.go index feb4bf35f6..1cc1460fac 100644 --- a/contractcourt/channel_arbitrator.go +++ b/contractcourt/channel_arbitrator.go @@ -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: diff --git a/contractcourt/contract_resolver.go b/contractcourt/contract_resolver.go index d11bd2f597..055d633d03 100644 --- a/contractcourt/contract_resolver.go +++ b/contractcourt/contract_resolver.go @@ -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 diff --git a/contractcourt/utxonursery.go b/contractcourt/utxonursery.go index f78be9fa49..d68a228acf 100644 --- a/contractcourt/utxonursery.go +++ b/contractcourt/utxonursery.go @@ -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. diff --git a/graph/notifications_test.go b/graph/notifications_test.go index 0e2ec7afba..b89ae3ff75 100644 --- a/graph/notifications_test.go +++ b/graph/notifications_test.go @@ -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() diff --git a/htlcswitch/mock.go b/htlcswitch/mock.go index cb814e95c5..8f9f319fa3 100644 --- a/htlcswitch/mock.go +++ b/htlcswitch/mock.go @@ -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 diff --git a/internal/musig2v040/bench_test.go b/internal/musig2v040/bench_test.go index 21e014e2f8..720f59da00 100644 --- a/internal/musig2v040/bench_test.go +++ b/internal/musig2v040/bench_test.go @@ -14,8 +14,6 @@ import ( ) var ( - testPrivBytes = hexToModNScalar("9e0699c91ca1e3b7e3c9ba71eb71c89890872be97576010fe593fbf3fd57e66d") - testMsg = hexToBytes("c301ba9de5d6053caad9f5eb46523f007702add2c62fa39de03146a36b8026b7") ) @@ -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 { diff --git a/internal/musig2v040/musig2_test.go b/internal/musig2v040/musig2_test.go index 42e84c7818..285ae38c8e 100644 --- a/internal/musig2v040/musig2_test.go +++ b/internal/musig2v040/musig2_test.go @@ -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" + @@ -306,9 +290,6 @@ var ( signSetKey3 = mustParseHex("DFF1D77F2A671C5F36183726DB2341BE58FEAE1DA" + "2DECED843240F7B502BA659") - invalidSetKey1 = mustParseHex("00000000000000000000000000000000" + - "00000000000000000000000000000007") - signExpected1 = mustParseHex("68537CC5234E505BD14061F8DA9E90C220A1818" + "55FD8BDB7F127BB12403B4D3B") signExpected2 = mustParseHex("2DF67BFFF18E3DE797E13C6475C963048138DAE" + diff --git a/internal/musig2v040/nonces.go b/internal/musig2v040/nonces.go index 86ca683186..3484fb58eb 100644 --- a/internal/musig2v040/nonces.go +++ b/internal/musig2v040/nonces.go @@ -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? diff --git a/lntest/harness.go b/lntest/harness.go index 4b12c8cf63..c68cf0d535 100644 --- a/lntest/harness.go +++ b/lntest/harness.go @@ -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 @@ -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. @@ -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) { @@ -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( diff --git a/lnwallet/channel_test.go b/lnwallet/channel_test.go index 0a0ca261c0..07a9c2f196 100644 --- a/lnwallet/channel_test.go +++ b/lnwallet/channel_test.go @@ -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. // diff --git a/lnwallet/test_utils.go b/lnwallet/test_utils.go index 738558e224..37b3f23262 100644 --- a/lnwallet/test_utils.go +++ b/lnwallet/test_utils.go @@ -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) diff --git a/lnwire/lnwire_test.go b/lnwire/lnwire_test.go index 7f068e526d..328e05b7de 100644 --- a/lnwire/lnwire_test.go +++ b/lnwire/lnwire_test.go @@ -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) diff --git a/sweep/fee_bumper.go b/sweep/fee_bumper.go index 1602165ea5..5941cd20de 100644 --- a/sweep/fee_bumper.go +++ b/sweep/fee_bumper.go @@ -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 diff --git a/sweep/test_utils.go b/sweep/test_utils.go index bd4b91bee0..afbee39f6a 100644 --- a/sweep/test_utils.go +++ b/sweep/test_utils.go @@ -13,7 +13,6 @@ import ( var ( defaultTestTimeout = 5 * time.Second - processingDelay = 1 * time.Second mockChainHash, _ = chainhash.NewHashFromStr("00aabbccddeeff") mockChainHeight = int32(100) ) diff --git a/watchtower/wtclient/session_queue.go b/watchtower/wtclient/session_queue.go index 4ee1597637..05ebf95f87 100644 --- a/watchtower/wtclient/session_queue.go +++ b/watchtower/wtclient/session_queue.go @@ -98,7 +98,6 @@ type sessionQueueConfig struct { type sessionQueue struct { started sync.Once stopped sync.Once - forced sync.Once cfg *sessionQueueConfig log btclog.Logger