Skip to content

Commit a492f25

Browse files
guggeroffranr
authored andcommitted
rfqmsg: fix SCID calculation for sell accept
We only want a single place where SCIDs are calculated from the RFQ ID. This is especially important due to a future change required where lnd will only accept SCIDs in a certain range and we'll need to deterministically shift the derived SCID to be within that range.
1 parent 7496ab3 commit a492f25

File tree

1 file changed

+1
-8
lines changed

1 file changed

+1
-8
lines changed

rfqmsg/sell_accept.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package rfqmsg
22

33
import (
4-
"encoding/binary"
54
"fmt"
65

76
"github.com/lightningnetwork/lnd/lnwire"
@@ -94,13 +93,7 @@ func newSellAcceptFromWireMsg(wireMsg WireMessage,
9493
// ShortChannelId returns the short channel ID associated with the asset sale
9594
// event.
9695
func (q *SellAccept) ShortChannelId() SerialisedScid {
97-
// Given valid RFQ message id, we then define a RFQ short chain id
98-
// (SCID) by taking the last 8 bytes of the RFQ message id and
99-
// interpreting them as a 64-bit integer.
100-
scidBytes := q.ID[24:]
101-
102-
scidInteger := binary.BigEndian.Uint64(scidBytes)
103-
return SerialisedScid(scidInteger)
96+
return q.ID.Scid()
10497
}
10598

10699
// ToWire returns a wire message with a serialized data field.

0 commit comments

Comments
 (0)