Don't fail when adding twice the same payment_hash

This commit is contained in:
Yaacov Akiba Slama
2021-05-09 21:07:23 +03:00
parent ee75d838a1
commit 133c87ec27

3
db.go
View File

@@ -60,7 +60,8 @@ func registerPayment(destination, paymentHash, paymentSecret []byte, incomingAmo
commandTag, err := pgxPool.Exec(context.Background(),
`INSERT INTO
payments (destination, payment_hash, payment_secret, incoming_amount_msat, outgoing_amount_msat)
VALUES ($1, $2, $3, $4, $5)`,
VALUES ($1, $2, $3, $4, $5)
ON CONFLICT DO NOTHING`,
destination, paymentHash, paymentSecret, incomingAmountMsat, outgoingAmountMsat)
log.Printf("registerPayment(%x, %x, %x, %v, %v) rows: %v err: %v",
destination, paymentHash, paymentSecret, incomingAmountMsat, outgoingAmountMsat, commandTag.RowsAffected(), err)