From 0af33a3f0db7e5c9e497a01e9a49b590aa8a23ea Mon Sep 17 00:00:00 2001 From: jl777 Date: Tue, 23 Oct 2018 08:01:32 -1100 Subject: [PATCH] -print, allow ztx to be non 0x00 ends for txpow --- src/main.cpp | 36 ++++++++++++++++++------------------ src/rpcrawtransaction.cpp | 2 +- 2 files changed, 19 insertions(+), 19 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index c2ce7ec60..95fdbebae 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -1128,23 +1128,6 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio // Check for negative or overflow output values CAmount nValueOut = 0; int32_t iscoinbase = tx.IsCoinBase(); - if ( ASSETCHAINS_TXPOW != 0 ) - { - // genesis coinbase 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b - uint256 txid = tx.GetHash(); - if ( ((ASSETCHAINS_TXPOW & 2) != 0 && iscoinbase != 0) || ((ASSETCHAINS_TXPOW & 1) != 0 && iscoinbase == 0) ) - { - if ( ((uint8_t *)&txid)[0] != 0 || ((uint8_t *)&txid)[31] != 0 ) - { - uint256 genesistxid = uint256S("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"); - if ( txid != genesistxid ) - { - fprintf(stderr,"private chain iscoinbase.%d invalid txpow.%d txid.%s\n",iscoinbase,ASSETCHAINS_TXPOW,txid.GetHex().c_str()); - return state.DoS(100, error("CheckTransaction(): this is a txpow chain, must have 0x00 ends"),REJECT_INVALID, "bad-txns-actxpow-chain"); - } - } - } - } BOOST_FOREACH(const CTxOut& txout, tx.vout) { if (txout.nValue < 0) @@ -1213,7 +1196,24 @@ bool CheckTransactionWithoutProofVerification(const CTransaction& tx, CValidatio REJECT_INVALID, "bad-txns-txouttotal-toolarge"); } } - + if ( ASSETCHAINS_TXPOW != 0 && tx.vjoinsplit.size() == 0 ) + { + // genesis coinbase 4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b + uint256 txid = tx.GetHash(); + if ( ((ASSETCHAINS_TXPOW & 2) != 0 && iscoinbase != 0) || ((ASSETCHAINS_TXPOW & 1) != 0 && iscoinbase == 0) ) + { + if ( ((uint8_t *)&txid)[0] != 0 || ((uint8_t *)&txid)[31] != 0 ) + { + uint256 genesistxid = uint256S("4a5e1e4baab89f3a32518a88c31bc87f618f76673e2cc77ab2127b7afdeda33b"); + if ( txid != genesistxid ) + { + fprintf(stderr,"private chain iscoinbase.%d invalid txpow.%d txid.%s\n",iscoinbase,ASSETCHAINS_TXPOW,txid.GetHex().c_str()); + return state.DoS(100, error("CheckTransaction(): this is a txpow chain, must have 0x00 ends"),REJECT_INVALID, "bad-txns-actxpow-chain"); + } + } + } + } + // Ensure input values do not exceed MAX_MONEY // We have not resolved the txin values at this stage, // but we do know what the joinsplits claim to add diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp index 168907cff..e692e1c84 100644 --- a/src/rpcrawtransaction.cpp +++ b/src/rpcrawtransaction.cpp @@ -1111,7 +1111,7 @@ UniValue signrawtransaction(const UniValue& params, bool fHelp) uint256 txid = mergedTx.GetHash(); if ( ((uint8_t *)&txid)[0] == 0 && ((uint8_t *)&txid)[31] == 0 ) break; - fprintf(stderr,"%d: tmp txid.%s\n",numiters,txid.GetHex().c_str()); + //fprintf(stderr,"%d: tmp txid.%s\n",numiters,txid.GetHex().c_str()); } else break; numiters++; }