Taproot support for wallets (#2830)

* Support taproot for HotWallet

* Support taproot for hardware wallets

* Fix NBX version

* Undo formatting

* Do not show Taproot when not supported

* Create taproot wallet from xpub

* Bug Fix
This commit is contained in:
Manan Sharma
2021-09-03 12:07:12 +05:30
committed by GitHub
parent 203db44b4e
commit e5699f674b
11 changed files with 70 additions and 12 deletions

View File

@@ -55,6 +55,7 @@ namespace BTCPayServer.Controllers
vm.RootKeyPath = network.GetRootKeyPath();
vm.CanUseHotWallet = hotWallet;
vm.CanUseRPCImport = rpcImport;
vm.CanUseTaproot = TaprootSupported(vm.CryptoCode);
if (vm.Method == null)
{
@@ -109,6 +110,11 @@ namespace BTCPayServer.Controllers
try
{
strategy = ParseDerivationStrategy(vm.DerivationScheme, network);
if(strategy.AccountDerivation is TaprootDerivationStrategy && !TaprootSupported(vm.CryptoCode))
{
ModelState.AddModelError(nameof(vm.DerivationScheme), "Taproot is not supported");
return View(vm.ViewName, vm);
}
strategy.Source = "ManualDerivationScheme";
if (!string.IsNullOrEmpty(vm.AccountKey))
{
@@ -208,6 +214,7 @@ namespace BTCPayServer.Controllers
vm.CanUseHotWallet = hotWallet;
vm.CanUseRPCImport = rpcImport;
vm.CanUseTaproot = TaprootSupported(vm.CryptoCode);
vm.RootKeyPath = network.GetRootKeyPath();
vm.Network = network;
@@ -262,6 +269,12 @@ namespace BTCPayServer.Controllers
CanUseRPCImport = rpcImport
};
if (request.ScriptPubKeyType == ScriptPubKeyType.TaprootBIP86 && !TaprootSupported(cryptoCode) )
{
ModelState.AddModelError(nameof(request.ScriptPubKeyType), $"Taproot not supported");
return View(vm.ViewName, vm);
}
if (isImport && string.IsNullOrEmpty(request.ExistingMnemonic))
{
ModelState.AddModelError(nameof(request.ExistingMnemonic), "Please provide your existing seed");