Enable extended data on stakes and general cleanup
This commit is contained in:
@@ -123,8 +123,8 @@ static bool SignStepCC(const BaseSignatureCreator& creator, const CScript& scrip
|
|||||||
scriptPubKey.IsPayToCryptoCondition(&subScript, vParams);
|
scriptPubKey.IsPayToCryptoCondition(&subScript, vParams);
|
||||||
if (vParams.size() > 1 && (p = COptCCParams(vParams[0])).IsValid())
|
if (vParams.size() > 1 && (p = COptCCParams(vParams[0])).IsValid())
|
||||||
{
|
{
|
||||||
bool is1of2 = (p.n == 1 && p.m == 1);
|
bool is1of2 = (p.m == 1 && p.n == 2);
|
||||||
uint32_t extraAddrs = p.m;
|
uint32_t extraAddrs = p.n;
|
||||||
CKey privKey;
|
CKey privKey;
|
||||||
|
|
||||||
// get information to sign with
|
// get information to sign with
|
||||||
|
|||||||
@@ -91,12 +91,12 @@ bool Solver(const CScript& scriptPubKey, txnouttype& typeRet, vector<vector<unsi
|
|||||||
if (vParams.size())
|
if (vParams.size())
|
||||||
{
|
{
|
||||||
COptCCParams cp = COptCCParams(vParams[0]);
|
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
|
// all addresses that should be there must be 33 byte pub keys
|
||||||
for (int i = 1; i <= cp.m; i++)
|
for (int i = 1; i <= cp.n; i++)
|
||||||
{
|
{
|
||||||
if (vParams[i].size() != 20)
|
if (vParams[i].size() != 33)
|
||||||
{
|
{
|
||||||
// we accept no errors
|
// we accept no errors
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -90,7 +90,7 @@ class COptCCParams
|
|||||||
|
|
||||||
uint8_t version;
|
uint8_t version;
|
||||||
uint8_t evalCode;
|
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) {}
|
COptCCParams() : version(0), evalCode(0), n(0), m(0) {}
|
||||||
|
|
||||||
@@ -105,7 +105,7 @@ class COptCCParams
|
|||||||
evalCode = vch[1];
|
evalCode = vch[1];
|
||||||
n = vch[2];
|
n = vch[2];
|
||||||
m = vch[3];
|
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
|
// we only support one version, and 1 of 1 or 1 of 2 now, so set invalid
|
||||||
version = 0;
|
version = 0;
|
||||||
|
|||||||
@@ -1304,7 +1304,7 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
// if we are staking with the extended format, add the opreturn data required
|
// if we are staking with the extended format, add the opreturn data required
|
||||||
if (extendedStake)
|
// if (extendedStake)
|
||||||
{
|
{
|
||||||
uint256 srcBlock = uint256();
|
uint256 srcBlock = uint256();
|
||||||
CBlockIndex *pSrcIndex;
|
CBlockIndex *pSrcIndex;
|
||||||
@@ -1319,7 +1319,7 @@ int32_t CWallet::VerusStakeTransaction(CBlock *pBlock, CMutableTransaction &txNe
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
txOut1.scriptPubKey << OP_RETURN
|
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;
|
nValue = txNew.vout[0].nValue = stakeSource.vout[voutNum].nValue - txfee;
|
||||||
|
|||||||
Reference in New Issue
Block a user