From 4cdaa95a209808276992dc1eb0ed0773f7927073 Mon Sep 17 00:00:00 2001 From: Pieter Wuille Date: Fri, 28 Nov 2014 21:16:51 +0100 Subject: [PATCH] Resize after succesful result --- src/key.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/key.cpp b/src/key.cpp index 0fb7a5c7c5..07fffcb0e0 100644 --- a/src/key.cpp +++ b/src/key.cpp @@ -83,10 +83,11 @@ bool CKey::Sign(const uint256 &hash, std::vector& vchSig, uint32_ nonce += test_case; int nSigLen = 72; int ret = secp256k1_ecdsa_sign((const unsigned char*)&hash, 32, (unsigned char*)&vchSig[0], &nSigLen, begin(), (unsigned char*)&nonce); - vchSig.resize(nSigLen); nonce = 0; - if (ret) + if (ret) { + vchSig.resize(nSigLen); return true; + } } while(true); }