Skip to content

Commit

Permalink
Merge pull request #75 from Impa10r/v1.6.3
Browse files Browse the repository at this point in the history
v1.6.3
  • Loading branch information
Impa10r authored Jul 8, 2024
2 parents 4040535 + 2fce338 commit 9073ac7
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Versions

## 1.6.3

- Fix bug in accounting for non-peerswap related invoices

## 1.6.2

- Fix 'invalid asset' bug
Expand Down
6 changes: 3 additions & 3 deletions cmd/psweb/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -710,10 +710,10 @@ func peginHandler(w http.ResponseWriter, r *http.Request) {
log.Println("Peg-in TxId:", res.TxId, "RawHex:", res.RawHex, "Claim script:", claimScript)
duration := time.Duration(1020) * time.Minute
formattedDuration := time.Time{}.Add(duration).Format("15h 04m")
telegramSendMessage("⏰ Started peg-in " + formatWithThousandSeparators(uint64(res.AmountSat)) + " sats. Time left: " + formattedDuration)
telegramSendMessage("⏰ Started peg-in " + formatWithThousandSeparators(uint64(res.AmountSat)) + " sats. Time left: " + formattedDuration + ". TxId: `" + res.TxId + "`")
} else {
log.Println("BTC withdrawal TxId:", res.TxId, "RawHex:", res.RawHex)
telegramSendMessage("BTC withdrawal pending: " + formatWithThousandSeparators(uint64(res.AmountSat)) + " sats.")
log.Println("BTC withdrawal pending, TxId:", res.TxId, "RawHex:", res.RawHex)
telegramSendMessage("BTC withdrawal pending: " + formatWithThousandSeparators(uint64(res.AmountSat)) + " sats. TxId: `" + res.TxId + "`")
}

config.Config.PeginClaimScript = claimScript
Expand Down
7 changes: 4 additions & 3 deletions cmd/psweb/ln/cln.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,11 +932,12 @@ func fetchPaymentsStats(client *glightning.Lightning, timeStamp uint64, channelI
// save rebate payment
saveSwapRabate(parts[4], int64(htlc.AmountMsat)/1000)
}
} else {
// only account for non-peerswap related
invoicedMsat += htlc.AmountMsat
continue
}
}

// only account for non-peerswap related
invoicedMsat += htlc.AmountMsat
}

case "RCVD_REMOVE_ACK_REVOCATION":
Expand Down
12 changes: 6 additions & 6 deletions cmd/psweb/ln/lnd.go
Original file line number Diff line number Diff line change
Expand Up @@ -1120,13 +1120,13 @@ func appendInvoice(invoice *lnrpc.Invoice) {
// save rebate payment
saveSwapRabate(parts[4], invoice.AmtPaidMsat/1000)
}
} else {
// skip peerswap-related
for _, htlc := range invoice.Htlcs {
if htlc.State == lnrpc.InvoiceHTLCState_SETTLED {
invoiceHtlcs[htlc.ChanId] = append(invoiceHtlcs[htlc.ChanId], htlc)
}
}
return
}
}
for _, htlc := range invoice.Htlcs {
if htlc.State == lnrpc.InvoiceHTLCState_SETTLED {
invoiceHtlcs[htlc.ChanId] = append(invoiceHtlcs[htlc.ChanId], htlc)
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions cmd/psweb/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import (

const (
// App version tag
version = "v1.6.2"
version = "v1.6.3"
)

type SwapParams struct {
Expand Down Expand Up @@ -1057,8 +1057,8 @@ func checkPegin() {

if confs > 0 {
if config.Config.PeginClaimScript == "" {
log.Println("BTC withdrawal complete")
telegramSendMessage("BTC withdrawal complete")
log.Println("BTC withdrawal complete, txId: " + config.Config.PeginTxId)
telegramSendMessage("BTC withdrawal complete. TxId: `" + config.Config.PeginTxId + "`")
} else if confs > 101 {
// claim pegin
failed := false
Expand Down Expand Up @@ -1089,7 +1089,7 @@ func checkPegin() {
telegramSendMessage("❗ Peg-in claim FAILED! See log for details.")
} else {
log.Println("Peg-in success! Liquid TxId:", txid)
telegramSendMessage("💸 Peg-in success!")
telegramSendMessage("💸 Peg-in success! Liquid TxId: `" + txid + "`")
}
} else {
return
Expand Down
3 changes: 3 additions & 0 deletions cmd/psweb/telegram.go
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ func telegramStart() {
if config.Config.PeginClaimScript != "" {
t += "/102, Time left: " + formattedDuration
}
t += ". TxId: `" + config.Config.PeginTxId + "`"
clean()
}
}
Expand Down Expand Up @@ -177,6 +178,8 @@ func telegramSendMessage(msgText string) bool {
return false
}
msg := tgbotapi.NewMessage(chatId, msgText)
msg.ParseMode = "MarkdownV2"

_, err := bot.Send(msg)
if err != nil {
log.Println(err)
Expand Down

0 comments on commit 9073ac7

Please sign in to comment.