diff --git a/BTCPayServer.Tests/SeleniumTests.cs b/BTCPayServer.Tests/SeleniumTests.cs index ddf7653d4..56b7ab639 100644 --- a/BTCPayServer.Tests/SeleniumTests.cs +++ b/BTCPayServer.Tests/SeleniumTests.cs @@ -2189,6 +2189,10 @@ namespace BTCPayServer.Tests // Relink should bump Version reg = await db.GetBoltcardRegistration(issuerKey, uid); Assert.Equal((ppid, 0, 1), (reg.PullPaymentId, reg.Counter, reg.Version)); + + await db.LinkBoltcardToPullPayment(ppid, issuerKey, uid); + reg = await db.GetBoltcardRegistration(issuerKey, uid); + Assert.Equal((ppid, 0, 2), (reg.PullPaymentId, reg.Counter, reg.Version)); } s.GoToStore(s.StoreId, StoreNavPages.PullPayments); diff --git a/BTCPayServer/Data/BoltcardDataExtensions.cs b/BTCPayServer/Data/BoltcardDataExtensions.cs index 4ea9421e5..56b8f66c8 100644 --- a/BTCPayServer/Data/BoltcardDataExtensions.cs +++ b/BTCPayServer/Data/BoltcardDataExtensions.cs @@ -21,7 +21,7 @@ public static class BoltcardDataExtensions string onConflict = onExisting switch { OnExistingBehavior.KeepVersion => "UPDATE SET ppid=excluded.ppid, version=boltcards.version", - OnExistingBehavior.UpdateVersion => "UPDATE SET ppid=excluded.ppid, version=excluded.version+1", + OnExistingBehavior.UpdateVersion => "UPDATE SET ppid=excluded.ppid, version=boltcards.version+1", _ => throw new NotSupportedException() }; return await conn.QueryFirstOrDefaultAsync(