Skip to content

Commit

Permalink
Fix Bug : Incorrectly generate P2SH with P2 pub key hash redeem
Browse files Browse the repository at this point in the history
  • Loading branch information
NicolasDorier committed Sep 26, 2014
1 parent 262b06f commit 5a337b6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion NBitcoin.Tests/script_tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -485,7 +485,7 @@ public void CanParseAndGeneratePayToScript()

var scriptPubkey = "OP_HASH160 b5b88dd9befc9236915fcdbb7fd50052df50c855 OP_EQUAL";

var scriptSig = "3044022064f45a382a15d3eb5e7fe72076eec4ef0f56fde1adfd710866e729b9e5f3383d02202720a895914c69ab49359087364f06d337a2138305fbc19e20d18da78415ea9301 51210364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27c210364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27d52ae";
var scriptSig = "0 3044022064f45a382a15d3eb5e7fe72076eec4ef0f56fde1adfd710866e729b9e5f3383d02202720a895914c69ab49359087364f06d337a2138305fbc19e20d18da78415ea9301 51210364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27c210364bd4b02a752798342ed91c681a48793bb1c0853cbcd0b978c55e53485b8e27d52ae";

var pubParams = template.ExtractScriptPubKeyParameters(new Script(scriptPubkey));
Assert.Equal("b5b88dd9befc9236915fcdbb7fd50052df50c855", pubParams.ToString());
Expand Down
2 changes: 1 addition & 1 deletion NBitcoin/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.5.3")]
[assembly: AssemblyVersion("1.0.5.4")]
[assembly: AssemblyFileVersion("1.0.0.0")]
3 changes: 2 additions & 1 deletion NBitcoin/StandardScriptTemplate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ public PayToScriptHashSigParameters ExtractScriptSigParameters(Script scriptSig)
public Script GenerateScriptSig(TransactionSignature[] signatures, Script redeemScript)
{
List<Op> ops = new List<Op>();
bool multiSig = signatures.Length > 1;
PayToMultiSigTemplate multiSigTemplate = new PayToMultiSigTemplate();
bool multiSig = multiSigTemplate.CheckScriptPubKey(redeemScript);
if(multiSig)
ops.Add(OpcodeType.OP_0);
foreach(var sig in signatures)
Expand Down

0 comments on commit 5a337b6

Please sign in to comment.