multi: move Input interface and related code
This commit is a step to split the lnwallet package. It puts the Input interface and implementations in a separate package along with all their dependencies from lnwallet.
This commit is contained in:
66 files changed
+811
-689
No files matched your search
+11
-10
@@ -35,6 +35,7 @@ import (
|
||||
"github.com/lightningnetwork/lnd/chainntnfs"
|
||||
"github.com/lightningnetwork/lnd/chainntnfs/btcdnotify"
|
||||
"github.com/lightningnetwork/lnd/channeldb"
|
||||
"github.com/lightningnetwork/lnd/input"
|
||||
"github.com/lightningnetwork/lnd/keychain"
|
||||
"github.com/lightningnetwork/lnd/lnwallet"
|
||||
"github.com/lightningnetwork/lnd/lnwallet/btcwallet"
|
||||
@@ -353,7 +354,7 @@ func loadTestCredits(miner *rpctest.Harness, w *lnwallet.LightningWallet,
|
||||
func createTestWallet(tempTestDir string, miningNode *rpctest.Harness,
|
||||
netParams *chaincfg.Params, notifier chainntnfs.ChainNotifier,
|
||||
wc lnwallet.WalletController, keyRing keychain.SecretKeyRing,
|
||||
signer lnwallet.Signer, bio lnwallet.BlockChainIO) (*lnwallet.LightningWallet, error) {
|
||||
signer input.Signer, bio lnwallet.BlockChainIO) (*lnwallet.LightningWallet, error) {
|
||||
|
||||
dbDir := filepath.Join(tempTestDir, "cdb")
|
||||
cdb, err := channeldb.Open(dbDir)
|
||||
@@ -434,7 +435,7 @@ func testDualFundingReservationWorkflow(miner *rpctest.Harness,
|
||||
ChanReserve: fundingAmount / 100,
|
||||
MaxPendingAmount: lnwire.NewMSatFromSatoshis(fundingAmount),
|
||||
MinHTLC: 1,
|
||||
MaxAcceptedHtlcs: lnwallet.MaxHTLCNumber / 2,
|
||||
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
|
||||
CsvDelay: csvDelay,
|
||||
}
|
||||
err = aliceChanReservation.CommitConstraints(channelConstraints)
|
||||
@@ -866,7 +867,7 @@ func testSingleFunderReservationWorkflow(miner *rpctest.Harness,
|
||||
ChanReserve: fundingAmt / 100,
|
||||
MaxPendingAmount: lnwire.NewMSatFromSatoshis(fundingAmt),
|
||||
MinHTLC: 1,
|
||||
MaxAcceptedHtlcs: lnwallet.MaxHTLCNumber / 2,
|
||||
MaxAcceptedHtlcs: input.MaxHTLCNumber / 2,
|
||||
CsvDelay: csvDelay,
|
||||
}
|
||||
err = aliceChanReservation.CommitConstraints(channelConstraints)
|
||||
@@ -1528,7 +1529,7 @@ func testPublishTransaction(r *rpctest.Harness,
|
||||
|
||||
// Now we can populate the sign descriptor which we'll use to
|
||||
// generate the signature.
|
||||
signDesc := &lnwallet.SignDescriptor{
|
||||
signDesc := &input.SignDescriptor{
|
||||
KeyDesc: keychain.KeyDescriptor{
|
||||
PubKey: pubKey.PubKey,
|
||||
},
|
||||
@@ -1783,10 +1784,10 @@ func testSignOutputUsingTweaks(r *rpctest.Harness,
|
||||
commitSecret, commitPoint := btcec.PrivKeyFromBytes(btcec.S256(),
|
||||
commitPreimage)
|
||||
|
||||
revocationKey := lnwallet.DeriveRevocationPubkey(pubKey.PubKey, commitPoint)
|
||||
commitTweak := lnwallet.SingleTweakBytes(commitPoint, pubKey.PubKey)
|
||||
revocationKey := input.DeriveRevocationPubkey(pubKey.PubKey, commitPoint)
|
||||
commitTweak := input.SingleTweakBytes(commitPoint, pubKey.PubKey)
|
||||
|
||||
tweakedPub := lnwallet.TweakPubKey(pubKey.PubKey, commitPoint)
|
||||
tweakedPub := input.TweakPubKey(pubKey.PubKey, commitPoint)
|
||||
|
||||
// As we'd like to test both single and double tweaks, we'll repeat
|
||||
// the same set up twice. The first will use a regular single tweak,
|
||||
@@ -1856,7 +1857,7 @@ func testSignOutputUsingTweaks(r *rpctest.Harness,
|
||||
// private tweak value as the key in the script is derived
|
||||
// based on this tweak value and the key we originally
|
||||
// generated above.
|
||||
signDesc := &lnwallet.SignDescriptor{
|
||||
signDesc := &input.SignDescriptor{
|
||||
KeyDesc: keychain.KeyDescriptor{
|
||||
PubKey: baseKey.PubKey,
|
||||
},
|
||||
@@ -2392,8 +2393,8 @@ func runTests(t *testing.T, walletDriver *lnwallet.WalletDriver,
|
||||
var (
|
||||
bio lnwallet.BlockChainIO
|
||||
|
||||
aliceSigner lnwallet.Signer
|
||||
bobSigner lnwallet.Signer
|
||||
aliceSigner input.Signer
|
||||
bobSigner input.Signer
|
||||
|
||||
aliceKeyRing keychain.SecretKeyRing
|
||||
bobKeyRing keychain.SecretKeyRing
|
||||
|
||||
Reference in new issue
Block a user