mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-12 10:30:40 +01:00
Merge branch 'v0-16-3-branch-7681' into v0-16-3-branch
This commit is contained in:
commit
b26be81c7a
7 changed files with 56 additions and 19 deletions
10
docs/release-notes/release-notes-0.16.3.md
Normal file
10
docs/release-notes/release-notes-0.16.3.md
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
# Release Notes
|
||||||
|
|
||||||
|
## Mempool
|
||||||
|
|
||||||
|
Optimized [mempool
|
||||||
|
management](https://github.com/lightningnetwork/lnd/pull/7681) to lower the CPU
|
||||||
|
usage.
|
||||||
|
|
||||||
|
# Contributors (Alphabetical Order)
|
||||||
|
* Yong Yu
|
2
go.mod
2
go.mod
|
@ -9,7 +9,7 @@ require (
|
||||||
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
|
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
|
||||||
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2
|
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
|
||||||
github.com/btcsuite/btcwallet v0.16.9
|
github.com/btcsuite/btcwallet v0.16.10-0.20230517173256-aa62c04afcdf
|
||||||
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2
|
||||||
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
|
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
|
||||||
github.com/btcsuite/btcwallet/walletdb v1.4.0
|
github.com/btcsuite/btcwallet/walletdb v1.4.0
|
||||||
|
|
4
go.sum
4
go.sum
|
@ -89,8 +89,8 @@ github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2/go.mod h1:7SFka0XMvUgj3hfZtyd
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
||||||
github.com/btcsuite/btcwallet v0.16.9 h1:hLAzEJvsiSn+r6j374G7ThnrYD/toa+Lv7l1Rm6+0oM=
|
github.com/btcsuite/btcwallet v0.16.10-0.20230517173256-aa62c04afcdf h1:YRY292S4axfeDPJrZYkDq4+JaRhaPvjMueZ65evmUfc=
|
||||||
github.com/btcsuite/btcwallet v0.16.9/go.mod h1:T3DjEAMZYIqQ28l+ixlB6DX4mFJXCX8Pzz+yACQcLsc=
|
github.com/btcsuite/btcwallet v0.16.10-0.20230517173256-aa62c04afcdf/go.mod h1:T3DjEAMZYIqQ28l+ixlB6DX4mFJXCX8Pzz+yACQcLsc=
|
||||||
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 h1:etuLgGEojecsDOYTII8rYiGHjGyV5xTqsXi+ZQ715UU=
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2 h1:etuLgGEojecsDOYTII8rYiGHjGyV5xTqsXi+ZQ715UU=
|
||||||
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2/go.mod h1:Zpk/LOb2sKqwP2lmHjaZT9AdaKsHPSbNLm2Uql5IQ/0=
|
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2/go.mod h1:Zpk/LOb2sKqwP2lmHjaZT9AdaKsHPSbNLm2Uql5IQ/0=
|
||||||
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg=
|
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg=
|
||||||
|
|
|
@ -296,6 +296,9 @@ func (m *mppTestScenario) openChannels(r *mppOpenChannelRequest) {
|
||||||
for _, cp := range m.channelPoints {
|
for _, cp := range m.channelPoints {
|
||||||
m.ht.AssertTopologyChannelOpen(hn, cp)
|
m.ht.AssertTopologyChannelOpen(hn, cp)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Each node should have exactly 6 edges.
|
||||||
|
m.ht.AssertNumEdges(hn, len(m.channelPoints), false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1940,23 +1940,52 @@ func runExtraPreimageFromRemoteCommit(ht *lntest.HarnessTest,
|
||||||
numBlocks = htlc.ExpirationHeight - uint32(height) -
|
numBlocks = htlc.ExpirationHeight - uint32(height) -
|
||||||
lncfg.DefaultOutgoingBroadcastDelta
|
lncfg.DefaultOutgoingBroadcastDelta
|
||||||
|
|
||||||
// Mine empty blocks so Carol's htlc success tx stays in mempool. Once
|
// We should now have Carol's htlc suucess tx in the mempool.
|
||||||
// the height is reached, Bob's timeout resolver will resolve the htlc
|
numTxesMempool := 1
|
||||||
// by extracing the preimage from the mempool.
|
|
||||||
ht.MineEmptyBlocks(int(numBlocks))
|
|
||||||
|
|
||||||
// For neutrino backend, the timeout resolver needs to extract the
|
// For neutrino backend, the timeout resolver needs to extract the
|
||||||
// preimage from the blocks.
|
// preimage from the blocks.
|
||||||
if ht.IsNeutrinoBackend() {
|
if ht.IsNeutrinoBackend() {
|
||||||
// Mine a block to confirm Carol's 2nd level success tx.
|
// Mine a block to confirm Carol's 2nd level success tx.
|
||||||
ht.MineBlocksAndAssertNumTxes(1, 1)
|
ht.MineBlocksAndAssertNumTxes(1, 1)
|
||||||
|
numTxesMempool--
|
||||||
}
|
}
|
||||||
|
// Mine empty blocks so Carol's htlc success tx stays in mempool. Once
|
||||||
|
// the height is reached, Bob's timeout resolver will resolve the htlc
|
||||||
|
// by extracing the preimage from the mempool.
|
||||||
|
ht.MineEmptyBlocks(int(numBlocks))
|
||||||
|
|
||||||
// Finally, check that the Alice's payment is marked as succeeded as
|
// Finally, check that the Alice's payment is marked as succeeded as
|
||||||
// Bob has settled the htlc using the preimage extracted from Carol's
|
// Bob has settled the htlc using the preimage extracted from Carol's
|
||||||
// 2nd level success tx.
|
// 2nd level success tx.
|
||||||
ht.AssertPaymentStatus(alice, preimage, lnrpc.Payment_SUCCEEDED)
|
ht.AssertPaymentStatus(alice, preimage, lnrpc.Payment_SUCCEEDED)
|
||||||
|
|
||||||
|
switch c {
|
||||||
|
// For non-anchor channel type, we should expect to see Bob's commit
|
||||||
|
// sweep in the mempool.
|
||||||
|
case lnrpc.CommitmentType_LEGACY:
|
||||||
|
numTxesMempool++
|
||||||
|
|
||||||
|
// For non-anchor channel type, we should expect to see Bob's commit
|
||||||
|
// sweep and his anchor sweep tx in the mempool.
|
||||||
|
case lnrpc.CommitmentType_ANCHORS:
|
||||||
|
numTxesMempool += 2
|
||||||
|
|
||||||
|
// For script-enforced leased channel, we should expect to see Bob's
|
||||||
|
// anchor sweep tx in the mempool.
|
||||||
|
case lnrpc.CommitmentType_SCRIPT_ENFORCED_LEASE:
|
||||||
|
numTxesMempool++
|
||||||
|
|
||||||
|
// For neutrino backend, because of the additional block mined,
|
||||||
|
// Bob's output is now mature.
|
||||||
|
if ht.IsNeutrinoBackend() {
|
||||||
|
numTxesMempool++
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Mine a block to clean the mempool.
|
||||||
|
ht.MineBlocksAndAssertNumTxes(1, numTxesMempool)
|
||||||
|
|
||||||
// NOTE: for non-standby nodes there's no need to clean up the force
|
// NOTE: for non-standby nodes there's no need to clean up the force
|
||||||
// close as long as the mempool is cleaned.
|
// close as long as the mempool is cleaned.
|
||||||
ht.CleanShutDown()
|
ht.CleanShutDown()
|
||||||
|
|
|
@ -264,6 +264,7 @@ func testSwitchOfflineDeliveryOutgoingOffline(ht *lntest.HarnessTest) {
|
||||||
// three channels. Note that we won't call the cleanUp function here as
|
// three channels. Note that we won't call the cleanUp function here as
|
||||||
// we will manually stop the node Carol and her channel.
|
// we will manually stop the node Carol and her channel.
|
||||||
s := setupScenarioFourNodes(ht)
|
s := setupScenarioFourNodes(ht)
|
||||||
|
defer s.cleanUp()
|
||||||
|
|
||||||
// Disconnect the two intermediaries, Alice and Dave, so that when carol
|
// Disconnect the two intermediaries, Alice and Dave, so that when carol
|
||||||
// restarts, the response will be held by Dave.
|
// restarts, the response will be held by Dave.
|
||||||
|
@ -296,7 +297,7 @@ func testSwitchOfflineDeliveryOutgoingOffline(ht *lntest.HarnessTest) {
|
||||||
// Shutdown carol and leave her offline for the rest of the test. This
|
// Shutdown carol and leave her offline for the rest of the test. This
|
||||||
// is critical, as we wish to see if Dave can propragate settles even if
|
// is critical, as we wish to see if Dave can propragate settles even if
|
||||||
// the outgoing link is never revived.
|
// the outgoing link is never revived.
|
||||||
ht.Shutdown(s.carol)
|
restartCarol := ht.SuspendNode(s.carol)
|
||||||
|
|
||||||
// Now restart Dave, ensuring he is both persisting the settles, and is
|
// Now restart Dave, ensuring he is both persisting the settles, and is
|
||||||
// able to reforward them to Alice after recovering from a restart.
|
// able to reforward them to Alice after recovering from a restart.
|
||||||
|
@ -339,8 +340,8 @@ func testSwitchOfflineDeliveryOutgoingOffline(ht *lntest.HarnessTest) {
|
||||||
amountPaid+(baseFee*numPayments)*2, int64(0),
|
amountPaid+(baseFee*numPayments)*2, int64(0),
|
||||||
)
|
)
|
||||||
|
|
||||||
ht.CloseChannel(s.alice, s.chanPointAliceBob)
|
// Finally, restart Carol so the cleanup process can be finished.
|
||||||
ht.CloseChannel(s.dave, s.chanPointDaveAlice)
|
require.NoError(ht, restartCarol())
|
||||||
}
|
}
|
||||||
|
|
||||||
// scenarioFourNodes specifies a scenario which we have a topology that has
|
// scenarioFourNodes specifies a scenario which we have a topology that has
|
||||||
|
|
|
@ -1632,18 +1632,12 @@ func (h *HarnessTest) cleanMempool() {
|
||||||
blocks := h.Miner.MineBlocksSlow(1)
|
blocks := h.Miner.MineBlocksSlow(1)
|
||||||
bestBlock = blocks[len(blocks)-1]
|
bestBlock = blocks[len(blocks)-1]
|
||||||
|
|
||||||
|
// Make sure all the active nodes are synced.
|
||||||
|
h.AssertActiveNodesSyncedTo(bestBlock)
|
||||||
|
|
||||||
return fmt.Errorf("still have %d txes in mempool", len(mem))
|
return fmt.Errorf("still have %d txes in mempool", len(mem))
|
||||||
}, wait.MinerMempoolTimeout)
|
}, wait.MinerMempoolTimeout)
|
||||||
require.NoError(h, err, "timeout cleaning up mempool")
|
require.NoError(h, err, "timeout cleaning up mempool")
|
||||||
|
|
||||||
// Exit early if the best block is nil, which means we haven't mined
|
|
||||||
// any blocks during the cleanup.
|
|
||||||
if bestBlock == nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
// Make sure all the active nodes are synced.
|
|
||||||
h.AssertActiveNodesSyncedTo(bestBlock)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// CleanShutDown is used to quickly end a test by shutting down all non-standby
|
// CleanShutDown is used to quickly end a test by shutting down all non-standby
|
||||||
|
|
Loading…
Add table
Reference in a new issue