@@ -707,6 +707,20 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance,
707707 allocType = CommitAllocationHtlcIncoming
708708 }
709709
710+ // If HTLC is dust, do not create allocation for it.
711+ isDust := lnwallet .HtlcIsDust (chanState .ChanType , isIncoming ,
712+ isOurCommit , filteredView .FeePerKw ,
713+ htlc .Amount .ToSatoshis (),
714+ chanState .LocalChanCfg .DustLimit )
715+ if isDust {
716+ // We need to error out, as a dust HTLC carrying assets
717+ // should not be expected.
718+ return fmt .Errorf ("error creating asset HTLC " +
719+ "allocation, HTLC is dust" )
720+ }
721+
722+ log .Infof ("### isDust=%v, amt=%v, dustLimit=%v" , isDust , htlc .Amount .ToSatoshis (), chanState .LocalChanCfg .DustLimit )
723+
710724 allocations = append (allocations , & Allocation {
711725 Type : allocType ,
712726 Amount : rfqmsg .Sum (htlc .AssetBalances ),
@@ -773,6 +787,15 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance,
773787 "sibling: %w" , err )
774788 }
775789
790+ // If HTLC is dust, do not create allocation for it.
791+ isDust := lnwallet .HtlcIsDust (chanState .ChanType , isIncoming ,
792+ isOurCommit , filteredView .FeePerKw ,
793+ htlc .Amount .ToSatoshis (),
794+ chanState .LocalChanCfg .DustLimit )
795+ if isDust {
796+ return nil
797+ }
798+
776799 allocations = append (allocations , & Allocation {
777800 Type : AllocationTypeNoAssets ,
778801 BtcAmount : htlc .Amount .ToSatoshis (),
0 commit comments