mirror of
https://git.wownero.com/wownero/wownero.git
synced 2024-12-22 22:38:53 +00:00
fix do_not_relay not preventing relaying on a timer
Also print its value when printing pool
This commit is contained in:
parent
2806842200
commit
81c384e408
@ -508,7 +508,7 @@ block Blockchain::pop_block_from_blockchain()
|
|||||||
// that might not be always true. Unlikely though, and always relaying
|
// that might not be always true. Unlikely though, and always relaying
|
||||||
// these again might cause a spike of traffic as many nodes re-relay
|
// these again might cause a spike of traffic as many nodes re-relay
|
||||||
// all the transactions in a popped block when a reorg happens.
|
// all the transactions in a popped block when a reorg happens.
|
||||||
bool r = m_tx_pool.add_tx(tx, tvc, true, true, version);
|
bool r = m_tx_pool.add_tx(tx, tvc, true, true, false, version);
|
||||||
if (!r)
|
if (!r)
|
||||||
{
|
{
|
||||||
LOG_ERROR("Error returning transaction to tx_pool");
|
LOG_ERROR("Error returning transaction to tx_pool");
|
||||||
@ -2973,7 +2973,7 @@ void Blockchain::return_tx_to_pool(const std::vector<transaction> &txs)
|
|||||||
// that might not be always true. Unlikely though, and always relaying
|
// that might not be always true. Unlikely though, and always relaying
|
||||||
// these again might cause a spike of traffic as many nodes re-relay
|
// these again might cause a spike of traffic as many nodes re-relay
|
||||||
// all the transactions in a popped block when a reorg happens.
|
// all the transactions in a popped block when a reorg happens.
|
||||||
if (!m_tx_pool.add_tx(tx, tvc, true, true, version))
|
if (!m_tx_pool.add_tx(tx, tvc, true, true, false, version))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to return taken transaction with hash: " << get_transaction_hash(tx) << " to tx_pool");
|
LOG_PRINT_L0("Failed to return taken transaction with hash: " << get_transaction_hash(tx) << " to tx_pool");
|
||||||
}
|
}
|
||||||
@ -2990,9 +2990,9 @@ bool Blockchain::flush_txes_from_pool(const std::list<crypto::hash> &txids)
|
|||||||
cryptonote::transaction tx;
|
cryptonote::transaction tx;
|
||||||
size_t blob_size;
|
size_t blob_size;
|
||||||
uint64_t fee;
|
uint64_t fee;
|
||||||
bool relayed;
|
bool relayed, do_not_relay;
|
||||||
LOG_PRINT_L1("Removing txid " << txid << " from the pool");
|
LOG_PRINT_L1("Removing txid " << txid << " from the pool");
|
||||||
if(m_tx_pool.have_tx(txid) && !m_tx_pool.take_tx(txid, tx, blob_size, fee, relayed))
|
if(m_tx_pool.have_tx(txid) && !m_tx_pool.take_tx(txid, tx, blob_size, fee, relayed, do_not_relay))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("Failed to remove txid " << txid << " from the pool");
|
LOG_PRINT_L0("Failed to remove txid " << txid << " from the pool");
|
||||||
res = false;
|
res = false;
|
||||||
@ -3153,7 +3153,7 @@ leave:
|
|||||||
transaction tx;
|
transaction tx;
|
||||||
size_t blob_size = 0;
|
size_t blob_size = 0;
|
||||||
uint64_t fee = 0;
|
uint64_t fee = 0;
|
||||||
bool relayed = false;
|
bool relayed = false, do_not_relay = false;
|
||||||
TIME_MEASURE_START(aa);
|
TIME_MEASURE_START(aa);
|
||||||
|
|
||||||
// XXX old code does not check whether tx exists
|
// XXX old code does not check whether tx exists
|
||||||
@ -3170,7 +3170,7 @@ leave:
|
|||||||
TIME_MEASURE_START(bb);
|
TIME_MEASURE_START(bb);
|
||||||
|
|
||||||
// get transaction with hash <tx_id> from tx_pool
|
// get transaction with hash <tx_id> from tx_pool
|
||||||
if(!m_tx_pool.take_tx(tx_id, tx, blob_size, fee, relayed))
|
if(!m_tx_pool.take_tx(tx_id, tx, blob_size, fee, relayed, do_not_relay))
|
||||||
{
|
{
|
||||||
LOG_PRINT_L1("Block with id: " << id << " has at least one unknown transaction with id: " << tx_id);
|
LOG_PRINT_L1("Block with id: " << id << " has at least one unknown transaction with id: " << tx_id);
|
||||||
bvc.m_verifivation_failed = true;
|
bvc.m_verifivation_failed = true;
|
||||||
@ -3954,12 +3954,12 @@ void Blockchain::load_compiled_in_block_hashes()
|
|||||||
|
|
||||||
size_t blob_size;
|
size_t blob_size;
|
||||||
uint64_t fee;
|
uint64_t fee;
|
||||||
bool relayed;
|
bool relayed, do_not_relay;
|
||||||
transaction pool_tx;
|
transaction pool_tx;
|
||||||
for(const transaction &tx : txs)
|
for(const transaction &tx : txs)
|
||||||
{
|
{
|
||||||
crypto::hash tx_hash = get_transaction_hash(tx);
|
crypto::hash tx_hash = get_transaction_hash(tx);
|
||||||
m_tx_pool.take_tx(tx_hash, pool_tx, blob_size, fee, relayed);
|
m_tx_pool.take_tx(tx_hash, pool_tx, blob_size, fee, relayed, do_not_relay);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -452,7 +452,7 @@ namespace cryptonote
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block, bool relayed)
|
bool core::handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||||
{
|
{
|
||||||
tvc = boost::value_initialized<tx_verification_context>();
|
tvc = boost::value_initialized<tx_verification_context>();
|
||||||
//want to process all transactions sequentially
|
//want to process all transactions sequentially
|
||||||
@ -501,7 +501,7 @@ namespace cryptonote
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool r = add_new_tx(tx, tx_hash, tx_prefixt_hash, tx_blob.size(), tvc, keeped_by_block, relayed);
|
bool r = add_new_tx(tx, tx_hash, tx_prefixt_hash, tx_blob.size(), tvc, keeped_by_block, relayed, do_not_relay);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{LOG_PRINT_RED_L1("Transaction verification failed: " << tx_hash);}
|
{LOG_PRINT_RED_L1("Transaction verification failed: " << tx_hash);}
|
||||||
else if(tvc.m_verifivation_impossible)
|
else if(tvc.m_verifivation_impossible)
|
||||||
@ -640,13 +640,13 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block, bool relayed)
|
bool core::add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||||
{
|
{
|
||||||
crypto::hash tx_hash = get_transaction_hash(tx);
|
crypto::hash tx_hash = get_transaction_hash(tx);
|
||||||
crypto::hash tx_prefix_hash = get_transaction_prefix_hash(tx);
|
crypto::hash tx_prefix_hash = get_transaction_prefix_hash(tx);
|
||||||
blobdata bl;
|
blobdata bl;
|
||||||
t_serializable_object_to_blob(tx, bl);
|
t_serializable_object_to_blob(tx, bl);
|
||||||
return add_new_tx(tx, tx_hash, tx_prefix_hash, bl.size(), tvc, keeped_by_block, relayed);
|
return add_new_tx(tx, tx_hash, tx_prefix_hash, bl.size(), tvc, keeped_by_block, relayed, do_not_relay);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
size_t core::get_blockchain_total_transactions() const
|
size_t core::get_blockchain_total_transactions() const
|
||||||
@ -654,7 +654,7 @@ namespace cryptonote
|
|||||||
return m_blockchain_storage.get_total_transactions();
|
return m_blockchain_storage.get_total_transactions();
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block, bool relayed)
|
bool core::add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay)
|
||||||
{
|
{
|
||||||
if(m_mempool.have_tx(tx_hash))
|
if(m_mempool.have_tx(tx_hash))
|
||||||
{
|
{
|
||||||
@ -669,7 +669,7 @@ namespace cryptonote
|
|||||||
}
|
}
|
||||||
|
|
||||||
uint8_t version = m_blockchain_storage.get_current_hard_fork_version();
|
uint8_t version = m_blockchain_storage.get_current_hard_fork_version();
|
||||||
return m_mempool.add_tx(tx, tx_hash, blob_size, tvc, keeped_by_block, relayed, version);
|
return m_mempool.add_tx(tx, tx_hash, blob_size, tvc, keeped_by_block, relayed, do_not_relay, version);
|
||||||
}
|
}
|
||||||
//-----------------------------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------------------------
|
||||||
bool core::relay_txpool_transactions()
|
bool core::relay_txpool_transactions()
|
||||||
|
@ -107,10 +107,11 @@ namespace cryptonote
|
|||||||
* @param tvc metadata about the transaction's validity
|
* @param tvc metadata about the transaction's validity
|
||||||
* @param keeped_by_block if the transaction has been in a block
|
* @param keeped_by_block if the transaction has been in a block
|
||||||
* @param relayed whether or not the transaction was relayed to us
|
* @param relayed whether or not the transaction was relayed to us
|
||||||
|
* @param do_not_relay whether to prevent the transaction from being relayed
|
||||||
*
|
*
|
||||||
* @return true if the transaction made it to the transaction pool, otherwise false
|
* @return true if the transaction made it to the transaction pool, otherwise false
|
||||||
*/
|
*/
|
||||||
bool handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block, bool relayed);
|
bool handle_incoming_tx(const blobdata& tx_blob, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief handles an incoming block
|
* @brief handles an incoming block
|
||||||
@ -641,9 +642,10 @@ namespace cryptonote
|
|||||||
* @param tx_prefix_hash the transaction prefix' hash
|
* @param tx_prefix_hash the transaction prefix' hash
|
||||||
* @param blob_size the size of the transaction
|
* @param blob_size the size of the transaction
|
||||||
* @param relayed whether or not the transaction was relayed to us
|
* @param relayed whether or not the transaction was relayed to us
|
||||||
|
* @param do_not_relay whether to prevent the transaction from being relayed
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block, bool relayed);
|
bool add_new_tx(const transaction& tx, const crypto::hash& tx_hash, const crypto::hash& tx_prefix_hash, size_t blob_size, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief add a new transaction to the transaction pool
|
* @brief add a new transaction to the transaction pool
|
||||||
@ -654,12 +656,13 @@ namespace cryptonote
|
|||||||
* @param tvc return-by-reference metadata about the transaction's verification process
|
* @param tvc return-by-reference metadata about the transaction's verification process
|
||||||
* @param keeped_by_block whether or not the transaction has been in a block
|
* @param keeped_by_block whether or not the transaction has been in a block
|
||||||
* @param relayed whether or not the transaction was relayed to us
|
* @param relayed whether or not the transaction was relayed to us
|
||||||
|
* @param do_not_relay whether to prevent the transaction from being relayed
|
||||||
*
|
*
|
||||||
* @return true if the transaction is already in the transaction pool,
|
* @return true if the transaction is already in the transaction pool,
|
||||||
* is already in a block on the Blockchain, or is successfully added
|
* is already in a block on the Blockchain, or is successfully added
|
||||||
* to the transaction pool
|
* to the transaction pool
|
||||||
*/
|
*/
|
||||||
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block, bool relayed);
|
bool add_new_tx(const transaction& tx, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @copydoc Blockchain::add_new_block
|
* @copydoc Blockchain::add_new_block
|
||||||
|
@ -83,7 +83,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
bool tx_memory_pool::add_tx(const transaction &tx, /*const crypto::hash& tx_prefix_hash,*/ const crypto::hash &id, size_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool relayed, uint8_t version)
|
bool tx_memory_pool::add_tx(const transaction &tx, /*const crypto::hash& tx_prefix_hash,*/ const crypto::hash &id, size_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool relayed, bool do_not_relay, uint8_t version)
|
||||||
{
|
{
|
||||||
PERF_TIMER(add_tx);
|
PERF_TIMER(add_tx);
|
||||||
if (tx.version == 0)
|
if (tx.version == 0)
|
||||||
@ -201,6 +201,7 @@ namespace cryptonote
|
|||||||
txd_p.first->second.receive_time = time(nullptr);
|
txd_p.first->second.receive_time = time(nullptr);
|
||||||
txd_p.first->second.last_relayed_time = time(NULL);
|
txd_p.first->second.last_relayed_time = time(NULL);
|
||||||
txd_p.first->second.relayed = relayed;
|
txd_p.first->second.relayed = relayed;
|
||||||
|
txd_p.first->second.do_not_relay = do_not_relay;
|
||||||
tvc.m_verifivation_impossible = true;
|
tvc.m_verifivation_impossible = true;
|
||||||
tvc.m_added_to_pool = true;
|
tvc.m_added_to_pool = true;
|
||||||
}else
|
}else
|
||||||
@ -224,9 +225,10 @@ namespace cryptonote
|
|||||||
txd_p.first->second.receive_time = time(nullptr);
|
txd_p.first->second.receive_time = time(nullptr);
|
||||||
txd_p.first->second.last_relayed_time = time(NULL);
|
txd_p.first->second.last_relayed_time = time(NULL);
|
||||||
txd_p.first->second.relayed = relayed;
|
txd_p.first->second.relayed = relayed;
|
||||||
|
txd_p.first->second.do_not_relay = do_not_relay;
|
||||||
tvc.m_added_to_pool = true;
|
tvc.m_added_to_pool = true;
|
||||||
|
|
||||||
if(txd_p.first->second.fee > 0)
|
if(txd_p.first->second.fee > 0 && !do_not_relay)
|
||||||
tvc.m_should_be_relayed = true;
|
tvc.m_should_be_relayed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,12 +253,12 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
bool tx_memory_pool::add_tx(const transaction &tx, tx_verification_context& tvc, bool keeped_by_block, bool relayed, uint8_t version)
|
bool tx_memory_pool::add_tx(const transaction &tx, tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay, uint8_t version)
|
||||||
{
|
{
|
||||||
crypto::hash h = null_hash;
|
crypto::hash h = null_hash;
|
||||||
size_t blob_size = 0;
|
size_t blob_size = 0;
|
||||||
get_transaction_hash(tx, h, blob_size);
|
get_transaction_hash(tx, h, blob_size);
|
||||||
return add_tx(tx, h, blob_size, tvc, keeped_by_block, relayed, version);
|
return add_tx(tx, h, blob_size, tvc, keeped_by_block, relayed, do_not_relay, version);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
//FIXME: Can return early before removal of all of the key images.
|
//FIXME: Can return early before removal of all of the key images.
|
||||||
@ -292,7 +294,7 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------------
|
//---------------------------------------------------------------------------------
|
||||||
bool tx_memory_pool::take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee, bool &relayed)
|
bool tx_memory_pool::take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee, bool &relayed, bool &do_not_relay)
|
||||||
{
|
{
|
||||||
CRITICAL_REGION_LOCAL(m_transactions_lock);
|
CRITICAL_REGION_LOCAL(m_transactions_lock);
|
||||||
auto it = m_transactions.find(id);
|
auto it = m_transactions.find(id);
|
||||||
@ -308,6 +310,7 @@ namespace cryptonote
|
|||||||
blob_size = it->second.blob_size;
|
blob_size = it->second.blob_size;
|
||||||
fee = it->second.fee;
|
fee = it->second.fee;
|
||||||
relayed = it->second.relayed;
|
relayed = it->second.relayed;
|
||||||
|
do_not_relay = it->second.do_not_relay;
|
||||||
remove_transaction_keyimages(it->second.tx);
|
remove_transaction_keyimages(it->second.tx);
|
||||||
m_transactions.erase(it);
|
m_transactions.erase(it);
|
||||||
m_txs_by_fee.erase(sorted_it);
|
m_txs_by_fee.erase(sorted_it);
|
||||||
@ -367,7 +370,7 @@ namespace cryptonote
|
|||||||
for(auto it = m_transactions.begin(); it!= m_transactions.end();)
|
for(auto it = m_transactions.begin(); it!= m_transactions.end();)
|
||||||
{
|
{
|
||||||
// 0 fee transactions are never relayed
|
// 0 fee transactions are never relayed
|
||||||
if(it->second.fee > 0 && now - it->second.last_relayed_time > get_relay_delay(now, it->second.receive_time))
|
if(it->second.fee > 0 && !it->second.do_not_relay && now - it->second.last_relayed_time > get_relay_delay(now, it->second.receive_time))
|
||||||
{
|
{
|
||||||
// if the tx is older than half the max lifetime, we don't re-relay it, to avoid a problem
|
// if the tx is older than half the max lifetime, we don't re-relay it, to avoid a problem
|
||||||
// mentioned by smooth where nodes would flush txes at slightly different times, causing
|
// mentioned by smooth where nodes would flush txes at slightly different times, causing
|
||||||
@ -431,6 +434,7 @@ namespace cryptonote
|
|||||||
txi.receive_time = txd.receive_time;
|
txi.receive_time = txd.receive_time;
|
||||||
txi.relayed = txd.relayed;
|
txi.relayed = txd.relayed;
|
||||||
txi.last_relayed_time = txd.last_relayed_time;
|
txi.last_relayed_time = txd.last_relayed_time;
|
||||||
|
txi.do_not_relay = txd.do_not_relay;
|
||||||
tx_infos.push_back(txi);
|
tx_infos.push_back(txi);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -103,7 +103,7 @@ namespace cryptonote
|
|||||||
* @param id the transaction's hash
|
* @param id the transaction's hash
|
||||||
* @param blob_size the transaction's size
|
* @param blob_size the transaction's size
|
||||||
*/
|
*/
|
||||||
bool add_tx(const transaction &tx, const crypto::hash &id, size_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool relayed, uint8_t version);
|
bool add_tx(const transaction &tx, const crypto::hash &id, size_t blob_size, tx_verification_context& tvc, bool kept_by_block, bool relayed, bool do_not_relay, uint8_t version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief add a transaction to the transaction pool
|
* @brief add a transaction to the transaction pool
|
||||||
@ -117,11 +117,12 @@ namespace cryptonote
|
|||||||
* @param tvc return-by-reference status about the transaction verification
|
* @param tvc return-by-reference status about the transaction verification
|
||||||
* @param kept_by_block has this transaction been in a block?
|
* @param kept_by_block has this transaction been in a block?
|
||||||
* @param relayed was this transaction from the network or a local client?
|
* @param relayed was this transaction from the network or a local client?
|
||||||
|
* @param do_not_relay to avoid relaying the transaction to the network
|
||||||
* @param version the version used to create the transaction
|
* @param version the version used to create the transaction
|
||||||
*
|
*
|
||||||
* @return true if the transaction passes validations, otherwise false
|
* @return true if the transaction passes validations, otherwise false
|
||||||
*/
|
*/
|
||||||
bool add_tx(const transaction &tx, tx_verification_context& tvc, bool kept_by_block, bool relayed, uint8_t version);
|
bool add_tx(const transaction &tx, tx_verification_context& tvc, bool kept_by_block, bool relayed, bool do_not_relay, uint8_t version);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief takes a transaction with the given hash from the pool
|
* @brief takes a transaction with the given hash from the pool
|
||||||
@ -131,10 +132,11 @@ namespace cryptonote
|
|||||||
* @param blob_size return-by-reference the transaction's size
|
* @param blob_size return-by-reference the transaction's size
|
||||||
* @param fee the transaction fee
|
* @param fee the transaction fee
|
||||||
* @param relayed return-by-reference was transaction relayed to us by the network?
|
* @param relayed return-by-reference was transaction relayed to us by the network?
|
||||||
|
* @param do_not_relay return-by-reference is transaction not to be relayed to the network?
|
||||||
*
|
*
|
||||||
* @return true unless the transaction cannot be found in the pool
|
* @return true unless the transaction cannot be found in the pool
|
||||||
*/
|
*/
|
||||||
bool take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee, bool &relayed);
|
bool take_tx(const crypto::hash &id, transaction &tx, size_t& blob_size, uint64_t& fee, bool &relayed, bool &do_not_relay);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief checks if the pool has a transaction with the given hash
|
* @brief checks if the pool has a transaction with the given hash
|
||||||
@ -303,7 +305,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
|
|
||||||
#define CURRENT_MEMPOOL_ARCHIVE_VER 11
|
#define CURRENT_MEMPOOL_ARCHIVE_VER 11
|
||||||
#define CURRENT_MEMPOOL_TX_DETAILS_ARCHIVE_VER 11
|
#define CURRENT_MEMPOOL_TX_DETAILS_ARCHIVE_VER 12
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief serialize the transaction pool to/from disk
|
* @brief serialize the transaction pool to/from disk
|
||||||
@ -362,6 +364,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
time_t last_relayed_time; //!< the last time the transaction was relayed to the network
|
time_t last_relayed_time; //!< the last time the transaction was relayed to the network
|
||||||
bool relayed; //!< whether or not the transaction has been relayed to the network
|
bool relayed; //!< whether or not the transaction has been relayed to the network
|
||||||
|
bool do_not_relay; //!< to avoid relay this transaction to the network
|
||||||
};
|
};
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -515,6 +518,9 @@ namespace boost
|
|||||||
if (version < 11)
|
if (version < 11)
|
||||||
return;
|
return;
|
||||||
ar & td.kept_by_block;
|
ar & td.kept_by_block;
|
||||||
|
if (version < 12)
|
||||||
|
return;
|
||||||
|
ar & td.do_not_relay;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -328,7 +328,7 @@ namespace cryptonote
|
|||||||
for(auto tx_blob_it = arg.b.txs.begin(); tx_blob_it!=arg.b.txs.end();tx_blob_it++)
|
for(auto tx_blob_it = arg.b.txs.begin(); tx_blob_it!=arg.b.txs.end();tx_blob_it++)
|
||||||
{
|
{
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
m_core.handle_incoming_tx(*tx_blob_it, tvc, true, true);
|
m_core.handle_incoming_tx(*tx_blob_it, tvc, true, true, false);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L1("Block verification failed: transaction verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Block verification failed: transaction verification failed, dropping connection");
|
||||||
@ -478,7 +478,7 @@ namespace cryptonote
|
|||||||
if(!m_core.get_pool_transaction(tx_hash, tx))
|
if(!m_core.get_pool_transaction(tx_hash, tx))
|
||||||
{
|
{
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
if(!m_core.handle_incoming_tx(tx_blob, tvc, true, true) || tvc.m_verifivation_failed)
|
if(!m_core.handle_incoming_tx(tx_blob, tvc, true, true, false) || tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L1("Block verification failed: transaction verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Block verification failed: transaction verification failed, dropping connection");
|
||||||
m_p2p->drop_connection(context);
|
m_p2p->drop_connection(context);
|
||||||
@ -682,7 +682,7 @@ namespace cryptonote
|
|||||||
for(auto tx_blob_it = arg.txs.begin(); tx_blob_it!=arg.txs.end();)
|
for(auto tx_blob_it = arg.txs.begin(); tx_blob_it!=arg.txs.end();)
|
||||||
{
|
{
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
m_core.handle_incoming_tx(*tx_blob_it, tvc, false, true);
|
m_core.handle_incoming_tx(*tx_blob_it, tvc, false, true, false);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_CCONTEXT_L1("Tx verification failed, dropping connection");
|
LOG_PRINT_CCONTEXT_L1("Tx verification failed, dropping connection");
|
||||||
@ -874,7 +874,7 @@ namespace cryptonote
|
|||||||
BOOST_FOREACH(auto& tx_blob, block_entry.txs)
|
BOOST_FOREACH(auto& tx_blob, block_entry.txs)
|
||||||
{
|
{
|
||||||
tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
m_core.handle_incoming_tx(tx_blob, tvc, true, true);
|
m_core.handle_incoming_tx(tx_blob, tvc, true, true, false);
|
||||||
if(tvc.m_verifivation_failed)
|
if(tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
LOG_ERROR_CCONTEXT("transaction verification failed on NOTIFY_RESPONSE_GET_OBJECTS, \r\ntx_id = "
|
LOG_ERROR_CCONTEXT("transaction verification failed on NOTIFY_RESPONSE_GET_OBJECTS, \r\ntx_id = "
|
||||||
|
@ -743,6 +743,7 @@ bool t_rpc_command_executor::print_transaction_pool_long() {
|
|||||||
<< "fee: " << cryptonote::print_money(tx_info.fee) << std::endl
|
<< "fee: " << cryptonote::print_money(tx_info.fee) << std::endl
|
||||||
<< "receive_time: " << tx_info.receive_time << " (" << get_human_time_ago(tx_info.receive_time, now) << ")" << std::endl
|
<< "receive_time: " << tx_info.receive_time << " (" << get_human_time_ago(tx_info.receive_time, now) << ")" << std::endl
|
||||||
<< "relayed: " << [&](const cryptonote::tx_info &tx_info)->std::string { if (!tx_info.relayed) return "no"; return boost::lexical_cast<std::string>(tx_info.last_relayed_time) + " (" + get_human_time_ago(tx_info.last_relayed_time, now) + ")"; } (tx_info) << std::endl
|
<< "relayed: " << [&](const cryptonote::tx_info &tx_info)->std::string { if (!tx_info.relayed) return "no"; return boost::lexical_cast<std::string>(tx_info.last_relayed_time) + " (" + get_human_time_ago(tx_info.last_relayed_time, now) + ")"; } (tx_info) << std::endl
|
||||||
|
<< "do_not_relay: " << (tx_info.do_not_relay ? 'T' : 'F') << std::endl
|
||||||
<< "kept_by_block: " << (tx_info.kept_by_block ? 'T' : 'F') << std::endl
|
<< "kept_by_block: " << (tx_info.kept_by_block ? 'T' : 'F') << std::endl
|
||||||
<< "max_used_block_height: " << tx_info.max_used_block_height << std::endl
|
<< "max_used_block_height: " << tx_info.max_used_block_height << std::endl
|
||||||
<< "max_used_block_id: " << tx_info.max_used_block_id_hash << std::endl
|
<< "max_used_block_id: " << tx_info.max_used_block_id_hash << std::endl
|
||||||
@ -823,6 +824,7 @@ bool t_rpc_command_executor::print_transaction_pool_short() {
|
|||||||
<< "fee: " << cryptonote::print_money(tx_info.fee) << std::endl
|
<< "fee: " << cryptonote::print_money(tx_info.fee) << std::endl
|
||||||
<< "receive_time: " << tx_info.receive_time << " (" << get_human_time_ago(tx_info.receive_time, now) << ")" << std::endl
|
<< "receive_time: " << tx_info.receive_time << " (" << get_human_time_ago(tx_info.receive_time, now) << ")" << std::endl
|
||||||
<< "relayed: " << [&](const cryptonote::tx_info &tx_info)->std::string { if (!tx_info.relayed) return "no"; return boost::lexical_cast<std::string>(tx_info.last_relayed_time) + " (" + get_human_time_ago(tx_info.last_relayed_time, now) + ")"; } (tx_info) << std::endl
|
<< "relayed: " << [&](const cryptonote::tx_info &tx_info)->std::string { if (!tx_info.relayed) return "no"; return boost::lexical_cast<std::string>(tx_info.last_relayed_time) + " (" + get_human_time_ago(tx_info.last_relayed_time, now) + ")"; } (tx_info) << std::endl
|
||||||
|
<< "do_not_relay: " << (tx_info.do_not_relay ? 'T' : 'F') << std::endl
|
||||||
<< "kept_by_block: " << (tx_info.kept_by_block ? 'T' : 'F') << std::endl
|
<< "kept_by_block: " << (tx_info.kept_by_block ? 'T' : 'F') << std::endl
|
||||||
<< "max_used_block_height: " << tx_info.max_used_block_height << std::endl
|
<< "max_used_block_height: " << tx_info.max_used_block_height << std::endl
|
||||||
<< "max_used_block_id: " << tx_info.max_used_block_id_hash << std::endl
|
<< "max_used_block_id: " << tx_info.max_used_block_id_hash << std::endl
|
||||||
|
@ -528,7 +528,7 @@ namespace cryptonote
|
|||||||
|
|
||||||
cryptonote_connection_context fake_context = AUTO_VAL_INIT(fake_context);
|
cryptonote_connection_context fake_context = AUTO_VAL_INIT(fake_context);
|
||||||
tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
if(!m_core.handle_incoming_tx(tx_blob, tvc, false, false) || tvc.m_verifivation_failed)
|
if(!m_core.handle_incoming_tx(tx_blob, tvc, false, false, req.do_not_relay) || tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
if (tvc.m_verifivation_failed)
|
if (tvc.m_verifivation_failed)
|
||||||
{
|
{
|
||||||
@ -558,7 +558,7 @@ namespace cryptonote
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!tvc.m_should_be_relayed || req.do_not_relay)
|
if(!tvc.m_should_be_relayed)
|
||||||
{
|
{
|
||||||
LOG_PRINT_L0("[on_send_raw_tx]: tx accepted, but not relayed");
|
LOG_PRINT_L0("[on_send_raw_tx]: tx accepted, but not relayed");
|
||||||
res.reason = "Not relayed";
|
res.reason = "Not relayed";
|
||||||
|
@ -49,7 +49,7 @@ namespace cryptonote
|
|||||||
// advance which version they will stop working with
|
// advance which version they will stop working with
|
||||||
// Don't go over 32767 for any of these
|
// Don't go over 32767 for any of these
|
||||||
#define CORE_RPC_VERSION_MAJOR 1
|
#define CORE_RPC_VERSION_MAJOR 1
|
||||||
#define CORE_RPC_VERSION_MINOR 4
|
#define CORE_RPC_VERSION_MINOR 5
|
||||||
#define CORE_RPC_VERSION (((CORE_RPC_VERSION_MAJOR)<<16)|(CORE_RPC_VERSION_MINOR))
|
#define CORE_RPC_VERSION (((CORE_RPC_VERSION_MAJOR)<<16)|(CORE_RPC_VERSION_MINOR))
|
||||||
|
|
||||||
struct COMMAND_RPC_GET_HEIGHT
|
struct COMMAND_RPC_GET_HEIGHT
|
||||||
@ -920,6 +920,7 @@ namespace cryptonote
|
|||||||
uint64_t receive_time;
|
uint64_t receive_time;
|
||||||
bool relayed;
|
bool relayed;
|
||||||
uint64_t last_relayed_time;
|
uint64_t last_relayed_time;
|
||||||
|
bool do_not_relay;
|
||||||
|
|
||||||
BEGIN_KV_SERIALIZE_MAP()
|
BEGIN_KV_SERIALIZE_MAP()
|
||||||
KV_SERIALIZE(id_hash)
|
KV_SERIALIZE(id_hash)
|
||||||
@ -934,6 +935,7 @@ namespace cryptonote
|
|||||||
KV_SERIALIZE(receive_time)
|
KV_SERIALIZE(receive_time)
|
||||||
KV_SERIALIZE(relayed)
|
KV_SERIALIZE(relayed)
|
||||||
KV_SERIALIZE(last_relayed_time)
|
KV_SERIALIZE(last_relayed_time)
|
||||||
|
KV_SERIALIZE(do_not_relay)
|
||||||
END_KV_SERIALIZE_MAP()
|
END_KV_SERIALIZE_MAP()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -165,7 +165,7 @@ string tx2str(const cryptonote::transaction& tx, const cryptonote::hash256& tx_h
|
|||||||
return ss.str();
|
return ss.str();
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
bool tests::proxy_core::handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed) {
|
bool tests::proxy_core::handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) {
|
||||||
if (!keeped_by_block)
|
if (!keeped_by_block)
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
@ -74,7 +74,7 @@ namespace tests
|
|||||||
bool get_stat_info(cryptonote::core_stat_info& st_inf){return true;}
|
bool get_stat_info(cryptonote::core_stat_info& st_inf){return true;}
|
||||||
bool have_block(const crypto::hash& id);
|
bool have_block(const crypto::hash& id);
|
||||||
bool get_blockchain_top(uint64_t& height, crypto::hash& top_id);
|
bool get_blockchain_top(uint64_t& height, crypto::hash& top_id);
|
||||||
bool handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relaued);
|
bool handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay);
|
||||||
bool handle_incoming_block(const cryptonote::blobdata& block_blob, cryptonote::block_verification_context& bvc, bool update_miner_blocktemplate = true);
|
bool handle_incoming_block(const cryptonote::blobdata& block_blob, cryptonote::block_verification_context& bvc, bool update_miner_blocktemplate = true);
|
||||||
void pause_mine(){}
|
void pause_mine(){}
|
||||||
void resume_mine(){}
|
void resume_mine(){}
|
||||||
|
@ -368,7 +368,7 @@ public:
|
|||||||
|
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
size_t pool_size = m_c.get_pool_transactions_count();
|
size_t pool_size = m_c.get_pool_transactions_count();
|
||||||
m_c.handle_incoming_tx(t_serializable_object_to_blob(tx), tvc, m_txs_keeped_by_block, false);
|
m_c.handle_incoming_tx(t_serializable_object_to_blob(tx), tvc, m_txs_keeped_by_block, false, false);
|
||||||
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
|
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
|
||||||
bool r = check_tx_verification_context(tvc, tx_added, m_ev_index, tx, m_validator);
|
bool r = check_tx_verification_context(tvc, tx_added, m_ev_index, tx, m_validator);
|
||||||
CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
|
CHECK_AND_NO_ASSERT_MES(r, false, "tx verification context check failed");
|
||||||
@ -425,7 +425,7 @@ public:
|
|||||||
|
|
||||||
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
cryptonote::tx_verification_context tvc = AUTO_VAL_INIT(tvc);
|
||||||
size_t pool_size = m_c.get_pool_transactions_count();
|
size_t pool_size = m_c.get_pool_transactions_count();
|
||||||
m_c.handle_incoming_tx(sr_tx.data, tvc, m_txs_keeped_by_block, false);
|
m_c.handle_incoming_tx(sr_tx.data, tvc, m_txs_keeped_by_block, false, false);
|
||||||
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
|
bool tx_added = pool_size + 1 == m_c.get_pool_transactions_count();
|
||||||
|
|
||||||
cryptonote::transaction tx;
|
cryptonote::transaction tx;
|
||||||
|
@ -49,7 +49,7 @@ public:
|
|||||||
bool get_stat_info(cryptonote::core_stat_info& st_inf) const {return true;}
|
bool get_stat_info(cryptonote::core_stat_info& st_inf) const {return true;}
|
||||||
bool have_block(const crypto::hash& id) const {return true;}
|
bool have_block(const crypto::hash& id) const {return true;}
|
||||||
bool get_blockchain_top(uint64_t& height, crypto::hash& top_id)const{height=0;top_id=cryptonote::null_hash;return true;}
|
bool get_blockchain_top(uint64_t& height, crypto::hash& top_id)const{height=0;top_id=cryptonote::null_hash;return true;}
|
||||||
bool handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relaued) { return true; }
|
bool handle_incoming_tx(const cryptonote::blobdata& tx_blob, cryptonote::tx_verification_context& tvc, bool keeped_by_block, bool relayed, bool do_not_relay) { return true; }
|
||||||
bool handle_incoming_block(const cryptonote::blobdata& block_blob, cryptonote::block_verification_context& bvc, bool update_miner_blocktemplate = true) { return true; }
|
bool handle_incoming_block(const cryptonote::blobdata& block_blob, cryptonote::block_verification_context& bvc, bool update_miner_blocktemplate = true) { return true; }
|
||||||
void pause_mine(){}
|
void pause_mine(){}
|
||||||
void resume_mine(){}
|
void resume_mine(){}
|
||||||
|
Loading…
Reference in New Issue
Block a user