Skip to content

Commit 899a937

Browse files
authored
Merge pull request #1336 from lightninglabs/aux-custom-htlc
server+tapchannel: move IsCustomHTLC method
2 parents a445de0 + 05f601b commit 899a937

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
lines changed

server.go

+12
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ import (
1919
"github.com/lightninglabs/taproot-assets/fn"
2020
"github.com/lightninglabs/taproot-assets/monitoring"
2121
"github.com/lightninglabs/taproot-assets/perms"
22+
"github.com/lightninglabs/taproot-assets/rfqmsg"
2223
"github.com/lightninglabs/taproot-assets/rpcperms"
2324
"github.com/lightninglabs/taproot-assets/tapchannel"
2425
cmsg "github.com/lightninglabs/taproot-assets/tapchannelmsg"
@@ -1052,6 +1053,17 @@ func (s *Server) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
10521053
)
10531054
}
10541055

1056+
// IsCustomHTLC returns true if the HTLC carries the set of relevant custom
1057+
// records to put it under the purview of the traffic shaper, meaning that it's
1058+
// from a custom channel.
1059+
//
1060+
// NOTE: This method is part of the routing.TlvTrafficShaper interface.
1061+
func (s *Server) IsCustomHTLC(htlcRecords lnwire.CustomRecords) bool {
1062+
// We don't need to wait for server ready here since this operation can
1063+
// be done completely stateless.
1064+
return rfqmsg.HasAssetHTLCCustomRecords(htlcRecords)
1065+
}
1066+
10551067
// AuxCloseOutputs returns the set of close outputs to use for this co-op close
10561068
// attempt. We'll add some extra outputs to the co-op close transaction, and
10571069
// also give the caller a custom sorting routine.

tapchannel/aux_traffic_shaper.go

-12
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import (
1212
"github.com/lightninglabs/taproot-assets/rfqmsg"
1313
cmsg "github.com/lightninglabs/taproot-assets/tapchannelmsg"
1414
lfn "github.com/lightningnetwork/lnd/fn"
15-
"github.com/lightningnetwork/lnd/htlcswitch"
1615
"github.com/lightningnetwork/lnd/lnwire"
1716
"github.com/lightningnetwork/lnd/tlv"
1817
)
@@ -72,10 +71,6 @@ func (s *AuxTrafficShaper) Stop() error {
7271
return stopErr
7372
}
7473

75-
// A compile-time check to ensure that AuxTrafficShaper fully implements the
76-
// htlcswitch.AuxTrafficShaper interface.
77-
var _ htlcswitch.AuxTrafficShaper = (*AuxTrafficShaper)(nil)
78-
7974
// ShouldHandleTraffic is called in order to check if the channel identified by
8075
// the provided channel ID is handled by the traffic shaper implementation. If
8176
// it is handled by the traffic shaper, then the normal bandwidth calculation
@@ -326,10 +321,3 @@ func (s *AuxTrafficShaper) ProduceHtlcExtraData(totalAmount lnwire.MilliSatoshi,
326321

327322
return htlcAmountMSat, updatedRecords, nil
328323
}
329-
330-
// IsCustomHTLC returns true if the HTLC carries the set of relevant custom
331-
// records to put it under the purview of the traffic shaper, meaning that it's
332-
// from a custom channel.
333-
func (s *AuxTrafficShaper) IsCustomHTLC(htlcRecords lnwire.CustomRecords) bool {
334-
return rfqmsg.HasAssetHTLCCustomRecords(htlcRecords)
335-
}

0 commit comments

Comments
 (0)