add tag to open channel email

This commit is contained in:
Jesse de Wit
2023-06-02 13:32:49 +02:00
parent 057c5582c1
commit c2b1b841b4
4 changed files with 21 additions and 12 deletions

View File

@@ -124,7 +124,9 @@ func sendChannelMismatchNotification(nodeID string, notFakeChannels, closedChann
func sendOpenChannelEmailNotification(
paymentHash []byte, incomingAmountMsat int64,
destination []byte, capacity int64,
channelPoint string) error {
channelPoint string,
tag *string,
) error {
var html bytes.Buffer
tpl := `
@@ -134,6 +136,7 @@ func sendOpenChannelEmailNotification(
<tr><td>Destination Node:</td><td>{{ .Destination }}</td></tr>
<tr><td>Channel capacity (sat):</td><td>{{ .Capacity }}</td></tr>
<tr><td>Channel point:</td><td>{{ .ChannelPoint }}</td></tr>
<tr><td>Tag:</td><td>{{ .Tag }}</td></tr>
</table>
`
t, err := template.New("OpenChannelEmail").Parse(tpl)
@@ -141,12 +144,17 @@ func sendOpenChannelEmailNotification(
return err
}
tagStr := ""
if tag != nil {
tagStr = *tag
}
if err := t.Execute(&html, map[string]string{
"PaymentHash": hex.EncodeToString(paymentHash),
"IncomingAmountMsat": strconv.FormatUint(uint64(incomingAmountMsat), 10),
"Destination": hex.EncodeToString(destination),
"Capacity": strconv.FormatUint(uint64(capacity), 10),
"ChannelPoint": channelPoint,
"Tag": tagStr,
}); err != nil {
return err
}