ASSETCHAINS_TXPOW for signrawtransaction

This commit is contained in:
jl777
2018-10-21 11:36:18 -11:00
parent b8fefe8a26
commit 19e4c023b6
2 changed files with 56 additions and 25 deletions

View File

@@ -10,4 +10,6 @@
#define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus #define KOMODO_MAXMEMPOOLTIME 3600 // affects consensus
#define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9" #define CRYPTO777_PUBSECPSTR "020e46e79a2a8d12b9b5d12c7a91adb4e454edfae43c0a0cb805427d2ac7613fd9"
extern uint8_t ASSETCHAINS_TXPOW;
#endif #endif

View File

@@ -1058,7 +1058,26 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
// Use CTransaction for the constant parts of the // Use CTransaction for the constant parts of the
// transaction to avoid rehashing. // transaction to avoid rehashing.
CMutableTransaction mergedTxsave = mergedTx;
int32_t txpow,numiters = 0;
const CTransaction txConst(mergedTx); const CTransaction txConst(mergedTx);
if ( (txpow= ASSETCHAINS_TXPOW) != 0 )
{
if ( txConst.IsCoinBase() != 0 )
{
if ( (txpow & 2) == 0 )
txpow == 0;
}
else
{
if ( (txpow & 1) == 0 )
txpow == 0;
}
}
while ( 1 )
{
if ( txpow != 0 )
mergedTx = mergedTxsave;
// Sign what we can: // Sign what we can:
for (unsigned int i = 0; i < mergedTx.vin.size(); i++) { for (unsigned int i = 0; i < mergedTx.vin.size(); i++) {
CTxIn& txin = mergedTx.vin[i]; CTxIn& txin = mergedTx.vin[i];
@@ -1087,6 +1106,16 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp)
TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror)); TxInErrorToJSON(txin, vErrors, ScriptErrorString(serror));
} }
} }
if ( txpow != 0 )
{
uint256 txid = mergedTx.GetHash();
if ( ((uint8_t *)&txid)[0] == 0 && ((uint8_t *)&txid)[31] == 0 )
break;
}
numiters++;
}
if ( numiters > 0 )
fprintf(stderr,"ASSETCHAINS_TXPOW.%d txpow.%d numiters.%d for signature\n",ASSETCHAINS_TXPOW,txpow,numiters);
bool fComplete = vErrors.empty(); bool fComplete = vErrors.empty();
UniValue result(UniValue::VOBJ); UniValue result(UniValue::VOBJ);