txComment updated to floData
This commit is contained in:
parent
d5b57e70af
commit
7aa6e66e89
@ -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<unsigned char>((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)
|
||||
|
||||
@ -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());
|
||||
|
||||
@ -128,7 +128,7 @@ void BlockAssembler::resetBlock()
|
||||
nFees = 0;
|
||||
}
|
||||
|
||||
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx, std::string coinbaseTxComment)
|
||||
std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx, std::string coinbaseFloData)
|
||||
{
|
||||
int64_t nTimeStart = GetTimeMicros();
|
||||
|
||||
@ -188,7 +188,7 @@ std::unique_ptr<CBlockTemplate> 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;
|
||||
|
||||
@ -169,7 +169,7 @@ public:
|
||||
BlockAssembler(const CChainParams& params, const Options& options);
|
||||
|
||||
/** Construct a new block template with coinbase to scriptPubKeyIn */
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx=true, std::string coinbaseTxComment="");
|
||||
std::unique_ptr<CBlockTemplate> CreateNewBlock(const CScript& scriptPubKeyIn, bool fMineWitnessTx=true, std::string coinbaseFloData="");
|
||||
|
||||
private:
|
||||
// utility functions
|
||||
|
||||
@ -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;
|
||||
}
|
||||
|
||||
@ -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<CTxIn> vin;
|
||||
const std::vector<CTxOut> vout;
|
||||
const uint32_t nLockTime;
|
||||
const std::string strTxComment;
|
||||
const std::string strFloData;
|
||||
|
||||
private:
|
||||
/** Memory only. */
|
||||
@ -373,7 +373,7 @@ struct CMutableTransaction
|
||||
std::vector<CTxIn> vin;
|
||||
std::vector<CTxOut> vout;
|
||||
uint32_t nLockTime;
|
||||
std::string strTxComment;
|
||||
std::string strFloData;
|
||||
|
||||
CMutableTransaction();
|
||||
CMutableTransaction(const CTransaction& tx);
|
||||
|
||||
6
src/qt/forms/sendcoinsdialog.ui
Normal file → Executable file
6
src/qt/forms/sendcoinsdialog.ui
Normal file → Executable file
@ -631,14 +631,14 @@
|
||||
<item>
|
||||
<layout class="QHBoxLayout" name="horizontalLayout_3">
|
||||
<item>
|
||||
<widget class="QLabel" name="txCommentLabel">
|
||||
<widget class="QLabel" name="floDataLabel">
|
||||
<property name="text">
|
||||
<string>TX Comment: </string>
|
||||
<string>FLO Data: </string>
|
||||
</property>
|
||||
</widget>
|
||||
</item>
|
||||
<item>
|
||||
<widget class="QLineEdit" name="txComment"/>
|
||||
<widget class="QLineEdit" name="floData"/>
|
||||
</item>
|
||||
</layout>
|
||||
</item>
|
||||
|
||||
@ -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
|
||||
|
||||
@ -271,9 +271,9 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
strHTML += "<br>" + 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)) + "<br>";
|
||||
}
|
||||
|
||||
// Transaction Comment
|
||||
if (!wtx.tx->strTxComment.empty())
|
||||
strHTML += "<br><b>" + tr("Transaction Comment") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.tx->strTxComment, true) + "<br>";
|
||||
// FLO Data
|
||||
if (!wtx.tx->strFloData.empty())
|
||||
strHTML += "<br><b>" + tr("FLO Data") + ":</b><br>" + GUIUtil::HtmlEscape(wtx.tx->strFloData, true) + "<br>";
|
||||
|
||||
//
|
||||
// Debug view
|
||||
|
||||
@ -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);
|
||||
|
||||
@ -8,12 +8,12 @@
|
||||
#include "policy/policy.h"
|
||||
#include "wallet/wallet.h"
|
||||
|
||||
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients, std::string txComment) :
|
||||
WalletModelTransaction::WalletModelTransaction(const QList<SendCoinsRecipient> &_recipients, std::string floData) :
|
||||
recipients(_recipients),
|
||||
walletTransaction(0),
|
||||
keyChange(0),
|
||||
fee(0),
|
||||
strTxComment(txComment)
|
||||
strFloData(floData)
|
||||
{
|
||||
walletTransaction = new CWalletTx();
|
||||
}
|
||||
@ -29,9 +29,9 @@ QList<SendCoinsRecipient> WalletModelTransaction::getRecipients()
|
||||
return recipients;
|
||||
}
|
||||
|
||||
std::string WalletModelTransaction::getTxComment()
|
||||
std::string WalletModelTransaction::getFloData()
|
||||
{
|
||||
return strTxComment;
|
||||
return strFloData;
|
||||
}
|
||||
|
||||
CWalletTx *WalletModelTransaction::getTransaction()
|
||||
|
||||
@ -20,7 +20,7 @@ class CWalletTx;
|
||||
class WalletModelTransaction
|
||||
{
|
||||
public:
|
||||
explicit WalletModelTransaction(const QList<SendCoinsRecipient> &recipients, std::string txComment);
|
||||
explicit WalletModelTransaction(const QList<SendCoinsRecipient> &recipients, std::string floData);
|
||||
~WalletModelTransaction();
|
||||
|
||||
QList<SendCoinsRecipient> 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
|
||||
|
||||
@ -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<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, std::string strTxComment)
|
||||
UniValue generateBlocks(std::shared_ptr<CReserveScript> 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<CReserveScript> coinbaseScript, int nGen
|
||||
UniValue blockHashes(UniValue::VARR);
|
||||
while (nHeight < nHeightEnd)
|
||||
{
|
||||
std::unique_ptr<CBlockTemplate> pblocktemplate(BlockAssembler(Params()).CreateNewBlock(coinbaseScript->reserveScript, true, strTxComment));
|
||||
std::unique_ptr<CBlockTemplate> 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)
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
#include <univalue.h>
|
||||
|
||||
/** Generate blocks (mine) */
|
||||
UniValue generateBlocks(std::shared_ptr<CReserveScript> coinbaseScript, int nGenerate, uint64_t nMaxTries, bool keepScript, std::string strTxComment);
|
||||
UniValue generateBlocks(std::shared_ptr<CReserveScript> 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);
|
||||
|
||||
@ -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<CMutableTransaction> 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"} },
|
||||
|
||||
@ -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<typename S>
|
||||
@ -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<unsigned char>& 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<unsigned char> vchSig2(vchSigIn);
|
||||
|
||||
@ -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 */
|
||||
|
||||
@ -30,9 +30,9 @@ bool TransactionSignatureCreator::CreateSig(std::vector<unsigned char>& 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))
|
||||
|
||||
@ -136,7 +136,7 @@ BOOST_AUTO_TEST_CASE(sighash_test)
|
||||
#endif
|
||||
for (int i=0; i<nRandomTests; i++) {
|
||||
int nHashType = InsecureRand32();
|
||||
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
|
||||
CMutableTransaction txTo;
|
||||
RandomTransaction(txTo, (nHashType & 0x1f) == SIGHASH_SINGLE);
|
||||
CScript scriptCode;
|
||||
|
||||
@ -375,7 +375,7 @@ UniValue getaddressesbyaccount(const JSONRPCRequest& request)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, const CCoinControl& coin_control, std::string strTxComment)
|
||||
static void SendMoney(CWallet * const pwallet, const CTxDestination &address, CAmount nValue, bool fSubtractFeeFromAmount, CWalletTx& wtxNew, const CCoinControl& coin_control, std::string strFloData)
|
||||
{
|
||||
CAmount curBalance = pwallet->GetBalance();
|
||||
|
||||
@ -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<CBitcoinAddress> 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<CReserveScript> 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"} },
|
||||
|
||||
@ -2613,7 +2613,7 @@ static CFeeRate GetDiscardRate(const CBlockPolicyEstimator& estimator)
|
||||
}
|
||||
|
||||
bool CWallet::CreateTransaction(const std::vector<CRecipient>& 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<CRecipient>& vecSend, CWalletT
|
||||
wtxNew.BindWallet(this);
|
||||
CMutableTransaction txNew;
|
||||
|
||||
txNew.strTxComment = strTxComment;
|
||||
txNew.strFloData = strFloData;
|
||||
|
||||
// Discourage fee sniping.
|
||||
//
|
||||
|
||||
@ -949,7 +949,7 @@ public:
|
||||
* @note passing nChangePosInOut as -1 will result in setting a random position
|
||||
*/
|
||||
bool CreateTransaction(const std::vector<CRecipient>& 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<CAccountingEntry>& entries);
|
||||
|
||||
@ -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)))
|
||||
|
||||
@ -760,9 +760,9 @@ class SegWitTest(BitcoinTestFramework):
|
||||
r += self.wit.serialize()
|
||||
r += struct.pack("<I", self.nLockTime)
|
||||
if self.nVersion >= 2:
|
||||
r += ser_compact_size(len(self.txComment))
|
||||
if len(self.txComment) > 0:
|
||||
r += struct.pack("<s", self.txComment)
|
||||
r += ser_compact_size(len(self.floData))
|
||||
if len(self.floData) > 0:
|
||||
r += struct.pack("<s", self.floData)
|
||||
return r
|
||||
|
||||
tx2 = BrokenCTransaction()
|
||||
|
||||
@ -435,7 +435,7 @@ class CTransaction(object):
|
||||
self.nLockTime = 0
|
||||
self.sha256 = None
|
||||
self.hash = None
|
||||
self.txComment = b""
|
||||
self.floData = b""
|
||||
else:
|
||||
self.nVersion = tx.nVersion
|
||||
self.vin = copy.deepcopy(tx.vin)
|
||||
@ -444,7 +444,7 @@ class CTransaction(object):
|
||||
self.sha256 = tx.sha256
|
||||
self.hash = tx.hash
|
||||
self.wit = copy.deepcopy(tx.wit)
|
||||
self.txComment = tx.txComment
|
||||
self.floData = tx.floData
|
||||
|
||||
def deserialize(self, f):
|
||||
self.nVersion = struct.unpack("<i", f.read(4))[0]
|
||||
@ -464,7 +464,7 @@ class CTransaction(object):
|
||||
self.wit.deserialize(f)
|
||||
self.nLockTime = struct.unpack("<I", f.read(4))[0]
|
||||
if self.nVersion >= 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("<I", self.nLockTime)
|
||||
if self.nVersion >= 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("<I", self.nLockTime)
|
||||
if self.nVersion >= 2:
|
||||
r += ser_string(self.txComment)
|
||||
r += ser_string(self.floData)
|
||||
return r
|
||||
|
||||
# Regular serialization is without witness -- must explicitly
|
||||
|
||||
@ -936,7 +936,7 @@ def SegwitVersion1SignatureHash(script, txTo, inIdx, hashtype, amount):
|
||||
ss += ser_uint256(hashOutputs)
|
||||
ss += struct.pack("<i", txTo.nLockTime)
|
||||
if txTo.nVersion >= 2:
|
||||
ss += ser_string(txTo.txComment)
|
||||
ss += ser_string(txTo.floData)
|
||||
ss += struct.pack("<I", hashtype)
|
||||
|
||||
return hash256(ss)
|
||||
|
||||
2
test/util/data/blanktxv1.json
Normal file → Executable file
2
test/util/data/blanktxv1.json
Normal file → Executable file
@ -9,6 +9,6 @@
|
||||
],
|
||||
"vout": [
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000000000000000"
|
||||
}
|
||||
|
||||
2
test/util/data/blanktxv2.json
Normal file → Executable file
2
test/util/data/blanktxv2.json
Normal file → Executable file
@ -9,6 +9,6 @@
|
||||
],
|
||||
"vout": [
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0200000000000000000000"
|
||||
}
|
||||
|
||||
2
test/util/data/tt-delin1-out.json
Normal file → Executable file
2
test/util/data/tt-delin1-out.json
Normal file → Executable file
File diff suppressed because one or more lines are too long
2
test/util/data/tt-delout1-out.json
Normal file → Executable file
2
test/util/data/tt-delout1-out.json
Normal file → Executable file
File diff suppressed because one or more lines are too long
2
test/util/data/tt-locktime317000-out.json
Normal file → Executable file
2
test/util/data/tt-locktime317000-out.json
Normal file → Executable file
File diff suppressed because one or more lines are too long
2
test/util/data/txcreate1.json
Normal file → Executable file
2
test/util/data/txcreate1.json
Normal file → Executable file
@ -62,6 +62,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "02000000031e1977dc524bec5929e95d8d0946812944b7b5bda12f5b99fdf557773f2ee65e0100000000ffffffff8a398e44546dce0245452b90130e86832b21fd68f26662bc33aeb7c6c115d23c1900000000ffffffffb807ab93a7fcdff7af6d24581a4a18aa7c1db1ebecba2617a6805b009513940f0c00000000ffffffff020001a04a000000001976a91446c68c7ea76343542ce2175380097ddc0d19920088ac27440f00000000001976a914df4d005fe9a8136e06cc85ac8e7aa40efedf563888ac0000000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreate2.json
Normal file → Executable file
2
test/util/data/txcreate2.json
Normal file → Executable file
@ -18,6 +18,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0200000000010000000000000000000000000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatedata1.json
Normal file → Executable file
2
test/util/data/txcreatedata1.json
Normal file → Executable file
@ -40,6 +40,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0100000001efc59c584fb0be1066baf08b93f8baf0d9b9beaafcdd318a59cda6302dc1e9690000000000ffffffff02400d0300000000001976a914b7a095022efd63a85e8710ad688e7207edf28ac088ac0084d71700000000526a4c4f54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e00000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatedata2.json
Normal file → Executable file
2
test/util/data/txcreatedata2.json
Normal file → Executable file
@ -40,6 +40,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0200000001efc59c584fb0be1066baf08b93f8baf0d9b9beaafcdd318a59cda6302dc1e9690000000000ffffffff02400d0300000000001976a9142a4cac308b5a411caeaa901e1de46aa4594bae4588ac0000000000000000526a4c4f54686973204f505f52455455524e207472616e73616374696f6e206f7574707574207761732063726561746564206279206d6f646966696564206372656174657261777472616e73616374696f6e2e0000000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatedata_seq0.json
Normal file → Executable file
2
test/util/data/txcreatedata_seq0.json
Normal file → Executable file
@ -31,6 +31,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0200000001efc59c584fb0be1066baf08b93f8baf0d9b9beaafcdd318a59cda6302dc1e9690000000000fdffffff01400d0300000000001976a9144fd28e5baccc1824f48d96c829f8af4e8157ad0f88ac0000000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatedata_seq1.json
Normal file → Executable file
2
test/util/data/txcreatedata_seq1.json
Normal file → Executable file
@ -40,6 +40,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000021f5c38dfcf6f1a5f5a87c416076d392c87e6d41970d5ad5e477a02d66bde97580000000000fdffffffefc59c584fb0be1066baf08b93f8baf0d9b9beaafcdd318a59cda6302dc1e9690000000000010000000180a81201000000001976a9141fc11f39be1729bf973a7ab6a615ca4729d6457488ac00000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatemultisig1.json
Normal file → Executable file
2
test/util/data/txcreatemultisig1.json
Normal file → Executable file
@ -24,6 +24,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000000100e1f5050000000069522102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff39721021ac43c7ff740014c3b33737ede99c967e4764553d1b2b83db77c83b8715fa72d2102df2089105c77f266fa11a9d33f05c735234075f2e8780824c6b709415f9fb48553ae00000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatemultisig2.json
Normal file → Executable file
2
test/util/data/txcreatemultisig2.json
Normal file → Executable file
@ -22,6 +22,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000000100e1f5050000000017a9141c6fbaf46d64221e80cbae182c33ddf81b9294ac8700000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatemultisig3.json
Normal file → Executable file
2
test/util/data/txcreatemultisig3.json
Normal file → Executable file
@ -18,6 +18,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000000100e1f50500000000220020e15a86a23178f433d514dbbce042e87d72662b8b5edcacfd2e37ab7a2d135f0500000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatemultisig4.json
Normal file → Executable file
2
test/util/data/txcreatemultisig4.json
Normal file → Executable file
@ -22,6 +22,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000000100e1f5050000000017a9146edf12858999f0dae74f9c692e6694ee3621b2ac8700000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreateoutpubkey1.json
Normal file → Executable file
2
test/util/data/txcreateoutpubkey1.json
Normal file → Executable file
@ -22,6 +22,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0100000000010000000000000000232102a5613bd857b7048924264d1e70e08fb2a7e6527d32b7ab1bb993ac59964ff397ac00000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreateoutpubkey2.json
Normal file → Executable file
2
test/util/data/txcreateoutpubkey2.json
Normal file → Executable file
@ -18,6 +18,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0100000000010000000000000000160014a2516e770582864a6a56ed21a102044e388c62e300000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreateoutpubkey3.json
Normal file → Executable file
2
test/util/data/txcreateoutpubkey3.json
Normal file → Executable file
@ -22,6 +22,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "010000000001000000000000000017a914a5ab14c9804d0d8bf02f1aea4e82780733ad0a838700000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatescript1.json
Normal file → Executable file
2
test/util/data/txcreatescript1.json
Normal file → Executable file
@ -18,6 +18,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0100000000010000000000000000017500000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatescript2.json
Normal file → Executable file
2
test/util/data/txcreatescript2.json
Normal file → Executable file
@ -22,6 +22,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "010000000001000000000000000017a91471ed53322d470bb96657deb786b94f97dd46fb158700000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatescript3.json
Normal file → Executable file
2
test/util/data/txcreatescript3.json
Normal file → Executable file
@ -18,6 +18,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "01000000000100000000000000002200200bfe935e70c321c7ca3afc75ce0d0ca2f98b5422e008bb31c00c6d7f1f1c0ad600000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatescript4.json
Normal file → Executable file
2
test/util/data/txcreatescript4.json
Normal file → Executable file
@ -22,6 +22,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "010000000001000000000000000017a9146a2c482f4985f57e702f325816c90e3723ca81ae8700000000"
|
||||
}
|
||||
|
||||
2
test/util/data/txcreatesignv1.json
Normal file → Executable file
2
test/util/data/txcreatesignv1.json
Normal file → Executable file
@ -31,6 +31,6 @@
|
||||
}
|
||||
}
|
||||
],
|
||||
"tx-comment": "",
|
||||
"flo-data": "",
|
||||
"hex": "0100000001f77bd0a57e5b5e041e95567e0f01c3789af7f624ff490f756fb408362489276c0000000000ffffffff01a0860100000000001976a9143971799f23da748772533dfb6ce20fab59142c5a88ac00000000"
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user