move things around and some debugging code for odd issues

This commit is contained in:
miketout
2018-10-05 17:20:23 -07:00
parent 180662c25e
commit 185b2d4f2f
4 changed files with 60 additions and 41 deletions

View File

@@ -255,10 +255,13 @@ bool ValidateMatchingStake(const CTransaction &ccTx, uint32_t voutNum, const CTr
uint256 utxo = hw.GetHash();
uint32_t height = 0;
for (int i = 0; i < ccp.vData[2].size(); i++)
int i, dataLen = ccp.vData[2].size();
for (i = dataLen - 1; i >= 0; i--)
{
height = height << 8 + ccp.vData[2][i];
height = (height << 8) + ccp.vData[2][i];
}
// strange issue
printf("iterator: %d, height: %d, datalen: %d\n", i, height, dataLen);
if (utxo == uint256(ccp.vData[0]))
{

View File

@@ -20,45 +20,6 @@
#define DEFAULT_STAKE_TXFEE 0
class CStakeParams
{
public:
static const uint32_t STAKE_MINPARAMS = 4;
static const uint32_t STAKE_MAXPARAMS = 5;
uint32_t srcHeight;
uint32_t blkHeight;
uint256 prevHash;
CPubKey pk;
CStakeParams() : srcHeight(0), blkHeight(0), prevHash(), pk() {}
CStakeParams(const std::vector<std::vector<unsigned char>> &vData);
CStakeParams(uint32_t _srcHeight, uint32_t _blkHeight, const uint256 &_prevHash, const CPubKey &_pk) :
srcHeight(_srcHeight), blkHeight(_blkHeight), prevHash(_prevHash), pk(_pk) {}
std::vector<unsigned char> AsVector()
{
std::vector<unsigned char> ret;
CScript scr = CScript();
scr << OPRETTYPE_STAKEPARAMS;
scr << srcHeight;
scr << blkHeight;
scr << std::vector<unsigned char>(prevHash.begin(), prevHash.end());
if (pk.IsValid())
{
scr << std::vector<unsigned char>(pk.begin(), pk.end());
}
ret = std::vector<unsigned char>(scr.begin(), scr.end());
return ret;
}
bool IsValid() { return srcHeight != 0; }
};
bool UnpackStakeOpRet(const CTransaction &stakeTx, std::vector<std::vector<unsigned char>> &vData);
bool GetStakeParams(const CTransaction &stakeTx, CStakeParams &stakeParams);