@@ -707,6 +707,18 @@ 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+
710722 allocations = append (allocations , & Allocation {
711723 Type : allocType ,
712724 Amount : rfqmsg .Sum (htlc .AssetBalances ),
@@ -773,6 +785,15 @@ func CreateAllocations(chanState *channeldb.OpenChannel, ourBalance,
773785 "sibling: %w" , err )
774786 }
775787
788+ // If HTLC is dust, do not create allocation for it.
789+ isDust := lnwallet .HtlcIsDust (chanState .ChanType , isIncoming ,
790+ isOurCommit , filteredView .FeePerKw ,
791+ htlc .Amount .ToSatoshis (),
792+ chanState .LocalChanCfg .DustLimit )
793+ if isDust {
794+ return nil
795+ }
796+
776797 allocations = append (allocations , & Allocation {
777798 Type : AllocationTypeNoAssets ,
778799 BtcAmount : htlc .Amount .ToSatoshis (),
0 commit comments