Skip to content

Commit

Permalink
Merge pull request #8138 from Roasbeef/v0-17-1-branch-rc1
Browse files Browse the repository at this point in the history
build: create v0.17.1-rc1 branch
  • Loading branch information
Roasbeef authored Nov 1, 2023
2 parents 2fb150c + 155f66b commit 710545b
Show file tree
Hide file tree
Showing 42 changed files with 1,163 additions and 190 deletions.
4 changes: 2 additions & 2 deletions build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ const (
AppMinor uint = 17

// AppPatch defines the application patch for this binary.
AppPatch uint = 0
AppPatch uint = 1

// AppPreRelease MUST only contain characters from semanticAlphabet per
// the semantic versioning spec.
AppPreRelease = "beta"
AppPreRelease = "beta.rc1"
)

func init() {
Expand Down
40 changes: 40 additions & 0 deletions cmd/lncli/chainrpc_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func chainCommands() []cli.Command {
getBlockCommand,
getBestBlockCommand,
getBlockHashCommand,
getBlockHeaderCommand,
},
},
}
Expand Down Expand Up @@ -113,6 +114,45 @@ func getBlock(ctx *cli.Context) error {
return nil
}

var getBlockHeaderCommand = cli.Command{
Name: "getblockheader",
Usage: "Get a block header.",
Category: "On-chain",
Description: "Returns a block header with a particular block hash.",
ArgsUsage: "hash",
Action: actionDecorator(getBlockHeader),
}

func getBlockHeader(ctx *cli.Context) error {
ctxc := getContext()
args := ctx.Args()

// Display the command's help message if we do not have the expected
// number of arguments/flags.
if !args.Present() {
return cli.ShowCommandHelp(ctx, "getblockheader")
}

blockHash, err := chainhash.NewHashFromStr(args.First())
if err != nil {
return err
}

req := &chainrpc.GetBlockHeaderRequest{BlockHash: blockHash[:]}

client, cleanUp := getChainClient(ctx)
defer cleanUp()

resp, err := client.GetBlockHeader(ctxc, req)
if err != nil {
return err
}

printRespJSON(resp)

return nil
}

var getBestBlockCommand = cli.Command{
Name: "getbestblock",
Category: "On-chain",
Expand Down
9 changes: 5 additions & 4 deletions cmd/lncli/commands.go
Original file line number Diff line number Diff line change
Expand Up @@ -620,7 +620,7 @@ func sendMany(ctx *cli.Context) error {
var connectCommand = cli.Command{
Name: "connect",
Category: "Peers",
Usage: "Connect to a remote lnd peer.",
Usage: "Connect to a remote lightning peer.",
ArgsUsage: "<pubkey>@host",
Description: `
Connect to a peer using its <pubkey> and host.
Expand Down Expand Up @@ -680,9 +680,10 @@ func connectPeer(ctx *cli.Context) error {
}

var disconnectCommand = cli.Command{
Name: "disconnect",
Category: "Peers",
Usage: "Disconnect a remote lnd peer identified by public key.",
Name: "disconnect",
Category: "Peers",
Usage: "Disconnect a remote lightning peer identified by " +
"public key.",
ArgsUsage: "<pubkey>",
Flags: []cli.Flag{
cli.StringFlag{
Expand Down
8 changes: 4 additions & 4 deletions cmd/lncli/neutrino_active.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,16 +155,16 @@ func isBanned(ctx *cli.Context) error {
return nil
}

var getBlockHeaderCommand = cli.Command{
var getBlockHeaderNeutrinoCommand = cli.Command{
Name: "getblockheader",
Usage: "Get a block header.",
Category: "Neutrino",
Description: "Returns a block header with a particular block hash.",
ArgsUsage: "hash",
Action: actionDecorator(getBlockHeader),
Action: actionDecorator(getBlockHeaderNeutrino),
}

func getBlockHeader(ctx *cli.Context) error {
func getBlockHeaderNeutrino(ctx *cli.Context) error {
ctxc := getContext()
args := ctx.Args()

Expand Down Expand Up @@ -239,7 +239,7 @@ func neutrinoCommands() []cli.Command {
addPeerCommand,
disconnectPeerCommand,
isBannedCommand,
getBlockHeaderCommand,
getBlockHeaderNeutrinoCommand,
getCFilterCommand,
},
},
Expand Down
37 changes: 27 additions & 10 deletions contractcourt/channel_arbitrator.go
Original file line number Diff line number Diff line change
Expand Up @@ -1309,9 +1309,23 @@ func (c *ChannelArbitrator) sweepAnchors(anchors *lnwallet.AnchorResolutions,
return err
}

// Create a force flag that's used to indicate whether we
// should force sweeping this anchor.
var force bool

// Check the deadline against the default value. If it's less
// than the default value of 144, it means there is a deadline
// and we will perform a CPFP for this commitment tx.
if deadline < anchorSweepConfTarget {
// Signal that this is a force sweep, so that the
// anchor will be swept even if it isn't economical
// purely based on the anchor value.
force = true
}

log.Debugf("ChannelArbitrator(%v): pre-confirmation sweep of "+
"anchor of %s commit tx %v", c.cfg.ChanPoint,
anchorPath, anchor.CommitAnchor)
"anchor of %s commit tx %v, force=%v", c.cfg.ChanPoint,
anchorPath, anchor.CommitAnchor, force)

witnessType := input.CommitmentAnchor

Expand All @@ -1337,20 +1351,17 @@ func (c *ChannelArbitrator) sweepAnchors(anchors *lnwallet.AnchorResolutions,
)

// Sweep anchor output with a confirmation target fee
// preference. Because this is a cpfp-operation, the anchor will
// only be attempted to sweep when the current fee estimate for
// the confirmation target exceeds the commit fee rate.
//
// Also signal that this is a force sweep, so that the anchor
// will be swept even if it isn't economical purely based on the
// anchor value.
// preference. Because this is a cpfp-operation, the anchor
// will only be attempted to sweep when the current fee
// estimate for the confirmation target exceeds the commit fee
// rate.
_, err = c.cfg.Sweeper.SweepInput(
&anchorInput,
sweep.Params{
Fee: sweep.FeePreference{
ConfTarget: deadline,
},
Force: true,
Force: force,
ExclusiveGroup: &exclusiveGroup,
},
)
Expand Down Expand Up @@ -1427,6 +1438,9 @@ func (c *ChannelArbitrator) findCommitmentDeadline(heightHint uint32,

if htlc.RefundTimeout < deadlineMinHeight {
deadlineMinHeight = htlc.RefundTimeout
log.Tracef("ChannelArbitrator(%v): outgoing HTLC has "+
"deadline: %v", c.cfg.ChanPoint,
deadlineMinHeight)
}
}

Expand Down Expand Up @@ -1455,6 +1469,9 @@ func (c *ChannelArbitrator) findCommitmentDeadline(heightHint uint32,

if htlc.RefundTimeout < deadlineMinHeight {
deadlineMinHeight = htlc.RefundTimeout
log.Tracef("ChannelArbitrator(%v): incoming HTLC has "+
"deadline: %v", c.cfg.ChanPoint,
deadlineMinHeight)
}
}

Expand Down
4 changes: 4 additions & 0 deletions contractcourt/channel_arbitrator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,10 @@ func (*mockChainIO) GetBlock(blockHash *chainhash.Hash) (*wire.MsgBlock, error)
return nil, nil
}

func (*mockChainIO) GetBlockHeader(*chainhash.Hash) (*wire.BlockHeader, error) {
return nil, nil
}

type chanArbTestCtx struct {
t *testing.T

Expand Down
76 changes: 76 additions & 0 deletions docs/release-notes/release-notes-0.17.1.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
# Release Notes
- [Bug Fixes](#bug-fixes)
- [New Features](#new-features)
- [Functional Enhancements](#functional-enhancements)
- [RPC Additions](#rpc-additions)
- [lncli Additions](#lncli-additions)
- [Improvements](#improvements)
- [Functional Updates](#functional-updates)
- [RPC Updates](#rpc-updates)
- [lncli Updates](#lncli-updates)
- [Breaking Changes](#breaking-changes)
- [Performance Improvements](#performance-improvements)
- [Technical and Architectural Updates](#technical-and-architectural-updates)
- [BOLT Spec Updates](#bolt-spec-updates)
- [Testing](#testing)
- [Database](#database)
- [Code Health](#code-health)
- [Tooling and Documentation](#tooling-and-documentation)

# Bug Fixes

* [LND now sets the `BADONION`](https://github.com/lightningnetwork/lnd/pull/7937)
bit when sending `update_fail_malformed_htlc`. This avoids a force close
with other implementations.

* A bug that would cause taproot channels to sometimes not display as active
[has been fixed](https://github.com/lightningnetwork/lnd/pull/8104).

* [`lnd` will now properly reject macaroons with unknown versions.](https://github.com/lightningnetwork/lnd/pull/8132)

# New Features
## Functional Enhancements

- Previously, when a channel was force closed locally, its anchor was always
force-swept when the CPFP requirements are met. This is now
[changed](https://github.com/lightningnetwork/lnd/pull/7965) to only attempt
CPFP based on the deadline of the commitment transaction. The anchor output
will still be offered to the sweeper during channel force close, while the
actual sweeping won't be forced(CPFP) unless a relevant HTLC will timeout in
144 blocks. If CPFP before this deadline is needed, user can use `BumpFee`
instead.

## RPC Additions

* [`chainrpc` `GetBlockHeader`](https://github.com/lightningnetwork/lnd/pull/8111)
can be used to get block headers with any chain backend.

## lncli Additions

# Improvements
## Functional Updates
## RPC Updates
## lncli Updates
## Code Health
## Breaking Changes
## Performance Improvements

- When facing a large mempool, users may experience deteriorated performance,
which includes slow startup and shutdown, clogging RPC response when calling
`getinfo`, and CPU spikes. This is now improved with [the upgrade to the
latest `btcwallet`](https://github.com/lightningnetwork/lnd/pull/8019). In
addition, it's strongly recommended to upgrade `bitcoind` to version `v24.0`
and above to take advantage of the new RPC method `gettxspendingprevout`,
which will further decrease CPU usage and memory consumption.

# Technical and Architectural Updates
## BOLT Spec Updates
## Testing
## Database
## Code Health
## Tooling and Documentation

# Contributors (Alphabetical Order)
* Eugene Siegel
* Olaoluwa Osuntokun
* Yong Yu
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ require (
github.com/btcsuite/btcd/btcutil/psbt v1.1.8
github.com/btcsuite/btcd/chaincfg/chainhash v1.0.2
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcwallet v0.16.10-0.20230804184612-07be54bc22cf
github.com/btcsuite/btcwallet v0.16.10-0.20231017144732-e3ff37491e9c
github.com/btcsuite/btcwallet/wallet/txauthor v1.3.2
github.com/btcsuite/btcwallet/wallet/txrules v1.2.0
github.com/btcsuite/btcwallet/walletdb v1.4.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -95,8 +95,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/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
github.com/btcsuite/btcwallet v0.16.10-0.20230804184612-07be54bc22cf h1:iZrvu/dynDPUcLJFkKiN9wnS4EdjwZSJS1H33Rx/a1Y=
github.com/btcsuite/btcwallet v0.16.10-0.20230804184612-07be54bc22cf/go.mod h1:qUPTONX2GVX7ERHvgh352/WySsfYlrkL4729qX9o9cA=
github.com/btcsuite/btcwallet v0.16.10-0.20231017144732-e3ff37491e9c h1:+7tbYEUj0TYYIvuvE9YP+x5dU3FT/8J6Qh8d5YvQwrE=
github.com/btcsuite/btcwallet v0.16.10-0.20231017144732-e3ff37491e9c/go.mod h1:WSKhOJWUmUOHKCKEzdt+jWAHFAE/t4RqVbCwL2pEdiU=
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/txrules v1.2.0 h1:BtEN5Empw62/RVnZ0VcJaVtVlBijnLlJY+dwjAye2Bg=
Expand Down
9 changes: 8 additions & 1 deletion htlcswitch/hop/iterator.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,14 @@ func (p *OnionProcessor) DecodeHopIterators(id []byte,
if replays.Contains(uint16(i)) {
log.Errorf("unable to process onion packet: %v",
sphinx.ErrReplayedPacket)
resp.FailCode = lnwire.CodeTemporaryChannelFailure

// We set FailCode to CodeInvalidOnionVersion even
// though the ephemeral key isn't the problem. We need
// to set the BADONION bit since we're sending back a
// malformed packet, but as there isn't a specific
// failure code for replays, we reuse one of the
// failure codes that has BADONION.
resp.FailCode = lnwire.CodeInvalidOnionVersion
continue
}

Expand Down
4 changes: 4 additions & 0 deletions htlcswitch/link.go
Original file line number Diff line number Diff line change
Expand Up @@ -1267,6 +1267,10 @@ func (l *channelLink) htlcManager() {
return
}

l.log.Infof("Channel is in an unclean state " +
"(lingering updates), graceful shutdown of " +
"channel link not possible")

// Otherwise, the channel has lingering updates, send
// an error and continue.
req.err <- ErrLinkFailedShutdown
Expand Down
4 changes: 4 additions & 0 deletions itest/list_on_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ var allTestCases = []*lntest.TestCase{
Name: "taproot",
TestFunc: testTaproot,
},
{
Name: "simple taproot channel activation",
TestFunc: testSimpleTaprootChannelActivation,
},
{
Name: "wallet import account",
TestFunc: testWalletImportAccount,
Expand Down
Loading

0 comments on commit 710545b

Please sign in to comment.