Decouple taproot activation from support in generate wallet (#2837)

This commit is contained in:
Nicolas Dorier
2021-09-04 22:07:09 +09:00
committed by GitHub
parent 1422bd8540
commit e584ebe7de
7 changed files with 79 additions and 54 deletions

View File

@@ -146,11 +146,16 @@ namespace BTCPayServer.Controllers
}
}
public bool TaprootSupported(string crytoCode)
public bool TaprootActivated(string crytoCode)
{
var networkSupport = ((BTCPayNetwork)_NetworkProvider.GetNetwork(crytoCode))?.NBitcoinNetwork?.Consensus?.SupportTaproot is true;
var network = (BTCPayNetwork)_NetworkProvider.GetNetwork(crytoCode);
#pragma warning disable CS0618
if (!(network.IsBTC && network.NBitcoinNetwork.ChainName == ChainName.Mainnet))
// Consider it activated for everything that is not mainnet bitcoin
return true;
#pragma warning restore CS0618
var status = _Dashboard.Get(crytoCode).Status;
return networkSupport && !(status.NetworkType == ChainName.Mainnet && status.ChainHeight < 709632);
return status.ChainHeight >= 709632;
}