Skip to content

Commit

Permalink
tapchannel: detect asset related custom records correctly
Browse files Browse the repository at this point in the history
Fixes more occurrences related to #1321.
  • Loading branch information
guggero committed Jan 27, 2025
1 parent b61c95b commit 4d9c148
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions tapchannel/commitment.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@ func ComputeView(ourBalance, theirBalance uint64,
entry.ParentIndex)
}

if len(parentEntry.CustomRecords) > 0 {
if rfqmsg.HasAssetHTLCCustomRecords(
parentEntry.CustomRecords,
) {

assetHtlc, err := rfqmsg.HtlcFromCustomRecords(
parentEntry.CustomRecords,
)
Expand Down Expand Up @@ -171,7 +174,10 @@ func ComputeView(ourBalance, theirBalance uint64,
entry.ParentIndex)
}

if len(parentEntry.CustomRecords) > 0 {
if rfqmsg.HasAssetHTLCCustomRecords(
parentEntry.CustomRecords,
) {

assetHtlc, err := rfqmsg.HtlcFromCustomRecords(
parentEntry.CustomRecords,
)
Expand Down Expand Up @@ -209,7 +215,7 @@ func ComputeView(ourBalance, theirBalance uint64,
// when it comes to balance calculations. We still need to keep
// track of them, so we can create non-asset allocations
// correctly.
if len(entry.CustomRecords) == 0 {
if !rfqmsg.HasAssetHTLCCustomRecords(entry.CustomRecords) {
nonAssetView.OurUpdates = append(
nonAssetView.OurUpdates, &DecodedDescriptor{
AuxHtlcDescriptor: entry,
Expand Down Expand Up @@ -251,7 +257,7 @@ func ComputeView(ourBalance, theirBalance uint64,
// when it comes to balance calculations. We still need to keep
// track of them, so we can create non-asset allocations
// correctly.
if len(entry.CustomRecords) == 0 {
if !rfqmsg.HasAssetHTLCCustomRecords(entry.CustomRecords) {
nonAssetView.TheirUpdates = append(
nonAssetView.TheirUpdates, &DecodedDescriptor{
AuxHtlcDescriptor: entry,
Expand Down

0 comments on commit 4d9c148

Please sign in to comment.