From b3e3f61826675d1c200947012fe5c54174615399 Mon Sep 17 00:00:00 2001 From: miketout Date: Wed, 3 Oct 2018 09:26:40 -0700 Subject: [PATCH] Enable extended data on stakes and general cleanup --- src/script/sign.cpp | 4 ++-- src/script/standard.cpp | 8 ++++---- src/script/standard.h | 4 ++-- src/wallet/wallet.cpp | 4 ++-- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/script/sign.cpp b/src/script/sign.cpp index bd4e88fdb..ffa971f82 100644 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -123,8 +123,8 @@ static bool SignStepCC(const BaseSignatureCreator& creator, const CScript& scrip scriptPubKey.IsPayToCryptoCondition(&subScript, vParams); if (vParams.size() > 1 && (p = COptCCParams(vParams[0])).IsValid()) { - bool is1of2 = (p.n == 1 && p.m == 1); - uint32_t extraAddrs = p.m; + bool is1of2 = (p.m == 1 && p.n == 2); + uint32_t extraAddrs = p.n; CKey privKey; // get information to sign with diff --git a/src/script/standard.cpp b/src/script/standard.cpp index 6bda93682..1db594953 100644 --- a/src/script/standard.cpp +++ b/src/script/standard.cpp @@ -91,12 +91,12 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector cp.m) + if (cp.IsValid() && vParams.size() > cp.n) { - // all addresses that should be there must be 20 byte keyIDs - for (int i = 1; i <= cp.m; i++) + // all addresses that should be there must be 33 byte pub keys + for (int i = 1; i <= cp.n; i++) { - if (vParams[i].size() != 20) + if (vParams[i].size() != 33) { // we accept no errors return false; diff --git a/src/script/standard.h b/src/script/standard.h index 665956bb4..64f7a26ab 100644 --- a/src/script/standard.h +++ b/src/script/standard.h @@ -90,7 +90,7 @@ class COptCCParams uint8_t version; uint8_t evalCode; - uint8_t n, m; // for n of m sigs required, m addresses for sigs will follow + uint8_t m, n; // for m of n sigs required, n pub keys for sigs will follow COptCCParams() : version(0), evalCode(0), n(0), m(0) {} @@ -105,7 +105,7 @@ class COptCCParams evalCode = vch[1]; n = vch[2]; m = vch[3]; - if (version != VERSION && n == 1 && (m == 1 || m == 2)) + if (version != VERSION && m == 1 && (n == 1 || n == 2)) { // we only support one version, and 1 of 1 or 1 of 2 now, so set invalid version = 0; diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index 5d5d8fcca..640a0b7f7 100644 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -1304,7 +1304,7 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe return 0; // if we are staking with the extended format, add the opreturn data required - if (extendedStake) + // if (extendedStake) { uint256 srcBlock = uint256(); CBlockIndex *pSrcIndex; @@ -1319,7 +1319,7 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe return 0; txOut1.scriptPubKey << OP_RETURN - << CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight(), pBlock->hashPrevBlock, pk).AsVector(); + << CStakeParams(pSrcIndex->GetHeight(), tipindex->GetHeight() + 1, pBlock->hashPrevBlock, pk).AsVector(); } nValue = txNew.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;