Browse Source

Enable extended data on stakes and general cleanup

pull/4/head
miketout 6 years ago
parent
commit
b3e3f61826
  1. 4
      src/script/sign.cpp
  2. 8
      src/script/standard.cpp
  3. 4
      src/script/standard.h
  4. 4
      src/wallet/wallet.cpp

4
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

8
src/script/standard.cpp

@ -91,12 +91,12 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
if (vParams.size())
{
COptCCParams cp = COptCCParams(vParams[0]);
if (cp.IsValid() && vParams.size() > 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;

4
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;

4
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;

Loading…
Cancel
Save