File tree Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Expand file tree Collapse file tree 2 files changed +19
-1
lines changed Original file line number Diff line number Diff line change 20
20
21
21
DISABLE_VS_WARNINGS (4244 4345 4503 ) // 'boost::foreach_detail_::or_' : decorated name length exceeded, name was truncated
22
22
23
+ #define TRANSACTION_SIZE_LIMIT (((CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE * 125 ) / 100 ) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE)
24
+
23
25
namespace cryptonote {
24
26
// ---------------------------------------------------------------------------------
25
27
tx_memory_pool::tx_memory_pool (blockchain_storage& bchs): m_blockchain(bchs) {
@@ -52,6 +54,12 @@ namespace cryptonote {
52
54
return false ;
53
55
}
54
56
57
+ if (!kept_by_block && blob_size >= TRANSACTION_SIZE_LIMIT) {
58
+ LOG_ERROR (" transaction is too big: " << blob_size << " bytes, maximum size: " << TRANSACTION_SIZE_LIMIT);
59
+ tvc.m_verifivation_failed = true ;
60
+ return false ;
61
+ }
62
+
55
63
// check key images for transaction if it is not kept by block
56
64
if (!kept_by_block) {
57
65
if (have_tx_keyimges_as_spent (tx)) {
@@ -340,6 +348,16 @@ namespace cryptonote {
340
348
m_transactions.clear ();
341
349
m_spent_key_images.clear ();
342
350
}
351
+
352
+ for (auto it = m_transactions.begin (); it != m_transactions.end (); ) {
353
+ auto it2 = it++;
354
+ if (it2->second .blob_size >= TRANSACTION_SIZE_LIMIT) {
355
+ LOG_PRINT_L0 (" Transaction " << get_transaction_hash (it2->second .tx ) << " is too big (" << it2->second .blob_size << " bytes), removing it from pool" );
356
+ remove_transaction_keyimages (it2->second .tx );
357
+ m_transactions.erase (it2);
358
+ }
359
+ }
360
+
343
361
// Ignore deserialization error
344
362
return true ;
345
363
}
Original file line number Diff line number Diff line change @@ -102,7 +102,7 @@ namespace tools
102
102
void store ();
103
103
cryptonote::account_base& get_account (){return m_account;}
104
104
105
- void init (const std::string& daemon_address = " http://localhost:8080" , uint64_t upper_transaction_size_limit = CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE* 2 - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
105
+ void init (const std::string& daemon_address = " http://localhost:8080" , uint64_t upper_transaction_size_limit = (( CRYPTONOTE_BLOCK_GRANTED_FULL_REWARD_ZONE * 125 ) / 100) - CRYPTONOTE_COINBASE_BLOB_RESERVED_SIZE);
106
106
bool deinit ();
107
107
108
108
void stop () { m_run.store (false , std::memory_order_relaxed); }
You can’t perform that action at this time.
0 commit comments