Randomize signature for txpow
This commit is contained in:
@@ -1111,6 +1111,7 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
|
|||||||
uint256 txid = mergedTx.GetHash();
|
uint256 txid = mergedTx.GetHash();
|
||||||
if ( ((uint8_t *)&txid)[0] == 0 && ((uint8_t *)&txid)[31] == 0 )
|
if ( ((uint8_t *)&txid)[0] == 0 && ((uint8_t *)&txid)[31] == 0 )
|
||||||
break;
|
break;
|
||||||
|
fprintf(stderr,"%d: tmp txid.%s\n",numiters,txid.GetHex().c_str());
|
||||||
} else break;
|
} else break;
|
||||||
numiters++;
|
numiters++;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
typedef vector<unsigned char> valtype;
|
typedef vector<unsigned char> valtype;
|
||||||
|
extern uint8_t ASSETCHAINS_TXPOW;
|
||||||
|
|
||||||
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
TransactionSignatureCreator::TransactionSignatureCreator(const CKeyStore* keystoreIn, const CTransaction* txToIn, unsigned int nInIn, const CAmount& amountIn, int nHashTypeIn) : BaseSignatureCreator(keystoreIn), txTo(txToIn), nIn(nInIn), nHashType(nHashTypeIn), amount(amountIn), checker(txTo, nIn, amountIn) {}
|
||||||
|
|
||||||
@@ -32,8 +33,16 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& vchSig,
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!key.Sign(hash, vchSig))
|
if ( ASSETCHAINS_TXPOW == 0 )
|
||||||
return false;
|
{
|
||||||
|
if (!key.Sign(hash, vchSig))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (!key.Sign(hash, vchSig, rand()))
|
||||||
|
return false;
|
||||||
|
}
|
||||||
vchSig.push_back((unsigned char)nHashType);
|
vchSig.push_back((unsigned char)nHashType);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user