mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2024-11-19 09:54:30 +01:00
Fix: Adding comment on wallet transactions causes 500 error (Close #1280)
This commit is contained in:
parent
c269dee980
commit
9410933e1c
@ -862,6 +862,7 @@ namespace BTCPayServer.Tests
|
|||||||
Assert.Equal(tx.Id, txId.ToString());
|
Assert.Equal(tx.Id, txId.ToString());
|
||||||
|
|
||||||
// Hijack the test to see if we can add label and comments
|
// Hijack the test to see if we can add label and comments
|
||||||
|
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addcomment: "hello-pouet"));
|
||||||
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addlabel: "test"));
|
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addlabel: "test"));
|
||||||
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addlabelclick: "test2"));
|
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addlabelclick: "test2"));
|
||||||
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addcomment: "hello"));
|
Assert.IsType<RedirectToActionResult>(await walletController.ModifyTransaction(walletId, tx.Id, addcomment: "hello"));
|
||||||
|
@ -85,9 +85,17 @@ namespace BTCPayServer.Services
|
|||||||
catch (DbUpdateException) // Does not exists
|
catch (DbUpdateException) // Does not exists
|
||||||
{
|
{
|
||||||
entity.State = EntityState.Added;
|
entity.State = EntityState.Added;
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await ctx.SaveChangesAsync();
|
||||||
|
}
|
||||||
|
catch(DbUpdateException) // the Wallet does not exists in the DB
|
||||||
|
{
|
||||||
|
await SetWalletInfo(walletId, new WalletBlobInfo());
|
||||||
await ctx.SaveChangesAsync();
|
await ctx.SaveChangesAsync();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user