From 7f8e89f3b4fd6411ab39a2d056cde153f836e038 Mon Sep 17 00:00:00 2001 From: Nishant Bansal Date: Wed, 15 Jan 2025 15:25:40 +0530 Subject: [PATCH] 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 --- lnwire/short_channel_id.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lnwire/short_channel_id.go b/lnwire/short_channel_id.go index d4da518b7..73e37ab96 100644 --- a/lnwire/short_channel_id.go +++ b/lnwire/short_channel_id.go @@ -56,6 +56,12 @@ func (c ShortChannelID) String() string { return fmt.Sprintf("%d:%d:%d", c.BlockHeight, c.TxIndex, c.TxPosition) } +// AltString generates a human-readable representation of the channel ID +// with 'x' as a separator. +func (c ShortChannelID) AltString() string { + 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 // ShortChannelID to/from a TLV stream. func (c *ShortChannelID) Record() tlv.Record {