Commit Graph

1531 Commits

Author SHA1 Message Date
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 332d60719a
tx_pool: mine stem txes in fake chain mode
This fixes the functional tests, since txes would not be mined
after being sent to the daemon (they'd be waiting for the
dandelion timeout first)
2020-07-09 14:52:13 +00: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 99b14ccd6a
Merge pull request #6647
4d8d121 Fix D++ block template check (vtnerd)
2020-07-08 17:25:01 -05: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 634262f3f5
Merge pull request #6568
f037121 cryptonote_core: remove 'We are most likely forked' message (moneromooo-monero)
2020-07-08 17:10:39 -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
Lee Clagett 4d8d121462 Fix D++ block template check 2020-06-12 22:05:52 -04: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 f0371210e9
cryptonote_core: remove "We are most likely forked" message
It's time based and we don't have forks every 6 months anymore
2020-05-19 16:27:24 +00:00
moneromooo-monero 5741b4d74d
blockchain: detect and log bad difficulty calculations 2020-05-17 12:44:45 +00:00
Lee Clagett 67ade80055 Add randomized delay when forwarding txes from i2p/tor -> ipv4/6 2020-05-15 07:57:35 +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
luigi1111 77a008f714
Merge pull request #6510
70609d7 cryptonote_core: take out the time based upgrade warning (moneromooo-monero)
2020-05-07 10:44:34 -05:00
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
moneromooo-monero 70609d7681
cryptonote_core: take out the time based upgrade warning
It doesn't really work anymore since we don't have a fork soon
2020-05-06 18:27:23 +00:00
luigi1111 0f233c6ad8
Merge pull request #6478
ee58362 Used legacy category to match insert_key_images behavior (vtnerd)
2020-05-06 00:27:13 -05:00
luigi1111 483e5cab5c
Merge pull request #6472
2efbd5f cryptonote: fix reuse of non default tx data when relaying (moneromooo-monero)
2020-05-06 00:25:18 -05:00
luigi1111 1f505a5eac
Merge pull request #6468
a813c46 cryptonote_core: skip dns checkpoints on startup if not enforced (xiphon)
2020-05-06 00:22:20 -05:00
Lee Clagett e5214a2ca2 Adding ZMQ/Pub support for txpool_add and chain_main events 2020-05-04 02:06:35 +00:00
luigi1111 443f5c6bda
Merge pull request #6436
688a3e8 Add timelock verification on device (cslashm)
2020-05-01 15:20:05 -05:00
Sumo Gr dd807b8410 txpool.cpp: rename var to fix for old g++ version (xenial default) 2020-04-29 10:03:51 +00:00
Lee Clagett ee58362b1f Used legacy category to match insert_key_images behavior 2020-04-24 20:19:37 -04:00
moneromooo-monero 2efbd5f0cc
cryptonote: fix reuse of non default tx data when relaying
An automatic tx variable is initialized properly on the first
run through the loop, but not the second. Moving the variable
inside the loop ensures the ctor is called again to init it.
2020-04-22 16:50:20 +00:00
xiphon a813c46a1b cryptonote_core: skip dns checkpoints on startup if not enforced 2020-04-20 18:56:22 +00:00
cslashm 688a3e87e7 Add timelock verification on device 2020-04-08 11:12:32 +02: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
luigi1111 0bb7191fd6
Merge pull request #6328
9bde70e core: mention time being off in hash rate changes message (moneromooo-monero)
2020-04-04 12:40:18 -05:00
luigi1111 6c7d928f19
Merge pull request #6336
760ecf2 console_handler: do not let exception past the dor (moneromooo-monero)
09c8111 threadpool: lock mutex in create (moneromooo-monero)
e377977 tx_pool: catch theoretical error in get_block_reward (moneromooo-monero)
2020-03-31 15:14:12 -05:00
luigi1111 096e2135dd
Merge pull request #6214
054b4c7 protocol: request txpool contents when synced (moneromooo-monero)
2020-03-31 13:32:55 -05:00
Lee Clagett 571546067f Always reject duplicate key-images from second txid 2020-03-30 17:52:42 +00:00
Lee Clagett babf25d2ec Allow unrestricted rpc calls to get full txpool info 2020-03-30 17:52:42 +00:00
Alexander Blair 8cb005b39c
Merge pull request #6289
ffe7165e wallet: reroll fake outs selection on local tx_sanity_check failure (xiphon)
2020-03-27 12:28:29 -07:00
Alexander Blair aa982a51da
Merge pull request #6284
02224e71 Fix check_fee() discrepancy. (UkoeHB)
2020-03-27 12:21:26 -07:00
Alexander Blair a22cf5de1b
Merge pull request #6275
aa93e388 p2p: remove old debug commands (Aaron Hook)
2020-03-27 12:16:30 -07:00
Lee Clagett 02d887c2e5 Adding Dandelion++ support to public networks:
- New flag in NOTIFY_NEW_TRANSACTION to indicate stem mode
  - Stem loops detected in tx_pool.cpp
  - Embargo timeout for a blackhole attack during stem phase
2020-03-26 15:01:30 +00:00
luigi1111 228af683a7
Merge pull request #6403
5de2295 Correct key image check in tx_pool (vtnerd)
2020-04-10 16:10:33 -05: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
moneromooo-monero 054b4c7f41
protocol: request txpool contents when synced
A newly synced Alice sends a (typically quite small) list of
txids in the local tpxool to a random peer Bob, who then uses
the existing tx relay system to send Alice any tx in his txpool
which is not in the list Alice sent
2020-03-22 16:03:31 +00:00
Aaron Hook aa93e38862 p2p: remove old debug commands 2020-03-20 22:09:44 -07:00
Lee Clagett 5de2295f3c Correct key image check in tx_pool 2020-03-14 19:17:15 +00:00
moneromooo-monero f8d76f395b
core: move the LockedTXN class out of txpool so it may be reused
for example, in the RPC server
2020-03-12 11:30:05 +00:00
Alexander Blair 4371ac4265
Merge pull request #6225
987c3139 print_coinbase_tx_sum now supports 128 bits sums (moneromooo-monero)
2020-02-28 19:48:11 -08: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
moneromooo-monero e3779775d7
tx_pool: catch theoretical error in get_block_reward
Coverity 196626
2020-02-12 21:05:28 +00:00
moneromooo-monero 9bde70e567
core: mention time being off in hash rate changes message 2020-02-10 16:56:10 +00:00
Alexander Blair e552ba14b2
Merge pull request #6127
67b4a19e simplewallet: noob-friendly help menu (wowario)
2020-02-06 00:33:31 -08:00
Alexander Blair 2532567091
Merge pull request #6078
b9fc2066 Add a --keep-fakechain option to keep fakechain databases (JamesWrigley)
2020-02-06 00:30:15 -08:00
Alexander Blair 9a08ac98c0
Merge pull request #6050
65301c40 core: point out when we hit the block rate visibility limit (moneromooo-monero)
2020-02-06 00:28:18 -08: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 d1b08c00cf
Merge pull request #6146
70c9cd3c Change to Tx diffusion (Dandelion++ fluff) instead of flooding (Lee Clagett)
2020-01-24 20:06:34 -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
xiphon ffe7165ebf wallet: reroll fake outs selection on local tx_sanity_check failure 2020-01-14 22:56:23 +00: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
luigi1111 e5cc6d39a9
Merge pull request #6055
886ed25 blockchain: fix comment wrongly refering to SHA-3 rather than Keccak (moneromooo-monero)
2019-12-12 13:47:04 -06:00
luigi1111 fb64463c4c
Merge pull request #6052
c96b7ee tx_pool: fix error message assuming incorrectly (moneromooo-monero)
2019-12-12 13:44:50 -06:00
moneromooo-monero 987c3139dc
print_coinbase_tx_sum now supports 128 bits sums
The tail emission will bring the total above 64 bits
2019-12-12 01:56:59 +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
wowario 67b4a19edf
simplewallet: noob-friendly help menu 2019-11-13 10:24:10 +03: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 70c9cd3c9c Change to Tx diffusion (Dandelion++ fluff) instead of flooding 2019-11-04 09:23:20 +00:00
Lee Clagett 5d7ae2d279 Adding support for hidden (anonymity) txpool 2019-11-02 20:36:03 +00:00
Riccardo Spagni eaadbbdab0
Merge pull request #6079
e4d1674e8 0.15.0.0 release engineering (Riccardo Spagni)
2019-11-02 17:31:22 +02:00
Riccardo Spagni e4d1674e8c
0.15.0.0 release engineering 2019-11-02 17:21:52 +02:00
JamesWrigley b9fc206660 Add a --keep-fakechain option to keep fakechain databases
This is handy when doing tests that generate a lot of transactions, since that
takes time it's preferable to re-use the database for future runs.
2019-11-01 23:56:08 +01:00
moneromooo-monero ebc6ce44f4
cryptonote: untangle dependency from miner to blockchain
It causes link errors at least on mac
2019-10-31 01:06:42 +00:00
moneromooo-monero 886ed25055
blockchain: fix comment wrongly refering to SHA-3 rather than Keccak 2019-10-29 11:37:08 +00:00
moneromooo-monero c96b7ee619
tx_pool: fix error message assuming incorrectly 2019-10-29 10:43:59 +00:00
moneromooo-monero 65301c406e
core: point out when we hit the block rate visibility limit 2019-10-28 16:06:15 +00:00
moneromooo-monero eb16755083
blockchain: fix unwanted error when probing the pool for a tx 2019-10-27 19:23:25 +00:00
luigi1111 07c6789148
Merge pull request #5958
d25acd7 Add hmac over encrypted value during transaction (clashm)
34f28a7 Add display address (clashm)
235b94e Revert PR #5835 (export view key) (clashm)
32febd2 Fix debug feature (clashm)
2019-10-25 16:03:24 -05:00
luigi1111 86d085e988
Merge pull request #6028
174a6ac tx_pool: fix divide by 0 in log (moneromooo-monero)
2019-10-25 14:29:15 -05:00
moneromooo-monero a4dc575ccb
rpc: add a flush_cache RPC
This allows flushing internal caches (for now, the bad tx cache,
which will allow debugging a stuck monerod after it has failed to
verify a transaction in a block, since it would otherwise not try
again, making subsequent log changes pointless)
2019-10-25 18:41:54 +00:00
moneromooo-monero 174a6ac9c5
tx_pool: fix divide by 0 in log
Coverity 205394
2019-10-25 16:56:55 +00:00
luigi1111 4233d88341
Merge pull request #5973
abd3763 cryptonote: fill in tx weight when syncing from pruned blocks (moneromooo-monero)
2019-10-22 10:54:46 -05:00
luigi1111 426d2ac8ee
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)
2019-10-22 10:18:28 -05: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
luigi1111 461a25e1b5
Merge pull request #5962
ec14abd tx_pool: make spent return-by-reference as intended (stoffu)
2019-10-16 13:51:34 -05: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 1ba9bafd33
tx_pool: do not divide by 0
In case of a 0 tx weight, we use a placeholder value to insert in the
fee-per-byte set. This is used for pruning and mining, and those txes
are pruned, so will not be too large, nor added to the block template
if mining, so this is safe.

CID 204465
2019-10-11 14:09:31 +00:00
moneromooo-monero fe443bbdec
cryptonote: don't leave block_weight uninitialized
CID 204467
2019-10-11 14:09:31 +00:00
moneromooo-monero 01f660f60f
blockchain: fill in cumulative block weight for alt blocks 2019-10-10 20:26:40 +00:00
moneromooo-monero abd376313b
cryptonote: fill in tx weight when syncing from pruned blocks 2019-10-10 11:08:02 +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
stoffu ec14abdbe8
tx_pool: make spent return-by-reference as intended 2019-10-06 12:28:30 +09:00
cslashm d25acd7a1d Add hmac over encrypted value during transaction 2019-10-03 16:01:34 +02: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
luigi1111 d9cb50870d
Merge pull request #5900
6bbc646 Fix bug in mempool get_transaction_stats histogram calculation (tomsmeding)
2019-09-30 18:49:09 -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 06bee964a8
Merge pull request #5878
f9b3f6e Removed Berkeley DB and db switching logic (JesusRami)
2019-09-24 10:10:28 -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
luigi1111 8c41d36a08
Merge pull request #5864
32f725d Properly format multiline logs (moneromooo-monero)
2019-09-24 10:05:21 -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
moneromooo-monero 32f725d32f
Properly format multiline logs
As a side effect, colouring on Windows should now work
regardless of version
2019-09-16 16:58:01 +00:00
Jesus Ramirez f9b3f6ef3b Removed Berkeley DB and db switching logic 2019-09-16 16:18:05 +02: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 3e75df42a7
Merge pull request #5854
2cb22d4 core: make the 'update probably needed soon' message less scary (moneromooo-monero)
2019-09-14 13:06:05 -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
Tom Smeding 6bbc646e6f Fix bug in mempool get_transaction_stats histogram calculation
The 98th percentile position in the agebytes map was incorrectly
calculated: it assumed the transactions in the mempool all have unique
timestamps at second-granularity. This commit fixes this by correctly
finding the right cumulative number of transactions in the map suffix.

This bug could lead to an out-of-bounds write in the rare case that
all transactions in the mempool were received (and added to the mempool)
at a rate of at least 50 transactions per second. (More specifically,
the number of *unique* receive_time values, which have second-
granularity, must be at most 2% of the number of transactions in the
mempool for this crash to trigger.) If this condition is satisfied, 'it'
points to *before* the agebytes map, 'delta' gets a nonsense value, and
the value of 'i' in the first stats.histo-filling loop will be out of
bounds of stats.histo.
2019-08-28 16:46:31 +02:00
moneromooo-monero 2cb22d4071
core: make the "update probably needed soon" message less scary 2019-08-26 07:56:55 +00:00
luigi1111 eea0123de4
Merge pull request #5755
7a3e458 improve tx_sanity_check clarification (vicsn)
2019-08-21 15:23:58 -05:00
luigi1111 1bd3f1a1fb
Merge pull request #5750
884df82 wallet: provide original address for outgoing transfers (xiphon)
2019-08-21 15:20:51 -05:00
luigi1111 f205d28e96
Merge pull request #5727
7b9a420 Replace std::random_shuffle with std::shuffle (tomsmeding)
2019-08-19 17:31:39 -05: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 1167370239
Merge pull request #5637
69f9420 core: do not complain about low block rate if disconnected (moneromooo-monero)
2019-08-15 17:09:15 -05:00
Tom Smeding 7b9a420787 Replace std::random_shuffle with std::shuffle
According to [1], std::random_shuffle is deprecated in C++14 and removed
in C++17. Since std::shuffle is available since C++11 as a replacement
and monero already requires C++11, this is a good replacement.

A cryptographically secure random number generator is used in all cases
to prevent people from perhaps copying an insecure std::shuffle call
over to a place where a secure one would be warranted. A form of
defense-in-depth.

[1]: https://en.cppreference.com/w/cpp/algorithm/random_shuffle
2019-08-15 16:33:15 +02: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 8adde33e01
Merge pull request #5635
03aa14e tx_sanity_check: don't print an error when not enough outs to check (monermooo-monero)
2019-07-24 14:43:00 -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 9f746b72e2
Merge pull request #5585
270a3ae Unused private member m_miner_address (JesusRami)
2019-07-24 14:19:15 -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
vicsn 7a3e458881 improve tx_sanity_check clarification 2019-07-15 15:19:14 +02:00
Doyle f17dcde451 Remove unused txs member in NOTIFY_RESPONSE_GET_OBJECT 2019-07-15 13:27:06 +10:00
xiphon 884df82db3 wallet: provide original address for outgoing transfers 2019-07-10 13:39:18 +00:00
luigi1111 9d7107c870
Merge pull request #5663
5d6b43b core: fix --prune-blockchain not pruning if no blockchain exists (moneromooo-monero)
2019-07-04 14:46:37 -05:00
luigi1111 59ba0eee69
Merge pull request #5650
3c071d2 blockchain: silence an error getting blocks for pruned nodes (moneromooo-monero)
2019-07-04 14:44:05 -05:00
Martijn Otto c164f9037e
Remove unnecessary m_check_txin_table, fix const correctness 2019-07-03 14:39:52 +02:00
moneromooo-monero da3e20ee01
tx_sanity_check: relax the median check a lot
we don't want to prevent bona fide txes, just obvious bad ones
2019-06-19 23:31:38 +00:00
moneromooo-monero 5d6b43b672
core: fix --prune-blockchain not pruning if no blockchain exists 2019-06-17 16:26:43 +00: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
moneromooo-monero 69f9420489
core: do not complain about low block rate if disconnected
In that case, we'll still keep the "Monero is now disconnected
from the network" near the end of the log
2019-06-13 10:25:30 +00:00
moneromooo-monero 03aa14ec87
tx_sanity_check: don't print an error when not enough outs to check 2019-06-12 12:06:14 +00:00
Riccardo Spagni 62d32e955a
Merge pull request #5577
f950517a core: update pruning if using --prune-blockchain on a pruned blockchain (moneromooo-monero)
2019-06-01 20:25:19 +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
Jesus Ramirez 270a3ae58b Unused private member m_miner_address 2019-05-29 10:12:47 -04:00
moneromooo-monero f950517a08
core: update pruning if using --prune-blockchain on a pruned blockchain
Avoids a massive amount of spurious warnings if the last update before
the daemon exited was a while ago and the daemon was syncing
2019-05-28 09:12:11 +00: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
moneromooo-monero 0605406714
daemon: sort alt chains by height 2019-05-09 09:12:49 +00:00
moneromooo-monero 06b8f29992
blockchain: keep alternative blocks in LMDB
Alternative blocks are cleared on startup unless --keep-alt-blocks
is passed on the command line
2019-05-08 17:36:52 +00:00
Riccardo Spagni f64f59627d
Merge pull request #5510
e9809382 fix wide difficulty conversion with some versions of boost (moneromooo-monero)
2019-05-07 17:36:27 +02:00
moneromooo-monero a4c4a2d8aa
blockchain: keep a rolling long term block weight median 2019-05-02 09:47:01 +00:00
moneromooo-monero e980938210
fix wide difficulty conversion with some versions of boost 2019-05-01 19:58:09 +00:00
moneromooo-monero 1a66a86f94
remove unused code 2019-04-29 20:52:40 +00:00
moneromooo-monero 25a7cfdb4a
add a few checks where it seems appropriate 2019-04-29 20:52:40 +00:00
moneromooo-monero df83ed74e4
consensus: from v12, enforce >= 2 outputs 2019-04-23 22:09:35 +00:00
moneromooo-monero 4be18df32a
tx_sanity_check: relax uniqueness check a bit
It triggers easily on testnet
2019-04-23 21:59:57 +00:00
Riccardo Spagni 68d131615e
Merge pull request #5448
d009f6dd rpc: fix get_block_hashes.bin from wallet on pruned blockchain (moneromooo-monero)
bb0ef5b1 blockchain: lock the blockchain while pruning (moneromooo-monero)
2019-04-16 22:47:36 +02:00
Riccardo Spagni 1f01070a0c
Merge pull request #5434
ccb996af rpc: new sanity check on relayed transactions (moneromooo-monero)
2019-04-16 22:41:40 +02:00
Riccardo Spagni 0d2aaac15b
Merge pull request #5414
e9fac29a unit_tests/long_term_block_weight: some tweaks that seem to make more sense (stoffu)
467f4c7e tests/block_weight: use integer division when computing median (stoffu)
815d08dc tests/block_weight: remove unused MULTIPLIER_SMALL (stoffu)
661f1fb8 blockchain: remove unused calc of short_term_constraint (stoffu)
2019-04-16 22:37:02 +02:00
Riccardo Spagni ce2f46f76b
Merge pull request #5405
ffdbcfb6 core: don't check block rate nor fork time in regtest mode (moneromooo-monero)
2019-04-16 22:32:06 +02:00
moneromooo-monero d009f6dd61
rpc: fix get_block_hashes.bin from wallet on pruned blockchain
We want to get all blocks here, even pruned ones
2019-04-15 22:27:15 +00:00
moneromooo-monero bb0ef5b1f2
blockchain: lock the blockchain while pruning 2019-04-15 22:27:12 +00:00
moneromooo-monero 5e673c03fe
blockchain_db: fix db txn ending too early
The db txn in add_block ending caused the entire overarching
batch txn to stop.
Also add a new guard class so a db txn can be stopped in the
face of exceptions.

Also use a read only db txn in init when the db itself is
read only, and do not save the max tx size in that case.
2019-04-14 08:35:38 +00:00
moneromooo-monero ccb996afc6
rpc: new sanity check on relayed transactions
This will weed out some transactions with silly rings
2019-04-12 20:22:09 +00:00
moneromooo-monero 064ab12340
functional_tests: add more blockchain related tests
Related to emission, reorgs, getting tx data back, output
distribution and histogram
2019-04-11 11:07:58 +00:00
Riccardo Spagni 915d9e5a1f
Merge pull request #5380
113e4877 blockchain_stats: fix sign in formatting function (moneromooo-monero)
adaea3ea various: remove unused variables (moneromooo-monero)
631ef00e blockchain: some debug info when adding txes-from-block fails (moneromooo-monero)
2019-04-11 13:02:59 +02:00
Riccardo Spagni bd429033df
Merge pull request #5378
eda2661a Allow pruning before v10 (moneromooo-monero)
2019-04-11 13:02:35 +02:00
Riccardo Spagni 036daa3af9
Merge pull request #5373
aff80e70 blockchain: fix returned height in create_block_template (moneromooo-monero)
2019-04-11 13:00:55 +02:00
Riccardo Spagni 76fbcfe2dd
Merge pull request #5123
089c7637 cryptonote: rework block blob size sanity check (moneromooo-monero)
2019-04-11 12:41:07 +02:00
stoffu 661f1fb8b2
blockchain: remove unused calc of short_term_constraint 2019-04-09 19:39:24 +09:00
moneromooo-monero ffdbcfb6b3
core: don't check block rate nor fork time in regtest mode 2019-04-07 13:30:02 +00:00
Riccardo Spagni 4ac78e1612
Merge pull request #5346
c84ea299 cryptonote_basic: some more minor speedups (moneromooo-monero)
e40eb2ad cryptonote_basic: speedup calculate_block_hash (moneromooo-monero)
547a9708 cryptonote: block parsing + hash calculation speedup (moneromooo-monero)
11604b6d blockchain: avoid unneeded block copy (moneromooo-monero)
8461df04 save some database calls when getting top block hash and height (moneromooo-monero)
3bbc3661 Avoid repeated (de)serialization when syncing (moneromooo-monero)
2019-04-06 15:59:43 +02:00
moneromooo-monero 089c7637a6
cryptonote: rework block blob size sanity check
Use the actual block weight limit, assuming that weight is always
greater or equal to size
2019-04-05 09:35:19 +00:00
moneromooo-monero 631ef00e76
blockchain: some debug info when adding txes-from-block fails 2019-04-01 19:24:35 +00:00
Riccardo Spagni b8ab510f23
Merge pull request #5332
7c440915 Add get_tx_proof support, needed for new sanity check (cslashm)
98fdcb2a Add support for V11 protocol with BulletProofV2 and short amount. New scheme key destination contrfol Fix dummy decryption in debug mode (cslashm)
3a981a33 Add application version compatibility check. (cslashm)
2019-04-01 17:35:12 +02:00
Riccardo Spagni 29e4e70f30
Merge pull request #5352
ae6885f6 blockchain: incremental long term block weight cache (moneromooo-monero)
9b687c78 blockchain: simple cache for the long term block weights (moneromooo-monero)
2019-04-01 17:34:02 +02:00
Riccardo Spagni 55d7eb06a8
Merge pull request #5317
1730a44f core: improve block rate monitor trigger probabilities (moneromooo-monero)
2019-04-01 17:28:55 +02:00
Riccardo Spagni cabd848efa
Merge pull request #5294
77e9815d blockchain: do not try to pop the genesis block (moneromooo-monero)
2019-04-01 17:22:51 +02:00
moneromooo-monero eda2661aa2
Allow pruning before v10
This check is now not needed anymore, and would prevent people
from using --prune-blockchain when starting a new sync
2019-04-01 14:06:49 +00:00
moneromooo-monero aff80e7043
blockchain: fix returned height in create_block_template
It's now needed for CNv4, and was not retained when cached
2019-03-30 20:27:25 +00:00
moneromooo-monero ae6885f6b4
blockchain: incremental long term block weight cache 2019-03-28 18:07:57 +00:00
moneromooo-monero 9b687c7873
blockchain: simple cache for the long term block weights 2019-03-28 18:07:57 +00:00