diff --git a/src/chainparams.cpp b/src/chainparams.cpp index ff896f4c8..0dc0ad8b0 100755 --- a/src/chainparams.cpp +++ b/src/chainparams.cpp @@ -15,7 +15,7 @@ #include "chainparamsseeds.h" -static CBlock CreateGenesisBlock(const char* pszTimestamp, const std::string strTxComment, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) +static CBlock CreateGenesisBlock(const char* pszTimestamp, const std::string strFloData, const CScript& genesisOutputScript, uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) { CMutableTransaction txNew; txNew.nVersion = 2; @@ -24,7 +24,7 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const std::string str txNew.vin[0].scriptSig = CScript() << 486604799 << CScriptNum(4) << std::vector((const unsigned char*)pszTimestamp, (const unsigned char*)pszTimestamp + strlen(pszTimestamp)); txNew.vout[0].nValue = genesisReward; txNew.vout[0].scriptPubKey = genesisOutputScript; - txNew.strTxComment = strTxComment; + txNew.strFloData = strFloData; CBlock genesis; genesis.nTime = nTime; @@ -51,9 +51,9 @@ static CBlock CreateGenesisBlock(const char* pszTimestamp, const std::string str static CBlock CreateGenesisBlock(uint32_t nTime, uint32_t nNonce, uint32_t nBits, int32_t nVersion, const CAmount& genesisReward) { const char* pszTimestamp = "Slashdot - 17 June 2013 - Saudi Arabia Set To Ban WhatsApp, Skype"; - const std::string strTxComment = "text:Florincoin genesis block"; + const std::string strFloData = "text:Florincoin genesis block"; const CScript genesisOutputScript = CScript() << ParseHex("040184710fa689ad5023690c80f3a49c8f13f8d45b8c857fbcbc8bc4a8e4d3eb4b10f4d4604fa08dce601aaf0f470216fe1b51850b4acf21b179c45070ac7b03a9") << OP_CHECKSIG; - return CreateGenesisBlock(pszTimestamp, strTxComment, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); + return CreateGenesisBlock(pszTimestamp, strFloData, genesisOutputScript, nTime, nNonce, nBits, nVersion, genesisReward); } void CChainParams::UpdateVersionBitsParameters(Consensus::DeploymentPos d, int64_t nStartTime, int64_t nTimeout) diff --git a/src/core_write.cpp b/src/core_write.cpp index 3fb631329..55d73509a 100755 --- a/src/core_write.cpp +++ b/src/core_write.cpp @@ -205,7 +205,7 @@ void TxToUniv(const CTransaction& tx, const uint256& hashBlock, UniValue& entry, } entry.pushKV("vout", vout); - entry.pushKV("tx-comment", tx.strTxComment); + entry.pushKV("flo-data", tx.strFloData); if (!hashBlock.IsNull()) entry.pushKV("blockhash", hashBlock.GetHex()); diff --git a/src/miner.cpp b/src/miner.cpp index b0ee8711f..287812bb3 100755 --- a/src/miner.cpp +++ b/src/miner.cpp @@ -128,7 +128,7 @@ void BlockAssembler::resetBlock() nFees = 0; } -std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx, std::string coinbaseTxComment) +std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx, std::string coinbaseFloData) { int64_t nTimeStart = GetTimeMicros(); @@ -188,7 +188,7 @@ std::unique_ptr BlockAssembler::CreateNewBlock(const CScript& sc coinbaseTx.vout[0].scriptPubKey = scriptPubKeyIn; coinbaseTx.vout[0].nValue = nFees + GetBlockSubsidy(nHeight, chainparams.GetConsensus()); coinbaseTx.vin[0].scriptSig = CScript() << nHeight << OP_0; - coinbaseTx.strTxComment = coinbaseTxComment; + coinbaseTx.strFloData = coinbaseFloData; pblock->vtx[0] = MakeTransactionRef(std::move(coinbaseTx)); pblocktemplate->vchCoinbaseCommitment = GenerateCoinbaseCommitment(*pblock, pindexPrev, chainparams.GetConsensus()); pblocktemplate->vTxFees[0] = -nFees; diff --git a/src/miner.h b/src/miner.h index e3969a4d0..fc314deb0 100755 --- a/src/miner.h +++ b/src/miner.h @@ -169,7 +169,7 @@ public: BlockAssembler(const CChainParams& params, const Options& options); /** Construct a new block template with coinbase to scriptPubKeyIn */ - std::unique_ptr CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx=true, std::string coinbaseTxComment=""); + std::unique_ptr CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx=true, std::string coinbaseFloData=""); private: // utility functions diff --git a/src/primitives/transaction.cpp b/src/primitives/transaction.cpp index f2e5e28ae..926aa856c 100755 --- a/src/primitives/transaction.cpp +++ b/src/primitives/transaction.cpp @@ -55,8 +55,8 @@ std::string CTxOut::ToString() const return strprintf("CTxOut(nValue=%d.%08d, scriptPubKey=%s)", nValue / COIN, nValue % COIN, HexStr(scriptPubKey).substr(0, 30)); } -CMutableTransaction::CMutableTransaction() : nVersion(CTransaction::CURRENT_VERSION), nLockTime(0), strTxComment("") {} -CMutableTransaction::CMutableTransaction(const CTransaction& tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), strTxComment(tx.strTxComment) {} +CMutableTransaction::CMutableTransaction() : nVersion(CTransaction::CURRENT_VERSION), nLockTime(0), strFloData("") {} +CMutableTransaction::CMutableTransaction(const CTransaction& tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), strFloData(tx.strFloData) {} uint256 CMutableTransaction::GetHash() const { @@ -77,9 +77,9 @@ uint256 CTransaction::GetWitnessHash() const } /* For backward compatibility, the hash is initialized to 0. TODO: remove the need for this default constructor entirely. */ -CTransaction::CTransaction() : nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0), strTxComment(""), hash() {} -CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), strTxComment(tx.strTxComment), hash(ComputeHash()) {} -CTransaction::CTransaction(CMutableTransaction &&tx) : nVersion(tx.nVersion), vin(std::move(tx.vin)), vout(std::move(tx.vout)), nLockTime(tx.nLockTime), strTxComment(tx.strTxComment), hash(ComputeHash()) {} +CTransaction::CTransaction() : nVersion(CTransaction::CURRENT_VERSION), vin(), vout(), nLockTime(0), strFloData(""), hash() {} +CTransaction::CTransaction(const CMutableTransaction &tx) : nVersion(tx.nVersion), vin(tx.vin), vout(tx.vout), nLockTime(tx.nLockTime), strFloData(tx.strFloData), hash(ComputeHash()) {} +CTransaction::CTransaction(CMutableTransaction &&tx) : nVersion(tx.nVersion), vin(std::move(tx.vin)), vout(std::move(tx.vout)), nLockTime(tx.nLockTime), strFloData(tx.strFloData), hash(ComputeHash()) {} CAmount CTransaction::GetValueOut() const { @@ -113,7 +113,7 @@ std::string CTransaction::ToString() const for (const auto& tx_out : vout) str += " " + tx_out.ToString() + "\n"; if (nVersion >= 2) { - str += " txComment: " + strTxComment + "\n"; + str += " floData: " + strFloData + "\n"; } return str; } diff --git a/src/primitives/transaction.h b/src/primitives/transaction.h index 35ff31596..71bd3c0e9 100755 --- a/src/primitives/transaction.h +++ b/src/primitives/transaction.h @@ -228,7 +228,7 @@ inline void UnserializeTransaction(TxType& tx, Stream& s) { } s >> tx.nLockTime; if (tx.nVersion >= 2) { - s >> tx.strTxComment; + s >> tx.strFloData; } } @@ -260,7 +260,7 @@ inline void SerializeTransaction(const TxType& tx, Stream& s) { } s << tx.nLockTime; if (tx.nVersion >= 2) { - s << tx.strTxComment; + s << tx.strFloData; } } @@ -289,7 +289,7 @@ public: const std::vector vin; const std::vector vout; const uint32_t nLockTime; - const std::string strTxComment; + const std::string strFloData; private: /** Memory only. */ @@ -373,7 +373,7 @@ struct CMutableTransaction std::vector vin; std::vector vout; uint32_t nLockTime; - std::string strTxComment; + std::string strFloData; CMutableTransaction(); CMutableTransaction(const CTransaction& tx); diff --git a/src/qt/forms/sendcoinsdialog.ui b/src/qt/forms/sendcoinsdialog.ui old mode 100644 new mode 100755 index e51d4efe0..f92fb4597 --- a/src/qt/forms/sendcoinsdialog.ui +++ b/src/qt/forms/sendcoinsdialog.ui @@ -631,14 +631,14 @@ - + - TX Comment: + FLO Data: - + diff --git a/src/qt/sendcoinsdialog.cpp b/src/qt/sendcoinsdialog.cpp index b4a73a056..bbae830f4 100755 --- a/src/qt/sendcoinsdialog.cpp +++ b/src/qt/sendcoinsdialog.cpp @@ -262,10 +262,10 @@ void SendCoinsDialog::on_sendButton_clicked() } // prepare transaction for getting txFee earlier - std::string txComment = ui->txComment->text().toStdString(); - if (!txComment.empty()) - txComment = "text:" + txComment; - WalletModelTransaction currentTransaction(recipients, txComment); + std::string floData = ui->floData->text().toStdString(); + if (!floData.empty()) + floData = "text:" + floData; + WalletModelTransaction currentTransaction(recipients, floData); WalletModel::SendCoinsReturn prepareStatus; // Always use a CCoinControl instance, use the CoinControlDialog instance if CoinControl has been enabled diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp index e3934c834..b281498c0 100755 --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -271,9 +271,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco strHTML += "
" + tr("Generated coins must mature %1 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to \"not accepted\" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.").arg(QString::number(numBlocksToMaturity)) + "
"; } - // Transaction Comment - if (!wtx.tx->strTxComment.empty()) - strHTML += "
" + tr("Transaction Comment") + ":
" + GUIUtil::HtmlEscape(wtx.tx->strTxComment, true) + "
"; + // FLO Data + if (!wtx.tx->strFloData.empty()) + strHTML += "
" + tr("FLO Data") + ":
" + GUIUtil::HtmlEscape(wtx.tx->strFloData, true) + "
"; // // Debug view diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp index d7fd9e979..3e1eef74b 100755 --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -278,8 +278,8 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact CWalletTx *newTx = transaction.getTransaction(); CReserveKey *keyChange = transaction.getPossibleKeyChange(); - std::string strTxComment = transaction.getTxComment(); - bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, strTxComment); + std::string strFloData = transaction.getFloData(); + bool fCreated = wallet->CreateTransaction(vecSend, *newTx, *keyChange, nFeeRequired, nChangePosRet, strFailReason, coinControl, strFloData); transaction.setTransactionFee(nFeeRequired); if (fSubtractFeeFromAmount && fCreated) transaction.reassignAmounts(nChangePosRet); diff --git a/src/qt/walletmodeltransaction.cpp b/src/qt/walletmodeltransaction.cpp index 219864e48..1f79caab5 100755 --- a/src/qt/walletmodeltransaction.cpp +++ b/src/qt/walletmodeltransaction.cpp @@ -8,12 +8,12 @@ #include "policy/policy.h" #include "wallet/wallet.h" -WalletModelTransaction::WalletModelTransaction(const QList &_recipients, std::string txComment) : +WalletModelTransaction::WalletModelTransaction(const QList &_recipients, std::string floData) : recipients(_recipients), walletTransaction(0), keyChange(0), fee(0), - strTxComment(txComment) + strFloData(floData) { walletTransaction = new CWalletTx(); } @@ -29,9 +29,9 @@ QList WalletModelTransaction::getRecipients() return recipients; } -std::string WalletModelTransaction::getTxComment() +std::string WalletModelTransaction::getFloData() { - return strTxComment; + return strFloData; } CWalletTx *WalletModelTransaction::getTransaction() diff --git a/src/qt/walletmodeltransaction.h b/src/qt/walletmodeltransaction.h index 92443b058..8fba4ebaa 100755 --- a/src/qt/walletmodeltransaction.h +++ b/src/qt/walletmodeltransaction.h @@ -20,7 +20,7 @@ class CWalletTx; class WalletModelTransaction { public: - explicit WalletModelTransaction(const QList &recipients, std::string txComment); + explicit WalletModelTransaction(const QList &recipients, std::string floData); ~WalletModelTransaction(); QList getRecipients(); @@ -30,7 +30,7 @@ public: void setTransactionFee(const CAmount& newFee); CAmount getTransactionFee(); - std::string getTxComment(); + std::string getFloData(); CAmount getTotalTransactionAmount(); @@ -44,7 +44,7 @@ private: CWalletTx *walletTransaction; CReserveKey *keyChange; CAmount fee; - std::string strTxComment; + std::string strFloData; }; #endif // BITCOIN_QT_WALLETMODELTRANSACTION_H diff --git a/src/rpc/mining.cpp b/src/rpc/mining.cpp index 6303efaf8..65653a99d 100755 --- a/src/rpc/mining.cpp +++ b/src/rpc/mining.cpp @@ -106,7 +106,7 @@ UniValue getnetworkhashps(const JSONRPCRequest& request) return GetNetworkHashPS(!request.params[0].isNull() ? request.params[0].get_int() : 120, !request.params[1].isNull() ? request.params[1].get_int() : -1); } -UniValue generateBlocks(std::shared_ptr coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, std::string strTxComment) +UniValue generateBlocks(std::shared_ptr coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, std::string strFloData) { static const int nInnerLoopCount = 0x10000; int nHeightEnd = 0; @@ -121,7 +121,7 @@ UniValue generateBlocks(std::shared_ptr coinbaseScript, int nGen UniValue blockHashes(UniValue::VARR); while (nHeight < nHeightEnd) { - std::unique_ptr pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript, true, strTxComment)); + std::unique_ptr pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript, true, strFloData)); if (!pblocktemplate.get()) throw JSONRPCError(RPC_INTERNAL_ERROR, "Couldn't create new block"); CBlock *pblock = &pblocktemplate->block; @@ -164,7 +164,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request) "1. nblocks (numeric, required) How many blocks are generated immediately.\n" "2. address (string, required) The address to send the newly generated flo to.\n" "3. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" - "4. tx-comment (string, optional) Coinbase transaction tx-comment (default = \"\").\n" + "4. flo-data (string, optional) Coinbase transaction flo-data (default = \"\").\n" "\nResult:\n" "[ blockhashes ] (array) hashes of blocks generated\n" "\nExamples:\n" @@ -178,9 +178,9 @@ UniValue generatetoaddress(const JSONRPCRequest& request) nMaxTries = request.params[2].get_int(); } - std::string coinbaseTxComment = ""; + std::string coinbaseFloData = ""; if (!request.params[3].isNull()) { - coinbaseTxComment = request.params[3].get_str(); + coinbaseFloData = request.params[3].get_str(); } CBitcoinAddress address(request.params[1].get_str()); @@ -192,7 +192,7 @@ UniValue generatetoaddress(const JSONRPCRequest& request) - return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false, coinbaseTxComment); + return generateBlocks(coinbaseScript, nGenerate, nMaxTries, false, coinbaseFloData); } UniValue getmininginfo(const JSONRPCRequest& request) diff --git a/src/rpc/mining.h b/src/rpc/mining.h index 77d2f341e..3c8b61781 100755 --- a/src/rpc/mining.h +++ b/src/rpc/mining.h @@ -11,7 +11,7 @@ #include /** Generate blocks (mine) */ -UniValue generateBlocks(std::shared_ptr coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, std::string strTxComment); +UniValue generateBlocks(std::shared_ptr coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, std::string strFloData); /** Check bounds on a command line confirm target */ unsigned int ParseConfirmTarget(const UniValue& value); diff --git a/src/rpc/rawtransaction.cpp b/src/rpc/rawtransaction.cpp index f1d1f402d..5513eca8e 100755 --- a/src/rpc/rawtransaction.cpp +++ b/src/rpc/rawtransaction.cpp @@ -292,7 +292,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request) { if (request.fHelp || request.params.size() < 2 || request.params.size() > 5) throw std::runtime_error( - "createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,\"data\":\"hex\",...} ( locktime ) ( replaceable ) ( txcomment )\n" + "createrawtransaction [{\"txid\":\"id\",\"vout\":n},...] {\"address\":amount,\"data\":\"hex\",...} ( locktime ) ( replaceable ) ( flodata )\n" "\nCreate a transaction spending the given inputs and creating new outputs.\n" "Outputs can be addresses or data.\n" "Returns hex-encoded raw transaction.\n" @@ -318,7 +318,7 @@ UniValue createrawtransaction(const JSONRPCRequest& request) "3. locktime (numeric, optional, default=0) Raw locktime. Non-0 value also locktime-activates inputs\n" "4. replaceable (boolean, optional, default=false) Marks this transaction as BIP125 replaceable.\n" " Allows this transaction to be replaced by a transaction with higher fees. If provided, it is an error if explicit sequence numbers are incompatible.\n" - "5. tx-comment (string, optional) Transaction tx-comment (default = \"\").\n" + "5. flo-data (string, optional) Transaction flo-data (default = \"\").\n" "\nResult:\n" "\"transaction\" (string) hex string of the transaction\n" @@ -347,9 +347,9 @@ UniValue createrawtransaction(const JSONRPCRequest& request) bool rbfOptIn = request.params.size() > 3 ? request.params[3].isTrue() : false; - rawTx.strTxComment = ""; + rawTx.strFloData = ""; if (request.params.size() > 4 && !request.params[4].isNull()) { - rawTx.strTxComment = request.params[4].get_str(); + rawTx.strFloData = request.params[4].get_str(); } for (unsigned int idx = 0; idx < inputs.size(); idx++) { @@ -587,18 +587,18 @@ UniValue combinerawtransaction(const JSONRPCRequest& request) UniValue txs = request.params[0].get_array(); std::vector txVariants(txs.size()); - bool commentExists = false; - std::string strTxComment = ""; + bool floDataExists = false; + std::string strFloData = ""; for (unsigned int idx = 0; idx < txs.size(); idx++) { if (!DecodeHexTx(txVariants[idx], txs[idx].get_str(), true)) { throw JSONRPCError(RPC_DESERIALIZATION_ERROR, strprintf("TX decode failed for tx %d", idx)); } - if (txVariants[idx].strTxComment != "") { - if (commentExists) { - throw JSONRPCError(RPC_VERIFY_ERROR, "Only one transaction comment is allowed"); + if (txVariants[idx].strFloData != "") { + if (floDataExists) { + throw JSONRPCError(RPC_VERIFY_ERROR, "Only one transaction floData is allowed"); } - commentExists = true; - strTxComment = txVariants[idx].strTxComment; + floDataExists = true; + strFloData = txVariants[idx].strFloData; } } @@ -609,7 +609,7 @@ UniValue combinerawtransaction(const JSONRPCRequest& request) // mergedTx will end up with all the signatures; it // starts as a clone of the rawtx: CMutableTransaction mergedTx(txVariants[0]); - mergedTx.strTxComment = strTxComment; + mergedTx.strFloData = strFloData; // Fetch previous transactions (inputs): CCoinsView viewDummy; @@ -980,7 +980,7 @@ static const CRPCCommand commands[] = { // category name actor (function) okSafeMode // --------------------- ------------------------ ----------------------- ---------- { "rawtransactions", "getrawtransaction", &getrawtransaction, true, {"txid","verbose"} }, - { "rawtransactions", "createrawtransaction", &createrawtransaction, true, {"inputs","outputs","locktime","replaceable","tx-comment"} }, + { "rawtransactions", "createrawtransaction", &createrawtransaction, true, {"inputs","outputs","locktime","replaceable","flo-data"} }, { "rawtransactions", "decoderawtransaction", &decoderawtransaction, true, {"hexstring"} }, { "rawtransactions", "decodescript", &decodescript, true, {"hexstring"} }, { "rawtransactions", "sendrawtransaction", &sendrawtransaction, false, {"hexstring","allowhighfees"} }, diff --git a/src/script/interpreter.cpp b/src/script/interpreter.cpp index df2592d42..bdad78a71 100755 --- a/src/script/interpreter.cpp +++ b/src/script/interpreter.cpp @@ -1058,7 +1058,7 @@ private: const bool fAnyoneCanPay; //!< whether the hashtype has the SIGHASH_ANYONECANPAY flag set const bool fHashSingle; //!< whether the hashtype is SIGHASH_SINGLE const bool fHashNone; //!< whether the hashtype is SIGHASH_NONE - const bool fOmitTxComment; //!< whether the hashtype has the SIGHASH_OMIT_TX_COMMENT flag set + const bool fOmitFloData; //!< whether the hashtype has the SIGHASH_OMIT_FLO_DATA flag set public: CTransactionSignatureSerializer(const CTransaction &txToIn, const CScript &scriptCodeIn, unsigned int nInIn, int nHashTypeIn) : @@ -1066,7 +1066,7 @@ public: fAnyoneCanPay(!!(nHashTypeIn & SIGHASH_ANYONECANPAY)), fHashSingle((nHashTypeIn & 0x1f) == SIGHASH_SINGLE), fHashNone((nHashTypeIn & 0x1f) == SIGHASH_NONE), - fOmitTxComment(!!(nHashTypeIn & SIGHASH_OMIT_TX_COMMENT)){} + fOmitFloData(!!(nHashTypeIn & SIGHASH_OMIT_FLO_DATA)){} /** Serialize the passed scriptCode, skipping OP_CODESEPARATORs */ template @@ -1140,9 +1140,9 @@ public: SerializeOutput(s, nOutput); // Serialize nLockTime ::Serialize(s, txTo.nLockTime); - // Serialize strTxComment - if (txTo.nVersion >= 2 && fOmitTxComment == 0) - ::Serialize(s, txTo.strTxComment); + // Serialize strFloData + if (txTo.nVersion >= 2 && fOmitFloData == 0) + ::Serialize(s, txTo.strFloData); } }; @@ -1220,9 +1220,9 @@ uint256 SignatureHash(const CScript& scriptCode, const CTransaction& txTo, unsig ss << hashOutputs; // Locktime ss << txTo.nLockTime; - // TX Comment + // FLO Data if (txTo.nVersion >= 2) - ss << txTo.strTxComment; + ss << txTo.strFloData; // Sighash type ss << nHashType; @@ -1249,7 +1249,7 @@ uint256 SignatureHash(const CScript& scriptCode, const CTransaction& txTo, unsig // Serialize and hash CHashWriter ss(SER_GETHASH, 0); - nHashType &= ~SIGHASH_OMIT_TX_COMMENT; // clear SIGHASH_OMIT_TX_COMMENT - Flag is only used for 0.10.4 compat + nHashType &= ~SIGHASH_OMIT_FLO_DATA; // clear SIGHASH_OMIT_FLO_DATA - Flag is only used for 0.10.4 compat // it's used internally but must not actually appear in the result ss << txTmp << nHashType; @@ -1277,8 +1277,8 @@ bool TransactionSignatureChecker::CheckSig(const std::vector& vch uint256 sighash = SignatureHash(scriptCode, *txTo, nIn, nHashType, amount, sigversion, this->txdata); if (!VerifySignature(vchSig, pubkey, sighash)){ - // Verification failed, toggle SIGHASH_OMIT_TX_COMMENT and try again - nHashType ^= SIGHASH_OMIT_TX_COMMENT; + // Verification failed, toggle SIGHASH_OMIT_FLO_DATA and try again + nHashType ^= SIGHASH_OMIT_FLO_DATA; // need a new vchSig std::vector vchSig2(vchSigIn); diff --git a/src/script/interpreter.h b/src/script/interpreter.h index 537e1a4b7..dff56ec4b 100755 --- a/src/script/interpreter.h +++ b/src/script/interpreter.h @@ -26,7 +26,7 @@ enum SIGHASH_NONE = 2, SIGHASH_SINGLE = 3, SIGHASH_ANYONECANPAY = 0x80, - SIGHASH_OMIT_TX_COMMENT = (1U << 6), + SIGHASH_OMIT_FLO_DATA = (1U << 6), }; /** Script verification flags */ diff --git a/src/script/sign.cpp b/src/script/sign.cpp index 41ed4949f..f5b947053 100755 --- a/src/script/sign.cpp +++ b/src/script/sign.cpp @@ -30,9 +30,9 @@ bool TransactionSignatureCreator::CreateSig(std::vector& vchSig, int tempHashType = nHashType; if (sigversion != SIGVERSION_WITNESS_V0) { - // Compatibility with v0.10.4 requires not signing the tx comment + // Compatibility with v0.10.4 requires not signing the flo data // Once v0.10.4 is sufficiently fazed out this should be removed - tempHashType |= SIGHASH_OMIT_TX_COMMENT; + tempHashType |= SIGHASH_OMIT_FLO_DATA; } uint256 hash = SignatureHash(scriptCode, *txTo, nIn, tempHashType, amount, sigversion); if (!key.Sign(hash, vchSig)) diff --git a/src/test/sighash_tests.cpp b/src/test/sighash_tests.cpp index 598bbe5af..76f0631c1 100755 --- a/src/test/sighash_tests.cpp +++ b/src/test/sighash_tests.cpp @@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(sighash_test) #endif for (int i=0; iGetBalance(); @@ -401,7 +401,7 @@ static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CA int nChangePosRet = -1; CRecipient recipient = {scriptPubKey, nValue, fSubtractFeeFromAmount}; vecSend.push_back(recipient); - if (!pwallet->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet, strError, coin_control, strTxComment)) { + if (!pwallet->CreateTransaction(vecSend, wtxNew, reservekey, nFeeRequired, nChangePosRet, strError, coin_control, strFloData)) { if (!fSubtractFeeFromAmount && nValue + nFeeRequired > curBalance) strError = strprintf("Error: This transaction requires a transaction fee of at least %s", FormatMoney(nFeeRequired)); throw JSONRPCError(RPC_WALLET_ERROR, strError); @@ -422,7 +422,7 @@ UniValue sendtoaddress(const JSONRPCRequest& request) if (request.fHelp || request.params.size() < 2 || request.params.size() > 9) throw std::runtime_error( - "sendtoaddress \"address\" amount ( \"comment\" \"comment_to\" subtractfeefromamount replaceable conf_target \"estimate_mode\" \"txcomment\")\n" + "sendtoaddress \"address\" amount ( \"comment\" \"comment_to\" subtractfeefromamount replaceable conf_target \"estimate_mode\" \"flodata\")\n" "\nSend an amount to a given address.\n" + HelpRequiringPassphrase(pwallet) + "\nArguments:\n" @@ -441,7 +441,7 @@ UniValue sendtoaddress(const JSONRPCRequest& request) " \"UNSET\"\n" " \"ECONOMICAL\"\n" " \"CONSERVATIVE\"\n" - "9. tx-comment (string, optional) Transaction tx-comment (default = \"\").\n" + "9. flo-data (string, optional) Transaction flo-data (default = \"\").\n" "\nResult:\n" "\"txid\" (string) The transaction id.\n" "\nExamples:\n" @@ -489,14 +489,14 @@ UniValue sendtoaddress(const JSONRPCRequest& request) } } - std::string strTxComment = ""; + std::string strFloData = ""; if (request.params.size() > 8 && !request.params[8].isNull()) { - strTxComment = request.params[8].get_str(); + strFloData = request.params[8].get_str(); } EnsureWalletIsUnlocked(pwallet); - SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, coin_control, strTxComment); + SendMoney(pwallet, address.Get(), nAmount, fSubtractFeeFromAmount, wtx, coin_control, strFloData); return wtx.GetHash().GetHex(); } @@ -884,7 +884,7 @@ UniValue sendfrom(const JSONRPCRequest& request) "6. \"comment_to\" (string, optional) An optional comment to store the name of the person or organization \n" " to which you're sending the transaction. This is not part of the transaction, \n" " it is just kept in your wallet.\n" - "7. tx-comment (string, optional) Transaction comment (default = \"\").\n" + "7. flo-data (string, optional) Transaction comment (default = \"\").\n" "\nResult:\n" "\"txid\" (string) The transaction id.\n" "\nExamples:\n" @@ -916,9 +916,9 @@ UniValue sendfrom(const JSONRPCRequest& request) if (request.params.size() > 5 && !request.params[5].isNull() && !request.params[5].get_str().empty()) wtx.mapValue["to"] = request.params[5].get_str(); - std::string strTxComment = ""; + std::string strFloData = ""; if (request.params.size() > 6 && !request.params[6].isNull()) { - strTxComment = request.params[6].get_str(); + strFloData = request.params[6].get_str(); } EnsureWalletIsUnlocked(pwallet); @@ -929,7 +929,7 @@ UniValue sendfrom(const JSONRPCRequest& request) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, "Account has insufficient funds"); CCoinControl no_coin_control; // This is a deprecated API - SendMoney(pwallet, address.Get(), nAmount, false, wtx, no_coin_control, strTxComment); + SendMoney(pwallet, address.Get(), nAmount, false, wtx, no_coin_control, strFloData); return wtx.GetHash().GetHex(); } @@ -970,7 +970,7 @@ UniValue sendmany(const JSONRPCRequest& request) " \"UNSET\"\n" " \"ECONOMICAL\"\n" " \"CONSERVATIVE\"\n" - "9. tx-comment (string, optional) Transaction comment (default = \"\").\n" + "9. flo-data (string, optional) Transaction comment (default = \"\").\n" "\nResult:\n" "\"txid\" (string) The transaction id for the send. Only 1 transaction is created regardless of \n" " the number of addresses.\n" @@ -1021,9 +1021,9 @@ UniValue sendmany(const JSONRPCRequest& request) } } - std::string strTxComment = ""; + std::string strFloData = ""; if (request.params.size() > 8 && !request.params[8].isNull()) { - strTxComment = request.params[8].get_str(); + strFloData = request.params[8].get_str(); } std::set setAddress; @@ -1070,7 +1070,7 @@ UniValue sendmany(const JSONRPCRequest& request) CAmount nFeeRequired = 0; int nChangePosRet = -1; std::string strFailReason; - bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, coin_control, strTxComment); + bool fCreated = pwallet->CreateTransaction(vecSend, wtx, keyChange, nFeeRequired, nChangePosRet, strFailReason, coin_control, strFloData); if (!fCreated) throw JSONRPCError(RPC_WALLET_INSUFFICIENT_FUNDS, strFailReason); CValidationState state; @@ -3120,7 +3120,7 @@ UniValue generate(const JSONRPCRequest& request) "\nArguments:\n" "1. nblocks (numeric, required) How many blocks are generated immediately.\n" "2. maxtries (numeric, optional) How many iterations to try (default = 1000000).\n" - "3. tx-comment (string, optional) Coinbase transaction tx-comment (default = \"\").\n" + "3. flo-data (string, optional) Coinbase transaction flo-data (default = \"\").\n" "\nResult:\n" "[ blockhashes ] (array) hashes of blocks generated\n" "\nExamples:\n" @@ -3135,9 +3135,9 @@ UniValue generate(const JSONRPCRequest& request) max_tries = request.params[1].get_int(); } - std::string coinbaseTxComment = ""; + std::string coinbaseFloData = ""; if (!request.params[2].isNull()) { - coinbaseTxComment = request.params[2].get_str(); + coinbaseFloData = request.params[2].get_str(); } std::shared_ptr coinbase_script; @@ -3153,7 +3153,7 @@ UniValue generate(const JSONRPCRequest& request) throw JSONRPCError(RPC_INTERNAL_ERROR, "No coinbase script available"); } - return generateBlocks(coinbase_script, num_generate, max_tries, true, coinbaseTxComment); + return generateBlocks(coinbase_script, num_generate, max_tries, true, coinbaseFloData); } extern UniValue abortrescan(const JSONRPCRequest& request); // in rpcdump.cpp @@ -3210,9 +3210,9 @@ static const CRPCCommand commands[] = { "wallet", "listwallets", &listwallets, true, {} }, { "wallet", "lockunspent", &lockunspent, true, {"unlock","transactions"} }, { "wallet", "move", &movecmd, false, {"fromaccount","toaccount","amount","minconf","comment"} }, - { "wallet", "sendfrom", &sendfrom, false, {"fromaccount","toaddress","amount","minconf","comment","comment_to","tx-comment"} }, - { "wallet", "sendmany", &sendmany, false, {"fromaccount","amounts","minconf","comment","subtractfeefrom","replaceable","conf_target","estimate_mode","tx-comment"} }, - { "wallet", "sendtoaddress", &sendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount","replaceable","conf_target","estimate_mode","tx-comment"} }, + { "wallet", "sendfrom", &sendfrom, false, {"fromaccount","toaddress","amount","minconf","comment","comment_to","flo-data"} }, + { "wallet", "sendmany", &sendmany, false, {"fromaccount","amounts","minconf","comment","subtractfeefrom","replaceable","conf_target","estimate_mode","flo-data"} }, + { "wallet", "sendtoaddress", &sendtoaddress, false, {"address","amount","comment","comment_to","subtractfeefromamount","replaceable","conf_target","estimate_mode","flo-data"} }, { "wallet", "setaccount", &setaccount, true, {"address","account"} }, { "wallet", "settxfee", &settxfee, true, {"amount"} }, { "wallet", "signmessage", &signmessage, true, {"address","message"} }, diff --git a/src/wallet/wallet.cpp b/src/wallet/wallet.cpp index c27109fd8..b61240168 100755 --- a/src/wallet/wallet.cpp +++ b/src/wallet/wallet.cpp @@ -2613,7 +2613,7 @@ static CFeeRate GetDiscardRate(const CBlockPolicyEstimator& estimator) } bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, - int& nChangePosInOut, std::string& strFailReason, const CCoinControl& coin_control, std::string strTxComment, bool sign) + int& nChangePosInOut, std::string& strFailReason, const CCoinControl& coin_control, std::string strFloData, bool sign) { CAmount nValue = 0; int nChangePosRequest = nChangePosInOut; @@ -2640,7 +2640,7 @@ bool CWallet::CreateTransaction(const std::vector& vecSend, CWalletT wtxNew.BindWallet(this); CMutableTransaction txNew; - txNew.strTxComment = strTxComment; + txNew.strFloData = strFloData; // Discourage fee sniping. // diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h index 3635920cc..9b049345c 100755 --- a/src/wallet/wallet.h +++ b/src/wallet/wallet.h @@ -949,7 +949,7 @@ public: * @note passing nChangePosInOut as -1 will result in setting a random position */ bool CreateTransaction(const std::vector& vecSend, CWalletTx& wtxNew, CReserveKey& reservekey, CAmount& nFeeRet, int& nChangePosInOut, - std::string& strFailReason, const CCoinControl& coin_control, std::string strTxComment = "", bool sign = true); + std::string& strFailReason, const CCoinControl& coin_control, std::string strFloData = "", bool sign = true); bool CommitTransaction(CWalletTx& wtxNew, CReserveKey& reservekey, CConnman* connman, CValidationState& state); void ListAccountCreditDebit(const std::string& strAccount, std::list& entries); diff --git a/test/functional/p2p-fullblocktest.py b/test/functional/p2p-fullblocktest.py index 5ec7a82f7..45f8849b7 100755 --- a/test/functional/p2p-fullblocktest.py +++ b/test/functional/p2p-fullblocktest.py @@ -360,7 +360,7 @@ class FullBlockTest(ComparisonTestFramework): tip(15) b23 = block(23, spend=out[6]) tx = CTransaction() - script_length = MAX_BLOCK_BASE_SIZE - len(b23.serialize()) - 69 - 1 #subtract 1 for txComment byte + script_length = MAX_BLOCK_BASE_SIZE - len(b23.serialize()) - 69 - 1 #subtract 1 for floData byte script_output = CScript([b'\x00' * script_length]) tx.vout.append(CTxOut(0, script_output)) tx.vin.append(CTxIn(COutPoint(b23.vtx[1].sha256, 0))) @@ -373,7 +373,7 @@ class FullBlockTest(ComparisonTestFramework): # Make the next block one byte bigger and check that it fails tip(15) b24 = block(24, spend=out[6]) - script_length = MAX_BLOCK_BASE_SIZE - len(b24.serialize()) - 69 - 1 #subtract 1 for txComment byte + script_length = MAX_BLOCK_BASE_SIZE - len(b24.serialize()) - 69 - 1 #subtract 1 for floData byte script_output = CScript([b'\x00' * (script_length+1)]) tx.vout = [CTxOut(0, script_output)] b24 = update_block(24, [tx]) @@ -902,7 +902,7 @@ class FullBlockTest(ComparisonTestFramework): tx = CTransaction() # use canonical serialization to calculate size - script_length = MAX_BLOCK_BASE_SIZE - len(b64a.normal_serialize()) - 69 - 1 #subtract 1 for txComment byte + script_length = MAX_BLOCK_BASE_SIZE - len(b64a.normal_serialize()) - 69 - 1 #subtract 1 for floData byte script_output = CScript([b'\x00' * script_length]) tx.vout.append(CTxOut(0, script_output)) tx.vin.append(CTxIn(COutPoint(b64a.vtx[1].sha256, 0))) @@ -1251,7 +1251,7 @@ class FullBlockTest(ComparisonTestFramework): for i in range(89, LARGE_REORG_SIZE + 89): b = block(i, spend) tx = CTransaction() - script_length = MAX_BLOCK_BASE_SIZE - len(b.serialize()) - 69 - 1 #subtract 1 for txComment byte + script_length = MAX_BLOCK_BASE_SIZE - len(b.serialize()) - 69 - 1 #subtract 1 for floData byte script_output = CScript([b'\x00' * script_length]) tx.vout.append(CTxOut(0, script_output)) tx.vin.append(CTxIn(COutPoint(b.vtx[1].sha256, 0))) diff --git a/test/functional/p2p-segwit.py b/test/functional/p2p-segwit.py index d297cc890..a948aa135 100755 --- a/test/functional/p2p-segwit.py +++ b/test/functional/p2p-segwit.py @@ -760,9 +760,9 @@ class SegWitTest(BitcoinTestFramework): r += self.wit.serialize() r += struct.pack("= 2: - r += ser_compact_size(len(self.txComment)) - if len(self.txComment) > 0: - r += struct.pack(" 0: + r += struct.pack("= 2: - self.txComment = deser_string(f) + self.floData = deser_string(f) self.sha256 = None self.hash = None @@ -475,7 +475,7 @@ class CTransaction(object): r += ser_vector(self.vout) r += struct.pack("= 2: - r += ser_string(self.txComment) + r += ser_string(self.floData) return r # Only serialize with witness when explicitly called for @@ -500,7 +500,7 @@ class CTransaction(object): r += self.wit.serialize() r += struct.pack("= 2: - r += ser_string(self.txComment) + r += ser_string(self.floData) return r # Regular serialization is without witness -- must explicitly diff --git a/test/functional/test_framework/script.py b/test/functional/test_framework/script.py index c2bebd7ac..88f87cdf3 100755 --- a/test/functional/test_framework/script.py +++ b/test/functional/test_framework/script.py @@ -936,7 +936,7 @@ def SegwitVersion1SignatureHash(script, txTo, inIdx, hashtype, amount): ss += ser_uint256(hashOutputs) ss += struct.pack("= 2: - ss += ser_string(txTo.txComment) + ss += ser_string(txTo.floData) ss += struct.pack("