Merge pull request #2329 from Roasbeef/global-sig-pool
multi: replace per channel sigPool with global daemon level sigPool
This commit is contained in:
14 files changed
+239
-286
No files matched your search
@@ -443,7 +443,6 @@ func (l *channelLink) Stop() {
|
||||
}
|
||||
|
||||
l.updateFeeTimer.Stop()
|
||||
l.channel.Stop()
|
||||
l.overflowQueue.Stop()
|
||||
|
||||
close(l.quit)
|
||||
|
||||
@@ -1592,8 +1592,6 @@ func newSingleLinkTestHarness(chanAmt, chanReserve btcutil.Amount) (
|
||||
cleanUp := func() {
|
||||
close(alicePeer.quit)
|
||||
defer fCleanUp()
|
||||
defer aliceLink.Stop()
|
||||
defer bobChannel.Stop()
|
||||
}
|
||||
|
||||
return aliceLink, bobChannel, bticker.Force, start, cleanUp, restore, nil
|
||||
|
||||
@@ -10,6 +10,7 @@ import (
|
||||
"math/big"
|
||||
"net"
|
||||
"os"
|
||||
"runtime"
|
||||
"sync/atomic"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -369,18 +370,23 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
|
||||
preimageMap: make(map[[32]byte][]byte),
|
||||
}
|
||||
|
||||
alicePool := lnwallet.NewSigPool(runtime.NumCPU(), aliceSigner)
|
||||
channelAlice, err := lnwallet.NewLightningChannel(
|
||||
aliceSigner, pCache, aliceChannelState,
|
||||
aliceSigner, pCache, aliceChannelState, alicePool,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
}
|
||||
alicePool.Start()
|
||||
|
||||
bobPool := lnwallet.NewSigPool(runtime.NumCPU(), bobSigner)
|
||||
channelBob, err := lnwallet.NewLightningChannel(
|
||||
bobSigner, pCache, bobChannelState,
|
||||
bobSigner, pCache, bobChannelState, bobPool,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, nil, nil, err
|
||||
}
|
||||
bobPool.Start()
|
||||
|
||||
// Now that the channel are open, simulate the start of a session by
|
||||
// having Alice and Bob extend their revocation windows to each other.
|
||||
@@ -402,6 +408,7 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
|
||||
|
||||
restore := func() (*lnwallet.LightningChannel, *lnwallet.LightningChannel,
|
||||
error) {
|
||||
|
||||
aliceStoredChannels, err := dbAlice.FetchOpenChannels(aliceKeyPub)
|
||||
switch err {
|
||||
case nil:
|
||||
@@ -434,8 +441,9 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
|
||||
return nil, nil, errors.New("unable to find stored alice channel")
|
||||
}
|
||||
|
||||
newAliceChannel, err := lnwallet.NewLightningChannel(aliceSigner,
|
||||
nil, aliceStoredChannel)
|
||||
newAliceChannel, err := lnwallet.NewLightningChannel(
|
||||
aliceSigner, nil, aliceStoredChannel, alicePool,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Errorf("unable to create new channel: %v",
|
||||
err)
|
||||
@@ -473,8 +481,9 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
|
||||
return nil, nil, errors.New("unable to find stored bob channel")
|
||||
}
|
||||
|
||||
newBobChannel, err := lnwallet.NewLightningChannel(bobSigner,
|
||||
nil, bobStoredChannel)
|
||||
newBobChannel, err := lnwallet.NewLightningChannel(
|
||||
bobSigner, nil, bobStoredChannel, bobPool,
|
||||
)
|
||||
if err != nil {
|
||||
return nil, nil, errors.Errorf("unable to create new channel: %v",
|
||||
err)
|
||||
@@ -485,7 +494,7 @@ func createTestChannel(alicePrivKey, bobPrivKey []byte,
|
||||
return channelAlice, channelBob, cleanUpFunc, restore, nil
|
||||
}
|
||||
|
||||
// getChanID retrieves the channel point from nwire message.
|
||||
// getChanID retrieves the channel point from an lnnwire message.
|
||||
func getChanID(msg lnwire.Message) (lnwire.ChannelID, error) {
|
||||
var chanID lnwire.ChannelID
|
||||
switch msg := msg.(type) {
|
||||
|
||||
Reference in new issue
Block a user