diff options
| author | luigi1111 <luigi1111w@gmail.com> | 2019-10-22 10:18:28 -0500 |
|---|---|---|
| committer | luigi1111 <luigi1111w@gmail.com> | 2019-10-22 10:18:28 -0500 |
| commit | 426d2ac8ee9b3be3a06b057b750826496d1c0950 (patch) | |
| tree | c630135ab60ac3dff91ef514b2da4399c9fe7539 | |
| parent | 3fb85857e0346a1ff23f4d1cbc6d0d0bca101d31 (diff) | |
| parent | 1ba9bafd3331f6534242e682bafbd6d863be42ed (diff) | |
| download | monzero-core-426d2ac8ee9b3be3a06b057b750826496d1c0950.tar.gz monzero-core-426d2ac8ee9b3be3a06b057b750826496d1c0950.tar.xz monzero-core-426d2ac8ee9b3be3a06b057b750826496d1c0950.zip | |
Merge pull request #5981
88c9d90 protocol: initialize block_weight in block_complete_entry ctor (moneromooo-monero)
fe443bb cryptonote: don't leave block_weight uninitialized (moneromooo-monero)
1ba9baf tx_pool: do not divide by 0 (moneromooo-monero)
| -rw-r--r-- | src/cryptonote_core/cryptonote_core.cpp | 1 | ||||
| -rw-r--r-- | src/cryptonote_core/tx_pool.cpp | 4 | ||||
| -rw-r--r-- | src/cryptonote_protocol/cryptonote_protocol_defs.h | 2 |
3 files changed, 4 insertions, 3 deletions
diff --git a/src/cryptonote_core/cryptonote_core.cpp b/src/cryptonote_core/cryptonote_core.cpp index b831cc9ff..eed5317e1 100644 --- a/src/cryptonote_core/cryptonote_core.cpp +++ b/src/cryptonote_core/cryptonote_core.cpp @@ -1367,6 +1367,7 @@ namespace cryptonote { block_complete_entry bce; bce.block = cryptonote::block_to_blob(b); + bce.block_weight = 0; // we can leave it to 0, those txes aren't pruned for (const auto &tx_hash: b.tx_hashes) { cryptonote::blobdata txblob; diff --git a/src/cryptonote_core/tx_pool.cpp b/src/cryptonote_core/tx_pool.cpp index 648e691d0..0d70f2992 100644 --- a/src/cryptonote_core/tx_pool.cpp +++ b/src/cryptonote_core/tx_pool.cpp @@ -259,7 +259,7 @@ namespace cryptonote m_blockchain.add_txpool_tx(id, blob, meta); if (!insert_key_images(tx, id, kept_by_block)) return false; - m_txs_by_fee_and_receive_time.emplace(std::pair<double, std::time_t>(fee / (double)tx_weight, receive_time), id); + m_txs_by_fee_and_receive_time.emplace(std::pair<double, std::time_t>(fee / (double)(tx_weight ? tx_weight : 1), receive_time), id); lock.commit(); } catch (const std::exception &e) @@ -305,7 +305,7 @@ namespace cryptonote m_blockchain.add_txpool_tx(id, blob, meta); if (!insert_key_images(tx, id, kept_by_block)) return false; - m_txs_by_fee_and_receive_time.emplace(std::pair<double, std::time_t>(fee / (double)tx_weight, receive_time), id); + m_txs_by_fee_and_receive_time.emplace(std::pair<double, std::time_t>(fee / (double)(tx_weight ? tx_weight : 1), receive_time), id); lock.commit(); } catch (const std::exception &e) diff --git a/src/cryptonote_protocol/cryptonote_protocol_defs.h b/src/cryptonote_protocol/cryptonote_protocol_defs.h index 3d594bf83..dcd108626 100644 --- a/src/cryptonote_protocol/cryptonote_protocol_defs.h +++ b/src/cryptonote_protocol/cryptonote_protocol_defs.h @@ -160,7 +160,7 @@ namespace cryptonote } END_KV_SERIALIZE_MAP() - block_complete_entry(): pruned(false) {} + block_complete_entry(): pruned(false), block_weight(0) {} }; |
