Commit Graph

682 Commits

Author SHA1 Message Date
Lee Clagett 23aae5571b Remove payload copy in all outgoing p2p messages 2021-01-16 22:53:28 +00:00
moneromooo-monero 1e27f7101e
blockchain: lock access to m_blocks_hash_of_hashes
it is accessed both when adding and when prevalidating a set
of new hashes from a peer
2021-01-02 22:19:54 +00:00
moneromooo-monero 0aa541b361
protocol: more sanity checks in new chain block hashes 2020-12-31 23:33:18 +00:00
moneromooo-monero 1eb14af1a3
rpc: limit the number of txes for get_blocks.bin 2020-12-29 04:31:58 +00:00
luigi1111 4d298d4f11
Merge pull request #6924
874487f blockchain: remove some dead code (moneromooo-monero)
2020-11-29 01:44:26 -06:00
moneromooo-monero 874487fed8
blockchain: remove some dead code
This is already done
2020-10-20 16:50:36 +00:00
SChernykh a25bc71f3f Make Blockchain::get_fee_quantization_mask() compile time
This also removes potential thread safety bug in that function.
2020-10-20 14:16:09 +02:00
moneromooo-monero 88fde0309a
blockchain: fix sync at v14 boundary
Miners with MLSAG txes which they'd already verified included
a couple in that block, but the consensus rules had changed
in the meantime, so that block is technically invalid and any
node which did not already have those two txes in their txpool
could not sync. Grandfather them in, since it has no effect in
practice.
2020-10-18 11:52:33 +00:00
moneromooo-monero 4971219c2c
blockchain: deterministic UNIX time unlock checks
Based on a patch by TheCharlatan <seb.kung@gmail.com>
2020-09-15 11:40:28 +00:00
selsta f240b1dd88
build: prepare v0.17 2020-09-14 16:52:42 +02:00
moneromooo-monero fc2cb224a9
blockchain: fix pow skipping for old blocks without precalc hash 2020-09-07 01:57:19 +00:00
Riccardo Spagni aefa7740c3
Merge pull request #6111
d20ff4f64 functional_tests: add a large (many randomx epochs) p2p reorg test (moneromooo-monero)
6a0b3b1f8 functional_tests: add randomx tests (moneromooo-monero)
9d42649d5 core: fix mining from a block that's not the current top (moneromooo-monero)
2020-09-06 15:49:37 +02:00
luigi1111 ee0b02d0db
Merge pull request #6757
6a37da8 threadpool: guard against exceptions in jobs, and armour plating (moneromooo-monero)
2020-09-03 12:25:59 -05:00
moneromooo-monero 6a37da837e
threadpool: guard against exceptions in jobs, and armour plating
Those would, if uncaught, exit run and leave the waiter to wait
indefinitely for the number of active jobs to reach 0
2020-09-01 14:33:33 +00:00
moneromooo-monero 9d42649d58
core: fix mining from a block that's not the current top 2020-08-27 15:13:00 +00:00
moneromooo-monero 82ee01699c
Integrate CLSAGs into monero
They are allowed from v12, and MLSAGs are rejected from v13.
2020-08-27 12:44:04 +00:00
Alexander Blair b04da25e4d
Merge pull request #6760
844fb4e94 enforce claiming maximum coinbase amount (moneromooo-monero)
2020-08-27 03:01:28 -07:00
moneromooo-monero 844fb4e940
enforce claiming maximum coinbase amount
Claiming a slightly lesser amount does not yield the size gains
that were seen pre rct, so this closes a fingerprinting vector
2020-08-21 12:36:53 +00:00
moneromooo-monero 55363c5941
Avoid some temporary strings when reading off the database 2020-08-17 14:02:27 +00:00
Alexander Blair d73b1b6560
Merge pull request #6727
13eee1d6a rpc: reject wrong sized txid (moneromooo-monero)
92e6b7df2 easylogging++: fix crash with reentrant logging (moneromooo-monero)
6dd95d530 epee: guard against exceptions in RPC handlers (moneromooo-monero)
90016ad74 blockchain: guard against exceptions in add_new_block/children (moneromooo-monero)
2020-08-16 12:55:25 -07:00
Alexander Blair bc48494731
Merge pull request #6661
267ce5b71 avoid a couple needless copies (moneromooo-monero)
2020-08-16 12:45:37 -07:00
moneromooo-monero 90016ad744
blockchain: guard against exceptions in add_new_block/children
Reporter requested credit to be given to Decred
2020-07-30 22:52:11 +00:00
Alexander Blair 36d50d93f2
Merge pull request #6534
7bd66b01b daemon: guard against rare 'difficulty drift' bug with checkpoints and recalculation (stoffu)
2020-07-19 03:36:39 -07:00
Alexander Blair 814e617117
Merge pull request #6526
5d882f4f1 blockchain: fix theoretical race getting bulk timestamps (moneromooo-monero)
2020-07-19 03:34:52 -07:00
Alexander Blair a0d179e528
Merge pull request #6512
5ef0607da Update copyright year to 2020 (SomaticFanatic)
2020-07-19 03:32:59 -07:00
moneromooo-monero 0fd6ccef21
blockchain: fix timestamp/difficulty cache getting out of sync
The cache is discarded when a block is popped, but then gets
rebuilt when the difficulty for next block is requested.
While this is all properly locked, it does not take into account
the delay caused by a database transaction being only committed
(and thus its effects made visible to other threads) later on,
which means another thread could request difficulty between
the pop and the commit, which would end up using stale database
view to build the cache, but that cache would not be invalidated
again when the transaction gets committed, which would cause the
cache to not match the new database data.

To fix this, we now keep track of when the cache is invalidated
so we can invalidate it again upon database transaction commit
to ensure it gets calculated again with fresh data next time it
is nedeed.
2020-07-08 22:31:51 +00:00
luigi1111 18bb011afe
Merge pull request #6629
795e186 blockchain: fix total_height in getblocks.bin response (moneromooo-monero)
2020-07-08 17:23:28 -05:00
luigi1111 ed903578d7
Merge pull request #6544
5741b4d blockchain: detect and log bad difficulty calculations (moneromooo-monero)
2020-07-08 17:04:41 -05:00
moneromooo-monero 267ce5b718
avoid a couple needless copies 2020-06-14 18:05:35 +00:00
stoffu 7bd66b01bf
daemon: guard against rare 'difficulty drift' bug with checkpoints and recalculation
On startup, it checks against the difficulty checkpoints, and if any mismatch is found, recalculates all the blocks with wrong difficulties. Additionally, once a week it recalculates difficulties of blocks after the last difficulty checkpoint.
2020-06-09 10:40:51 +09:00
moneromooo-monero 795e18632c
blockchain: fix total_height in getblocks.bin response 2020-06-05 15:27:07 +00:00
moneromooo-monero 5741b4d74d
blockchain: detect and log bad difficulty calculations 2020-05-17 12:44:45 +00:00
selsta 4baee200a7
build: prepare v0.16.0.0 release 2020-05-13 16:15:03 +02:00
moneromooo-monero 5d882f4f14
blockchain: fix theoretical race getting bulk timestamps 2020-05-13 13:42:41 +00:00
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
Lee Clagett e5214a2ca2 Adding ZMQ/Pub support for txpool_add and chain_main events 2020-05-04 02:06:35 +00:00
luigi1111 7954f8cb18
Merge pull request #6358
8958b4e blockchain_db: faster fetching of consecutive txes (moneromooo-monero)
2020-04-10 16:01:37 -05:00
luigi1111 44547006bf
Merge pull request #6347
fcb06f7 cryptonote_core: skip block notify on blockchain switching rollback (xiphon)
2020-04-04 12:52:46 -05:00
luigi1111 c4f75fe898
Merge pull request #6339
c61abf8 remove empty statements (shopglobal)
2020-04-04 12:47:31 -05:00
Alexander Blair aa982a51da
Merge pull request #6284
02224e71 Fix check_fee() discrepancy. (UkoeHB)
2020-03-27 12:21:26 -07:00
Alexander Blair 4da37daf67
Merge pull request #6211
5985c5af rpc: add bad-blocks to flush_cache RPC (moneromooo-monero)
2020-02-28 19:36:16 -08:00
moneromooo-monero 8958b4e7aa
blockchain_db: faster fetching of consecutive txes
Useful for wallet refresh or node sync
2020-02-27 15:05:34 +00:00
xiphon fcb06f7a82 cryptonote_core: skip block notify on blockchain switching rollback 2020-02-19 16:19:29 +00:00
Interchained c61abf87c0 remove empty statements
Cleaning up a little around the code base.
2020-02-17 11:55:15 -05:00
luigi1111 d7aeb5a9f8
Merge pull request #6233
8a27645 blockchain: fix flushing txes from the txpool (moneromooo-monero)
2020-02-04 14:38:35 -05:00
Alexander Blair 8eedc8a390
Merge pull request #6140
08635a08 blockchain: speedup fetching pruned contiguous tx blobs (moneromooo-monero)
2020-01-25 16:55:18 -08:00
Alexander Blair c4abfbfbe7
Merge pull request #6124
21d4c216 blockchain: error out if the builtin hashes data size is wrong (moneromooo-monero)
2020-01-16 17:31:35 -08:00
UkoeHB 02224e714d Fix check_fee() discrepancy.
M100 = max{300kb, min{100block_median, m_long_term_effective_median_block_weight}}
not
M100 = max{300kb, m_long_term_effective_median_block_weight}

Fix base reward in get_dynamic_base_fee_estimate().

get_dynamic_base_fee_estimate() should match check_fee()

Fee is calculated based on block reward, and the reward penalty takes into account 0.5*max_block_weight (both before and after HF_VERSION_EFFECTIVE_SHORT_TERM_MEDIAN_IN_PENALTY).

Moved median calculation according to best practice of 'keep definitions close to where they are used'.
2020-01-09 09:11:09 -06:00
moneromooo-monero 8a276451b2
blockchain: fix flushing txes from the txpool 2019-12-14 02:13:39 +00:00
moneromooo-monero 5985c5afe8
rpc: add bad-blocks to flush_cache RPC
Flushes m_invalid_blocks in Blockchain.
2019-12-02 18:53:30 +00:00
moneromooo-monero 08635a0875
blockchain: speedup fetching pruned contiguous tx blobs
About twice as fast, very roughly
2019-11-15 13:23:30 +00:00
moneromooo-monero 21d4c21619
blockchain: error out if the builtin hashes data size is wrong 2019-11-12 12:43:08 +00:00
Lee Clagett 5d7ae2d279 Adding support for hidden (anonymity) txpool 2019-11-02 20:36:03 +00:00
Riccardo Spagni e4d1674e8c
0.15.0.0 release engineering 2019-11-02 17:21:52 +02:00
moneromooo-monero eb16755083
blockchain: fix unwanted error when probing the pool for a tx 2019-10-27 19:23:25 +00:00
luigi1111 cf2d4d9a16
Merge pull request #5974
7fcd0b5 blockchain: initialize pow to ff..ff (moneromooo-monero)
2019-10-22 10:13:34 -05:00
luigi1111 8bb3c6a8e6
Merge pull request #5970
ab96181 blockchain: use effective median block weight for penalty from v12 (moneromooo-monero)
2019-10-22 10:09:56 -05:00
luigi1111 84ce43a239
Merge pull request #5966
be82c40 Support median block size > 4 GB (moneromooo-monero)
2019-10-22 10:08:32 -05:00
luigi1111 6f202844b5
Merge pull request #5919
01f660f blockchain: fill in cumulative block weight for alt blocks (moneromooo-monero)
2019-10-22 10:06:10 -05:00
moneromooo-monero be82c40703
Support median block size > 4 GB
add a 128/64 division routine so we can use a > 32 bit median block
size in calculations
2019-10-21 10:41:07 +00:00
moneromooo-monero 7fcd0b55ea
blockchain: initialize pow to ff..ff
as a safety to reject if it somehow does not get initialised
2019-10-16 09:00:30 +00:00
luigi1111 37a72fd6ae
Merge pull request #5941
d37d30f blockchain: tweak fee as a function of median values (moneromooo-monero)
2019-10-14 18:11:13 -05:00
luigi1111 dc48cdc998
Merge pull request #5933
3455efa ban peers sending bad pow outright (moneromooo-monero)
2019-10-14 18:07:54 -05:00
moneromooo-monero ab96181e91
blockchain: use effective median block weight for penalty from v12
It was using the raw block weight median, which was not what was
intended in ArticMine's design
2019-10-11 14:16:09 +00:00
moneromooo-monero 01f660f60f
blockchain: fill in cumulative block weight for alt blocks 2019-10-10 20:26:40 +00:00
luigi1111 bf525793c7
Merge pull request #5915
8330e77 monerod can now sync from pruned blocks (moneromooo-monero)
2019-10-08 15:55:03 -05:00
luigi1111 17f063a50f
Merge pull request #5902
b9da023 blockchain: keep block template timestamp not below recent median (moneromooo-monero)
2019-09-30 18:52:11 -05:00
moneromooo-monero d37d30f79a
blockchain: tweak fee as a function of median values
Use the lesser of the short and long terms medians, rather then
the long term median alone

From ArticMine:

I found a bug in the new fee calculation formula with using only the long term median
It actually needs to be the lesser of the long term median and the old (modified short term median)
short term median with the last 10 blocks calculated as empty
Yes the issue occurs if there is a large long term median and, the short term median then falls and tries to then rise again
The fees are could be not high enough
for example LTM and STM rise to say 2000000 bytes
STM falls back to 300000 bytes
Fees are now based on 2000000 bytes until LTM also falls
So the STM is could prevented from rising back up
STM short term median LTM long term median
2019-09-28 22:53:41 +00:00
moneromooo-monero 8330e772f1
monerod can now sync from pruned blocks
If the peer (whether pruned or not itself) supports sending pruned blocks
to syncing nodes, the pruned version will be sent along with the hash
of the pruned data and the block weight. The original tx hashes can be
reconstructed from the pruned txes and theur prunable data hash. Those
hashes and the block weights are hashes and checked against the set of
precompiled hashes, ensuring the data we received is the original data.
It is currently not possible to use this system when not using the set
of precompiled hashes, since block weights can not otherwise be checked
for validity.

This is off by default for now, and is enabled by --sync-pruned-blocks
2019-09-27 00:10:37 +00:00
Howard Chu 81c2ad6d5b
RandomX integration
Support RandomX PoW algorithm
2019-09-25 21:29:42 +01:00
moneromooo-monero 3455efafa8
ban peers sending bad pow outright
PoW is expensive to verify, so be strict
2019-09-25 16:00:43 +00:00
luigi1111 44aa7d5439
Merge pull request #5882
a444f06 blockchain: enforce 10 block age for spending outputs (moneromooo-monero)
2019-09-24 10:27:22 -05:00
luigi1111 ee6e849627
Merge pull request #5877
2cd4fd8 Changed the use of boost:value_initialized for C++ list initializer (JesusRami)
4ad191f Removed unused boost/value_init header (whyamiroot)
928f4be Make null hash constants constexpr (whyamiroot)
2019-09-24 10:08:44 -05:00
moneromooo-monero d0663837d2
core: move hardforks into its own lib
So it can be used by others without encumbrance
2019-09-19 11:28:18 +00:00
moneromooo-monero a444f06e53
blockchain: enforce 10 block age for spending outputs
Some custom wallet code apparently ignores this, which causes users
of that code to be fingerprinted
2019-09-17 11:39:25 +00:00
luigi1111 4a39e1a4a5
Merge pull request #5865
11f13da blockchain: fix logging bad number of blocks if first one fails (moneromooo-monero)
19bfe7e simplewallet: fix warnings about useless std::move (moneromooo-monero)
2019-09-14 13:07:35 -05:00
luigi1111 29e0f11305
Merge pull request #5823
26072f1 blockchain: forbid v1 coinbase from v12 (moneromooo-monero)
555dc7c core: from v12, require consistent ring size for mixable txes (moneromooo-monero)
d22dfb7 blockchain: reject rct signatures in coinbase txes from v12 (moneromooo-monero)
2019-09-14 13:04:41 -05:00
moneromooo-monero b9da0234e9
blockchain: keep block template timestamp not below recent median
Such a template would yield an invalid block, though would require
an attacker to have mined a long blockchain with drifting times
(assuming the miner's clock is roughly correct)

Fixed by crCr62U0
2019-09-11 15:21:52 +00:00
luigi1111 e4f11a68fe
Merge pull request #5819
07cb087 blockchain: Fix alt chain generated coins overflow (iamamyth)
2019-09-04 09:37:32 -05:00
Jesus Ramirez 2cd4fd8972 Changed the use of boost:value_initialized for C++ list initializer 2019-09-02 14:16:29 +02:00
moneromooo-monero 11f13da8b4
blockchain: fix logging bad number of blocks if first one fails 2019-08-28 14:53:29 +00:00
luigi1111 1010a6503e
Merge pull request #5721
c164f90 Remove unnecessary m_check_txin_table, fix const correctness (omartijn)
2019-08-19 17:25:52 -05:00
moneromooo-monero d22dfb7594
blockchain: reject rct signatures in coinbase txes from v12 2019-08-19 16:43:53 +00:00
moneromooo-monero 555dc7c394
core: from v12, require consistent ring size for mixable txes
We're supposed to have a fixed ring size now

Already checked by MLSAG verification, but here seems more intuitive
2019-08-19 16:43:53 +00:00
moneromooo-monero 26072f1393
blockchain: forbid v1 coinbase from v12 2019-08-19 16:43:52 +00:00
iamamyth 07cb087e5d blockchain: Fix alt chain generated coins overflow
Apply the overflow logic used for computing already_generated_coins in
the main chain to alternative chains.
2019-08-18 17:26:58 -07:00
luigi1111 564bb1da3a
Merge pull request #5525
0605406 daemon: sort alt chains by height (moneromooo-monero)
4228ee0  daemon: add optional arguments to alt_chain_info (moneromooo-monero)
880ebfd daemon: add more chain specific info in alt_chain_info (moneromooo-monero)
2019-08-14 15:31:52 -05:00
luigi1111 2258551ef9
Merge pull request #5487
df83ed7 consensus: from v12, enforce >= 2 outputs (moneromooo-monero)
2019-08-14 15:26:55 -05:00
luigi1111 c62ba1d08f
Merge pull request #5591
f17dcde Remove unused txs member in NOTIFY_RESPONSE_GET_OBJECT (Doy-lee)
2019-07-24 14:23:11 -05:00
luigi1111 4b76656f5c
Merge pull request #5524
06b8f29 blockchain: keep alternative blocks in LMDB (moneromooo-monero)
2019-07-24 14:04:16 -05:00
luigi1111 e3de4aa68b
Merge pull request #5502
25a7cfd add a few checks where it seems appropriate (moneromooo-monero)
1a66a86 remove unused code (moneromooo-monero)
2019-07-24 13:57:06 -05:00
Riccardo Spagni 4850520b6a
update checkpoints.dat hash 2019-07-18 16:54:43 +02:00
Doyle f17dcde451 Remove unused txs member in NOTIFY_RESPONSE_GET_OBJECT 2019-07-15 13:27:06 +10:00
Martijn Otto c164f9037e
Remove unnecessary m_check_txin_table, fix const correctness 2019-07-03 14:39:52 +02:00
moneromooo-monero 3c071d203f
blockchain: silence an error getting blocks for pruned nodes
This happens often when a pre-pruning node asks a pruned node
for data it does not have
2019-06-16 11:03:41 +00:00
Riccardo Spagni 633f1542e2
prep for 0.14.1 release 2019-06-14 16:16:52 +02:00
Riccardo Spagni 7e417dd408
Merge pull request #5571
35da33be blockchain: do not try to pop blocks down to the genesis block (moneromooo-monero)
4b51f9a3 core: do not commit half constructed batch db txn (moneromooo-monero)
2019-06-01 20:22:19 +02:00
moneromooo-monero 35da33bea9
blockchain: do not try to pop blocks down to the genesis block 2019-05-26 17:11:32 +00:00
moneromooo-monero 4b51f9a34f
core: do not commit half constructed batch db txn 2019-05-25 16:24:56 +00:00
Howard Chu b6830db2d4
Fix #5553
Make sure the tip hash still matches the cached block
2019-05-19 03:02:33 +01:00