Compare commits

...

22 Commits

Author SHA1 Message Date
816e96f157 Fix NRE 2020-10-30 00:17:15 +09:00
4be49f7dba Fix potential NRE in polling 2020-10-29 23:12:31 +09:00
9a3a6c8be0 Make a batch query for all pending invoice (Fix #2022) 2020-10-28 23:36:09 +09:00
236ad40a60 Revert "Add thread limit for updating payment states for payment invoices in NBXplorerListener"
This reverts commit 5d9827fb6032a2716eb87ecdc3ce62d53c74e055.
2020-10-28 23:36:09 +09:00
a0dfe5bce9 Revert "Add missing async/await keywords"
This reverts commit 8d0260b64490018c907f996d62f10b54c509dbc8.
2020-10-28 23:36:09 +09:00
0ca7f4678a changelog 1.0.5.9 2020-10-28 19:07:07 +09:00
74370c70a6 fix email not included in textsearch
fixes #1979
2020-10-28 19:01:20 +09:00
908398de2e Do not include maxadditionalfeecontribution if there is no change. (#2007) 2020-10-28 19:00:01 +09:00
27c3a34263 bump nbx and nbitcoin 2020-10-28 18:59:10 +09:00
a4d76fb33b Fix typos and improve wording & formatting (#2013) 2020-10-28 18:58:26 +09:00
12f525ebd8 Fix redirect when in modal (#2015)
fixes #2012
2020-10-28 18:58:16 +09:00
8a9b04c2cf Display link for Pay button (#2017)
fixes #635
2020-10-28 18:58:07 +09:00
853558c9a1 Add missing async/await keywords 2020-10-28 18:56:22 +09:00
c02a88837f Add thread limit for updating payment states for payment invoices in NBXplorerListener 2020-10-28 18:54:59 +09:00
db2a71b055 Update changelog 2020-10-16 20:41:55 +09:00
3e22ec7627 bump 2020-10-16 20:40:29 +09:00
f011df1081 Revert "The send wallet, by default, include the previous transaction"
This reverts commit 0f743cec4132c7f97a2e94263c044ddefbdccf9b.
2020-10-16 20:39:18 +09:00
b1fbbb5193 fix domain mapping bug (#1992)
fixes #1988
2020-10-16 20:39:08 +09:00
0773a0ace5 If a password fail to be reset by mail, show proper error (fix #1986) 2020-10-16 20:39:00 +09:00
3a8a7fe43f reword review step for vault 2020-10-16 20:38:51 +09:00
29399026e3 Do not log the database connection string
fixes #1980
2020-10-16 20:38:42 +09:00
f1cd763873 Use base65 instead of hex for BIP78 (#1985)
fixes #1984
2020-10-16 20:37:44 +09:00
20 changed files with 102 additions and 31 deletions

View File

@ -24,15 +24,15 @@ A clear and concise description of what you expected to happen.
If applicable, add screenshots to help explain your problem.
**Your BTCPay Environment (please complete the following information):**
- BTCPay Server Version [available in the right bottom corner of footer]
- Deployment Method: [e.g. Docker, Manual, Third-Party-hoist]
- Browser [e.g. chrome, safari]
- BTCPay Server Version: [available in the right bottom corner of footer]
- Deployment Method: [e.g. Docker, Manual, Third-Party-host]
- Browser: [e.g. Chrome, Safari]
**Logs (if applicable)**
Basic logs can be found in Server Settings > Logs. More logs https://docs.btcpayserver.org/Troubleshooting/#2-looking-through-the-logs
**Setup Parameters**
If you're reporting a deployment issue run `. btcpay-setup.sh -i` and paste your the parameters by obscuring private information.
If you're reporting a deployment issue run `. btcpay-setup.sh -i` and paste the setup parameters here with your private information removed or obscured.
**Additional context**
Add any other context about the problem here.

View File

@ -27,7 +27,7 @@
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0" PrivateAssets="All" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="NBitcoin" Version="5.0.51" />
<PackageReference Include="NBitcoin" Version="5.0.60" />
<PackageReference Include="BTCPayServer.Lightning.Common" Version="1.2.0" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

View File

@ -4,7 +4,7 @@
<ItemGroup>
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="NBXplorer.Client" Version="3.0.18" />
<PackageReference Include="NBXplorer.Client" Version="3.0.19" />
</ItemGroup>
<ItemGroup Condition="'$(Altcoins)' != 'true'">
<Compile Remove="Altcoins\**\*.cs"></Compile>

View File

@ -6,7 +6,7 @@
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.6.0" />
<PackageReference Include="Microsoft.AspNet.WebApi.Client" Version="5.2.7" />
<PackageReference Include="NBitcoin" Version="5.0.51" />
<PackageReference Include="NBitcoin" Version="5.0.60" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
<PackageReference Include="DigitalRuby.ExchangeSharp" Version="0.6.3" />
</ItemGroup>

View File

@ -82,7 +82,7 @@ services:
- customer_lnd
- merchant_lnd
nbxplorer:
image: nicolasdorier/nbxplorer:2.1.42
image: nicolasdorier/nbxplorer:2.1.45
restart: unless-stopped
ports:
- "32838:32838"

View File

@ -79,7 +79,7 @@ services:
- customer_lnd
- merchant_lnd
nbxplorer:
image: nicolasdorier/nbxplorer:2.1.42
image: nicolasdorier/nbxplorer:2.1.45
restart: unless-stopped
ports:
- "32838:32838"

View File

@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<Project Sdk="Microsoft.NET.Sdk.Web">
<Import Project="../Build/Version.csproj" Condition="Exists('../Build/Version.csproj')" />
<Import Project="../Build/Common.csproj" />

View File

@ -606,7 +606,7 @@ namespace BTCPayServer.Controllers
}
AddErrors(result);
return View();
return View(model);
}
[HttpGet]

View File

@ -262,6 +262,8 @@ namespace BTCPayServer.Controllers
[HttpPost]
public async Task<IActionResult> Policies(PoliciesSettings settings, string command = "")
{
ViewBag.UpdateUrlPresent = _Options.UpdateUrl != null;
ViewBag.AppsList = await GetAppSelectList();
if (command == "add-domain")
{

View File

@ -112,12 +112,12 @@ namespace BTCPayServer.Hosting
ApplicationDbContextFactory dbContext = null;
if (!String.IsNullOrEmpty(opts.PostgresConnectionString))
{
Logs.Configuration.LogInformation($"Postgres DB used ({opts.PostgresConnectionString})");
Logs.Configuration.LogInformation($"Postgres DB used");
dbContext = new ApplicationDbContextFactory(DatabaseType.Postgres, opts.PostgresConnectionString);
}
else if (!String.IsNullOrEmpty(opts.MySQLConnectionString))
{
Logs.Configuration.LogInformation($"MySQL DB used ({opts.MySQLConnectionString})");
Logs.Configuration.LogInformation($"MySQL DB used");
Logs.Configuration.LogWarning("MySQL is not widely tested and should be considered experimental, we advise you to use postgres instead.");
dbContext = new ApplicationDbContextFactory(DatabaseType.MySQL, opts.MySQLConnectionString);
}

View File

@ -53,7 +53,7 @@ namespace BTCPayServer.Models.WalletViewModels
public string RateError { get; set; }
public bool SupportRBF { get; set; }
[Display(Name = "Always include non-witness UTXO if available")]
public bool AlwaysIncludeNonWitnessUTXO { get; set; } = true;
public bool AlwaysIncludeNonWitnessUTXO { get; set; }
[Display(Name = "Allow fee increase (RBF)")]
public ThreeStateBool AllowFeeBump { get; set; }

View File

@ -138,9 +138,7 @@ namespace BTCPayServer.Payments.Bitcoin
switch (newEvent)
{
case NBXplorer.Models.NewBlockEvent evt:
await Task.WhenAll((await _InvoiceRepository.GetPendingInvoices())
.Select(invoiceId => UpdatePaymentStates(wallet, invoiceId))
.ToArray());
await UpdatePaymentStates(wallet, await _InvoiceRepository.GetPendingInvoices());
_Aggregator.Publish(new Events.NewBlockEvent() { CryptoCode = evt.CryptoCode });
break;
case NBXplorer.Models.NewTransactionEvent evt:
@ -206,11 +204,21 @@ namespace BTCPayServer.Payments.Bitcoin
}
}
async Task UpdatePaymentStates(BTCPayWallet wallet, string[] invoiceIds)
{
var invoices = await _InvoiceRepository.GetInvoices(invoiceIds);
await Task.WhenAll(invoices.Select(i => UpdatePaymentStates(wallet, i)).ToArray());
}
async Task<InvoiceEntity> UpdatePaymentStates(BTCPayWallet wallet, string invoiceId)
{
var invoice = await _InvoiceRepository.GetInvoice(invoiceId, false);
if (invoice == null)
return null;
return await UpdatePaymentStates(wallet, invoice);
}
async Task<InvoiceEntity> UpdatePaymentStates(BTCPayWallet wallet, InvoiceEntity invoice)
{
List<PaymentEntity> updatedPaymentEntities = new List<PaymentEntity>();
var transactions = await wallet.GetTransactions(invoice.GetAllBitcoinPaymentData()
.Select(p => p.Outpoint.Hash)
@ -363,7 +371,7 @@ namespace BTCPayServer.Payments.Bitcoin
var address = network.NBXplorerNetwork.CreateAddress(strategy, coin.KeyPath, coin.ScriptPubKey);
var paymentData = new BitcoinLikePaymentData(address, coin.Value, coin.OutPoint,
transaction.Transaction.RBF, coin.KeyPath);
transaction?.Transaction is null ? true : transaction.Transaction.RBF, coin.KeyPath);
var payment = await _InvoiceRepository.AddPayment(invoice.Id, coin.Timestamp, paymentData, network).ConfigureAwait(false);
alreadyAccounted.Add(coin.OutPoint);

View File

@ -127,6 +127,7 @@ retry:
if (invoiceData.CustomerEmail == null && data.Email != null)
{
invoiceData.CustomerEmail = data.Email;
AddToTextSearch(invoiceId, invoiceData.CustomerEmail);
}
await ctx.SaveChangesAsync().ConfigureAwait(false);
}
@ -204,7 +205,7 @@ retry:
textSearch.Add(invoice.Metadata.OrderId);
textSearch.Add(ToString(invoice.Metadata, null));
textSearch.Add(invoice.StoreId);
textSearch.Add(invoice.Metadata.BuyerEmail);
AddToTextSearch(invoice.Id, textSearch.ToArray());
return invoice;
}
@ -374,7 +375,7 @@ retry:
{
using (var tx = _Engine.GetTransaction())
{
tx.TextAppend("InvoiceSearch", Encoders.Base58.DecodeData(invoiceId), string.Join(" ", terms.Where(t => !String.IsNullOrWhiteSpace(t))));
tx.TextAppend("InvoiceSearch", Encoders.Base58.DecodeData(invoiceId), string.Join(" ", terms.Where(t => !string.IsNullOrWhiteSpace(t))));
tx.Commit();
}
});
@ -471,6 +472,20 @@ retry:
var res = await GetInvoiceRaw(id, inludeAddressData);
return res == null ? null : ToEntity(res);
}
public async Task<InvoiceEntity[]> GetInvoices(string[] invoiceIds)
{
var invoiceIdSet = invoiceIds.ToHashSet();
using (var context = _ContextFactory.CreateContext())
{
IQueryable<Data.InvoiceData> query =
context
.Invoices
.Include(o => o.Payments)
.Where(o => invoiceIdSet.Contains(o.Id));
return (await query.ToListAsync()).Select(o => ToEntity(o)).ToArray();
}
}
private async Task<InvoiceData> GetInvoiceRaw(string id, bool inludeAddressData = false)
{

View File

@ -109,10 +109,11 @@ namespace BTCPayServer.Services
if (!signedPSBT.TryGetEstimatedFeeRate(out var originalFeeRate))
throw new ArgumentException("signedPSBT should have utxo information", nameof(signedPSBT));
var originalFee = signedPSBT.GetFee();
optionalParameters.MaxAdditionalFeeContribution = MaxFeeBumpContribution is null ?
// By default, we want to keep same fee rate and a single additional input
originalFeeRate.GetFee(GetVirtualSize(inputScriptType)) :
MaxFeeBumpContribution;
if (changeOutput is PSBTOutput)
optionalParameters.MaxAdditionalFeeContribution = MaxFeeBumpContribution is null ?
// By default, we want to keep same fee rate and a single additional input
originalFeeRate.GetFee(GetVirtualSize(inputScriptType)) :
MaxFeeBumpContribution;
if (MinimumFeeRate is FeeRate v)
optionalParameters.MinFeeRate = v;
@ -314,7 +315,7 @@ namespace BTCPayServer.Services
using (HttpClient client = CreateHttpClient(endpoint))
{
var bpuresponse = await client.PostAsync(endpoint,
new StringContent(originalTx.ToHex(), Encoding.UTF8, "text/plain"), cancellationToken);
new StringContent(originalTx.ToBase64(), Encoding.UTF8, "text/plain"), cancellationToken);
if (!bpuresponse.IsSuccessStatusCode)
{
var errorStr = await bpuresponse.Content.ReadAsStringAsync();

View File

@ -329,11 +329,15 @@
this.endDate = newEnd;
// updating ui
this.srvModel = jsonData;
if (this.invoicePaid && !jsonData.isModal && jsonData.redirectAutomatically && jsonData.merchantRefLink) {
if (this.invoicePaid && jsonData.redirectAutomatically && jsonData.merchantRefLink) {
this.loading = true;
setTimeout(function () {
window.location = jsonData.merchantRefLink;
}, 2000);
if (this.isModal && window.top.location == jsonData.merchantRefLink){
this.close();
} else {
window.top.location = jsonData.merchantRefLink;
}
}.bind(this), 2000);
}
},
onEmailChange: function(){

View File

@ -153,6 +153,9 @@
<div class="col-lg-5">
<h4>Preview</h4>
<div id="preview"></div>
<h4 class="mt-2">Link</h4>
<span>Alternatively, you can share this link or encode it in a QR code</span>
<div id="preview-link"></div>
</div>
</div>
<hr />

View File

@ -49,7 +49,7 @@ var vaultui = (function () {
needPassphrase: new VaultFeedback("?", "Enter the passphrase.", "vault-feedback3", "need-passphrase"),
needPassphraseOnDevice: new VaultFeedback("?", "Please, enter the passphrase on the device.", "vault-feedback3", "need-passphrase-on-device"),
signingTransaction: new VaultFeedback("?", "Please review and confirm the transaction on your device...", "vault-feedback3", "ask-signing"),
reviewAddress: new VaultFeedback("?", "Please review the address on your device...", "vault-feedback3", "ask-signing"),
reviewAddress: new VaultFeedback("?", "Sending... Please review the address on your device...", "vault-feedback3", "ask-signing"),
signingRejected: new VaultFeedback("failed", "The user refused to sign the transaction", "vault-feedback3", "user-reject"),
};

View File

@ -188,7 +188,17 @@ function inputChanges(event, buttonSize) {
$("#mainCode").text(html).html();
$("#preview").html(html);
var form = document.querySelector("#preview form");
var url = new URL(form.getAttribute("action"));
var formData = new FormData(form);
formData.forEach((value, key) => {
if(key !== "jsonResponse"){
url.searchParams.append(key, value);
}
});
url = url.href;
$("#preview-link").append(`<a href="${url}">${url}</a>`)
$('pre code').each(function (i, block) {
hljs.highlightBlock(block);
});

View File

@ -1,5 +1,5 @@
<Project>
<PropertyGroup>
<Version>1.0.5.7</Version>
<Version>1.0.5.9</Version>
</PropertyGroup>
</Project>

View File

@ -1,5 +1,33 @@
# Changelog
## 1.0.5.9:
### Bug fixes:
* If there was too many pending invoice, postgres would be overwhelmed and freeze some requests (Igor Rylko)
* Emails were not included in the text search anymore @Kukks
* Payjoin: Do not include maxadditionalfeecontribution if there is no change. @NicolasDorier
## 1.0.5.8:
### Bug fixes:
* Fix payjoin client implementation (was sending hex instead of base64) @Kukks
* Fix: The send wallet, by default, should not include the previous transaction (timeouts issue with some hardware wallets) @NicolasDorier
* Do not log the database connection string @Kukks
* If a password fail to be reset by mail, show proper error @NicolasDorier
* When you map a specific domain to an app, when there's no app created there's a blank page @Kukks
### Bug fixes:
* Mark Shopify orders paid on invoice payment confirmed @rockstardev
* Fix: notification of new BTCPay Server not showing properly @rockstardev
* Fix: When collapsed, the sync window blocks the version text in the footer #1941 @Kukks
* Fix: Not possible to delete a user if U2F is enabled. @Kukks
* Fix onion location not always working #1947 @Kukks
* Fix invoice exception status not displaying in list #1963 @Kukks
* Fix: Is administrator checkbox does not work on create user page @NicolasDorier
## 1.0.5.7:
### Bug fixes: