Use EnforceLowR suggestion of NBXplorer for signing

This commit is contained in:
nicolas.dorier 2020-05-25 06:34:49 +09:00
parent 35432d919c
commit 77f6019d82
No known key found for this signature in database
GPG Key ID: 6618763EF09186FE
4 changed files with 19 additions and 3 deletions

View File

@ -5,7 +5,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="NBitcoin" Version="5.0.38" />
<PackageReference Include="NBitcoin" Version="5.0.39" />
<PackageReference Include="Newtonsoft.Json" Version="12.0.3" />
</ItemGroup>

View File

@ -324,7 +324,10 @@ namespace BTCPayServer.Controllers
var extKey = ExtKey.Parse(vm.SigningKey, network.NBitcoinNetwork);
proposedPayjoin = proposedPayjoin.SignAll(derivationSchemeSettings.AccountDerivation,
extKey,
RootedKeyPath.Parse(vm.SigningKeyPath));
RootedKeyPath.Parse(vm.SigningKeyPath), new SigningOptions()
{
EnforceLowR = !(vm.SigningContext?.EnforceLowR is false)
});
vm.SigningContext.PSBT = proposedPayjoin.ToBase64();
vm.SigningContext.OriginalPSBT = psbt.ToBase64();
proposedPayjoin.Finalize();

View File

@ -914,7 +914,10 @@ namespace BTCPayServer.Controllers
return View(viewModel);
}
var changed = PSBTChanged(psbt, () => psbt.SignAll(settings.AccountDerivation, signingKey, rootedKeyPath));
var changed = PSBTChanged(psbt, () => psbt.SignAll(settings.AccountDerivation, signingKey, rootedKeyPath, new SigningOptions()
{
EnforceLowR = !(viewModel.SigningContext?.EnforceLowR is false)
}));
if (!changed)
{
ModelState.AddModelError(nameof(viewModel.SeedOrKey), "Impossible to sign the transaction. Probable cause: Incorrect account key path in wallet settings, PSBT already signed.");

View File

@ -0,0 +1,10 @@
@model BTCPayServer.Models.WalletViewModels.SigningContextModel
@if (Model != null)
{
<input type="hidden" asp-for="PSBT" />
<input type="hidden" asp-for="OriginalPSBT" />
<input type="hidden" asp-for="PayJoinEndpointUrl" />
<input type="hidden" asp-for="EnforceLowR" />
<input type="hidden" asp-for="ChangeAddress" />
}