Skip to content

Commit 7f8e89f

Browse files
lnwire: add 'x' separator in ShortChannelID method
Add the `AltString` method for `ShortChannelID` to produce a human-readable format with 'x' as a separator (block x transaction x output). Signed-off-by: Nishant Bansal <nishant.bansal.282003@gmail.com>
1 parent a388c1f commit 7f8e89f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

lnwire/short_channel_id.go

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ func (c ShortChannelID) String() string {
5656
return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition)
5757
}
5858

59+
// AltString generates a human-readable representation of the channel ID
60+
// with 'x' as a separator.
61+
func (c ShortChannelID) AltString() string {
62+
return fmt.Sprintf("%dx%dx%d", c.BlockHeight, c.TxIndex, c.TxPosition)
63+
}
64+
5965
// Record returns a TLV record that can be used to encode/decode a
6066
// ShortChannelID to/from a TLV stream.
6167
func (c *ShortChannelID) Record() tlv.Record {

0 commit comments

Comments
 (0)