diff --git a/NBitcoin.Altcoins/NBitcoin.Altcoins.csproj b/NBitcoin.Altcoins/NBitcoin.Altcoins.csproj index 6e9154298..a3134b3a1 100644 --- a/NBitcoin.Altcoins/NBitcoin.Altcoins.csproj +++ b/NBitcoin.Altcoins/NBitcoin.Altcoins.csproj @@ -17,7 +17,7 @@ $(TargetFrameworkOverride) 1591;1573;1572;1584;1570;3021 true - 3.0.21 + 3.0.22 diff --git a/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj b/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj index 30f68b638..4be592dd3 100644 --- a/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj +++ b/NBitcoin.TestFramework/NBitcoin.TestFramework.csproj @@ -1,7 +1,7 @@  - 3.0.24 + 3.0.25 9.0 netstandard1.6;net472;netstandard2.0 netstandard2.1 diff --git a/NBitcoin.Tests/TaprootBuilderTests.cs b/NBitcoin.Tests/TaprootBuilderTests.cs index e49dab2d0..4a647f66c 100644 --- a/NBitcoin.Tests/TaprootBuilderTests.cs +++ b/NBitcoin.Tests/TaprootBuilderTests.cs @@ -135,8 +135,8 @@ public void CanHandleMultipleProofForSameScript() var data = new byte[] { 0x01 }; var sc = new Script(OpcodeType.OP_RETURN, Op.GetPushOp(data)); var version = (byte)TaprootConstants.TAPROOT_LEAF_TAPSCRIPT; - var nodeInfoA = NodeInfo.NewLeafWithVersion(sc, version); - var nodeInfoB = NodeInfo.NewLeafWithVersion(sc, version); + var nodeInfoA = TaprootNodeInfo.NewLeafWithVersion(sc, version); + var nodeInfoB = TaprootNodeInfo.NewLeafWithVersion(sc, version); var rootNode = nodeInfoA + nodeInfoB; var info = TaprootSpendInfo.FromNodeInfo(internalKey, rootNode); Assert.Single(info.ScriptToMerkleProofMap); @@ -222,7 +222,7 @@ public void ScriptPathSpendUnitTest1() Assert.Equal(info.MerkleRoot!, expectedMerkleRoot); var output = internalKey.GetTaprootFullPubKey(info.MerkleRoot); - Assert.Equal(info.OutputPubKey.OutputKey.ToString(), "003cdb72825a12ea62f5834f3c47f9bf48d58d27f5ad1e6576ac613b093125f3"); + Assert.Equal("003cdb72825a12ea62f5834f3c47f9bf48d58d27f5ad1e6576ac613b093125f3", info.OutputPubKey.OutputKey.ToString()); var spk = output.ScriptPubKey; var expectedSpk = "5120003cdb72825a12ea62f5834f3c47f9bf48d58d27f5ad1e6576ac613b093125f3"; Assert.Equal( expectedSpk, spk.ToHex()); diff --git a/NBitcoin/NBitcoin.csproj b/NBitcoin/NBitcoin.csproj index ebd66abf7..c3186e166 100644 --- a/NBitcoin/NBitcoin.csproj +++ b/NBitcoin/NBitcoin.csproj @@ -12,7 +12,7 @@ git - 7.0.32 + 7.0.33 9.0 diff --git a/NBitcoin/PubKey.cs b/NBitcoin/PubKey.cs index 34fa06fa4..acdea01b1 100644 --- a/NBitcoin/PubKey.cs +++ b/NBitcoin/PubKey.cs @@ -52,12 +52,12 @@ public enum ScriptPubKeyType #endif TaprootWithScript, -#if !HAS_SPAN - [Obsolete("TaprootRaw is unavailable in .net framework")] -#endif /// /// Taproot output that we don't know if the script path exists or not. /// +#if !HAS_SPAN + [Obsolete("TaprootRaw is unavailable in .net framework")] +#endif TaprootRaw } public class PubKey : IDestination, IComparable, IEquatable, IPubKey @@ -338,7 +338,9 @@ public BitcoinAddress GetAddress(ScriptPubKeyType type, Network network) #else return GetTaprootFullPubKey().GetAddress(network); #endif +#pragma warning disable CS0618 // Type or member is obsolete case ScriptPubKeyType.TaprootWithScript: +#pragma warning restore CS0618 // Type or member is obsolete throw new NotSupportedException("Can not get address from pubkey without script."); default: throw new NotSupportedException("Unsupported ScriptPubKeyType"); diff --git a/NBitcoin/Scripting/OutputDescriptor.cs b/NBitcoin/Scripting/OutputDescriptor.cs index 06a379ffb..489218d08 100644 --- a/NBitcoin/Scripting/OutputDescriptor.cs +++ b/NBitcoin/Scripting/OutputDescriptor.cs @@ -71,7 +71,7 @@ public static (int, List)? FindMultiATemplate(this Script sc) internal class TreeNode { internal uint256? Hash { get; set; } - internal ScriptLeaf? Leaf; + internal TaprootScriptLeaf? Leaf; internal Tuple? Sub; /// @@ -115,7 +115,7 @@ public static bool InferTaprootTree(this TaprootSpendInfo info, TaprootPubKey ou continue; } - var leafHash = new ScriptLeaf(script, leafVersion).LeafHash; + var leafHash = new TaprootScriptLeaf(script, leafVersion).LeafHash; TreeNode node = root; var levels = controlB.Length/ TaprootConstants.TAPROOT_CONTROL_NODE_SIZE; @@ -163,7 +163,7 @@ public static bool InferTaprootTree(this TaprootSpendInfo info, TaprootPubKey ou if (node.Sub?.Item1 is not null) return false; node.Explored = true; node.Inner = false; - node.Leaf = new ScriptLeaf(script, leafVersion); + node.Leaf = new TaprootScriptLeaf(script, leafVersion); node.Hash = leafHash; } } @@ -195,7 +195,7 @@ public static bool InferTaprootTree(this TaprootSpendInfo info, TaprootPubKey ou } else if (!node.Inner) { - result.Add(new Tuple((int)stack.Count - 1, node.Leaf.Script, node.Leaf.Version)); + result.Add(new Tuple((int)stack.Count - 1, node.Leaf!.Script, node.Leaf.Version)); node.Done = true; stack.Pop(); } @@ -608,7 +608,7 @@ public static OutputDescriptor NewRawTr(PubKeyProvider outputPubkeyProvider, Net public bool TryExpand( uint pos, ISigningRepository repo, - out List