Skip to content

Commit

Permalink
lnwire: update String method for ShortChannelID to use 'x' separator
Browse files Browse the repository at this point in the history
Modified the `String` method of `ShortChannelID` to generate a
human-readable representation using 'x' as a separator.
(block x transaction x output).

Signed-off-by: Nishant Bansal <[email protected]>
  • Loading branch information
NishantBansal2003 committed Jan 1, 2025
1 parent 1d10e7d commit 19a1ba6
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
18 changes: 9 additions & 9 deletions lnwire/reply_channel_range_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -268,9 +268,9 @@ func TestReplyChannelRangeDecode(t *testing.T) {
"0045a6c4",
expEncoding: EncodingSortedPlain,
expSCIDs: []string{
"0:0:142",
"0:0:15465",
"0:69:42692",
"0x0x142",
"0x0x15465",
"0x69x42692",
},
},
{
Expand All @@ -280,9 +280,9 @@ func TestReplyChannelRangeDecode(t *testing.T) {
"01789c636000833e08659309a65878be010010a9023a",
expEncoding: EncodingSortedZlib,
expSCIDs: []string{
"0:0:142",
"0:0:15465",
"0:4:3318",
"0x0x142",
"0x0x15465",
"0x4x3318",
},
},
{
Expand All @@ -295,9 +295,9 @@ func TestReplyChannelRangeDecode(t *testing.T) {
"000115c000015b300001a0a",
expEncoding: EncodingSortedPlain,
expSCIDs: []string{
"0:0:12355",
"0:7:30934",
"0:70:57793",
"0x0x12355",
"0x7x30934",
"0x70x57793",
},
expTimestamps: Timestamps{
{
Expand Down
2 changes: 1 addition & 1 deletion lnwire/short_channel_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ func (c ShortChannelID) ToUint64() uint64 {

// String generates a human-readable representation of the channel ID.
func (c ShortChannelID) String() string {
return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition)
return fmt.Sprintf("%dx%dx%d", c.BlockHeight, c.TxIndex, c.TxPosition)
}

// Record returns a TLV record that can be used to encode/decode a
Expand Down

0 comments on commit 19a1ba6

Please sign in to comment.