mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-03-13 02:58:33 +01:00
Merge branch 'v0-16-1-branch-rc1-7603' into v0-16-1-branch-rc1
This commit is contained in:
commit
70bad093a9
4 changed files with 36 additions and 1 deletions
|
@ -74,6 +74,8 @@ https://github.com/lightningnetwork/lnd/pull/7359)
|
||||||
* [Fix a bug where lnd crashes when psbt data is not fully
|
* [Fix a bug where lnd crashes when psbt data is not fully
|
||||||
available](https://github.com/lightningnetwork/lnd/pull/7529).
|
available](https://github.com/lightningnetwork/lnd/pull/7529).
|
||||||
|
|
||||||
|
* [Put back P2TR as default change type
|
||||||
|
in batch_open_channel](https://github.com/lightningnetwork/lnd/pull/7603).
|
||||||
|
|
||||||
# Contributors (Alphabetical Order)
|
# Contributors (Alphabetical Order)
|
||||||
|
|
||||||
|
@ -81,6 +83,7 @@ available](https://github.com/lightningnetwork/lnd/pull/7529).
|
||||||
* Elle Mouton
|
* Elle Mouton
|
||||||
* hieblmi
|
* hieblmi
|
||||||
* Oliver Gugger
|
* Oliver Gugger
|
||||||
|
* Pierre Beugnet
|
||||||
* Tommy Volk
|
* Tommy Volk
|
||||||
* Yong Yu
|
* Yong Yu
|
||||||
* ziggie1984
|
* ziggie1984
|
|
@ -320,6 +320,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
||||||
// anyway.
|
// anyway.
|
||||||
firstReq := b.channels[0].fundingReq
|
firstReq := b.channels[0].fundingReq
|
||||||
feeRateSatPerKVByte := firstReq.FundingFeePerKw.FeePerKVByte()
|
feeRateSatPerKVByte := firstReq.FundingFeePerKw.FeePerKVByte()
|
||||||
|
changeType := walletrpc.ChangeAddressType_CHANGE_ADDRESS_TYPE_P2TR
|
||||||
fundPsbtReq := &walletrpc.FundPsbtRequest{
|
fundPsbtReq := &walletrpc.FundPsbtRequest{
|
||||||
Template: &walletrpc.FundPsbtRequest_Raw{
|
Template: &walletrpc.FundPsbtRequest_Raw{
|
||||||
Raw: txTemplate,
|
Raw: txTemplate,
|
||||||
|
@ -329,6 +330,7 @@ func (b *Batcher) BatchFund(ctx context.Context,
|
||||||
},
|
},
|
||||||
MinConfs: firstReq.MinConfs,
|
MinConfs: firstReq.MinConfs,
|
||||||
SpendUnconfirmed: firstReq.MinConfs == 0,
|
SpendUnconfirmed: firstReq.MinConfs == 0,
|
||||||
|
ChangeType: changeType,
|
||||||
}
|
}
|
||||||
fundPsbtResp, err := b.cfg.WalletKitServer.FundPsbt(ctx, fundPsbtReq)
|
fundPsbtResp, err := b.cfg.WalletKitServer.FundPsbt(ctx, fundPsbtReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/btcsuite/btcd/btcutil"
|
"github.com/btcsuite/btcd/btcutil"
|
||||||
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
"github.com/btcsuite/btcd/chaincfg/chainhash"
|
||||||
|
"github.com/btcsuite/btcd/txscript"
|
||||||
"github.com/btcsuite/btcd/wire"
|
"github.com/btcsuite/btcd/wire"
|
||||||
"github.com/lightningnetwork/lnd/funding"
|
"github.com/lightningnetwork/lnd/funding"
|
||||||
"github.com/lightningnetwork/lnd/input"
|
"github.com/lightningnetwork/lnd/input"
|
||||||
|
@ -777,6 +778,21 @@ func testBatchChanFunding(ht *lntest.HarnessTest) {
|
||||||
ht.AssertTopologyChannelOpen(alice, chanPoint2)
|
ht.AssertTopologyChannelOpen(alice, chanPoint2)
|
||||||
ht.AssertTopologyChannelOpen(alice, chanPoint3)
|
ht.AssertTopologyChannelOpen(alice, chanPoint3)
|
||||||
|
|
||||||
|
// Check if the change type from the batch_open_channel funding is P2TR.
|
||||||
|
rawTx := ht.Miner.GetRawTransaction(txHash)
|
||||||
|
require.Len(ht, rawTx.MsgTx().TxOut, 4)
|
||||||
|
|
||||||
|
// For calculating the change output index we use the formula for the
|
||||||
|
// sum of consecutive of integers (n(n+1)/2). All the channel point
|
||||||
|
// indexes are known, so we just calculate the difference to get the
|
||||||
|
// change output index.
|
||||||
|
changeIndex := uint32(6) - (chanPoint1.OutputIndex +
|
||||||
|
chanPoint2.OutputIndex + chanPoint3.OutputIndex)
|
||||||
|
|
||||||
|
ht.AssertOutputScriptClass(
|
||||||
|
rawTx, changeIndex, txscript.WitnessV1TaprootTy,
|
||||||
|
)
|
||||||
|
|
||||||
// With the channel open, ensure that it is counted towards Alice's
|
// With the channel open, ensure that it is counted towards Alice's
|
||||||
// total channel balance.
|
// total channel balance.
|
||||||
balRes := alice.RPC.ChannelBalance()
|
balRes := alice.RPC.ChannelBalance()
|
||||||
|
|
|
@ -377,6 +377,20 @@ func (h *HarnessTest) AssertChannelExists(hn *node.HarnessNode,
|
||||||
return channel
|
return channel
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// AssertOutputScriptClass checks that the specified transaction output has the
|
||||||
|
// expected script class.
|
||||||
|
func (h *HarnessTest) AssertOutputScriptClass(tx *btcutil.Tx,
|
||||||
|
outputIndex uint32, scriptClass txscript.ScriptClass) {
|
||||||
|
|
||||||
|
require.Greater(h, len(tx.MsgTx().TxOut), int(outputIndex))
|
||||||
|
|
||||||
|
txOut := tx.MsgTx().TxOut[outputIndex]
|
||||||
|
|
||||||
|
pkScript, err := txscript.ParsePkScript(txOut.PkScript)
|
||||||
|
require.NoError(h, err)
|
||||||
|
require.Equal(h, pkScript.Class(), scriptClass)
|
||||||
|
}
|
||||||
|
|
||||||
// findChannel tries to find a target channel in the node using the given
|
// findChannel tries to find a target channel in the node using the given
|
||||||
// channel point.
|
// channel point.
|
||||||
func (h *HarnessTest) findChannel(hn *node.HarnessNode,
|
func (h *HarnessTest) findChannel(hn *node.HarnessNode,
|
||||||
|
|
Loading…
Add table
Reference in a new issue