diff --git a/go.mod b/go.mod index 3b55e726e..de529532f 100644 --- a/go.mod +++ b/go.mod @@ -29,7 +29,7 @@ require ( github.com/lightninglabs/lightning-node-connect/hashmailrpc v1.0.3 github.com/lightninglabs/lndclient v0.19.0-7 github.com/lightninglabs/neutrino/cache v1.1.2 - github.com/lightninglabs/taproot-assets/taprpc v1.0.6 + github.com/lightninglabs/taproot-assets/taprpc v1.0.7 github.com/lightningnetwork/lnd v0.19.0-beta github.com/lightningnetwork/lnd/cert v1.2.2 github.com/lightningnetwork/lnd/clock v1.1.1 diff --git a/rpcserver.go b/rpcserver.go index 5479ff8f7..ef069f3f6 100644 --- a/rpcserver.go +++ b/rpcserver.go @@ -8553,8 +8553,10 @@ func (r *rpcServer) getInboundPolicy(ctx context.Context, chanID uint64, return nil, fmt.Errorf("unable to fetch channel: %w", err) } + // We want the policy that corresponds to the node that is the remote + // peer in the channel. policy := edge.Node2Policy - if edge.Node2Pub == remotePubStr { + if edge.Node1Pub == remotePubStr { policy = edge.Node1Policy } diff --git a/tapchannel/commitment.go b/tapchannel/commitment.go index 2d1ac4855..294a74417 100644 --- a/tapchannel/commitment.go +++ b/tapchannel/commitment.go @@ -969,7 +969,10 @@ func addCommitmentOutputs(chanType channeldb.ChannelType, localChanCfg, // We've asserted that we have a non-dust BTC balance if we have an // asset balance before, so we can just check the asset balance here. - if ourAssetBalance > 0 || ourBalance > 0 { + // In case there is no asset balance, and the BTC value is dust, it will + // not be materialized on-chain, and we shouldn't create an allocation + // for it. + if ourAssetBalance > 0 || ourBalance > localChanCfg.DustLimit { toLocalScript, err := lnwallet.CommitScriptToSelf( chanType, initiator, keys.ToLocalKey, keys.RevocationKey, uint32(localChanCfg.CsvDelay), @@ -1033,7 +1036,10 @@ func addCommitmentOutputs(chanType channeldb.ChannelType, localChanCfg, addAllocation(allocation) } - if theirAssetBalance > 0 || theirBalance > 0 { + // We only create an allocation if there is going to be an on-chain + // output. If this is dust (which is only allowed if there are no assets + // on the output), it will not be materialized on-chain. + if theirAssetBalance > 0 || theirBalance > localChanCfg.DustLimit { toRemoteScript, _, err := lnwallet.CommitScriptToRemote( chanType, initiator, keys.ToRemoteKey, leaseExpiry, lfn.None[txscript.TapLeaf](),