Commit Graph

87 Commits

Author SHA1 Message Date
SChernykh b5b72ae05c Fixed mempool pruning
- Fixed undefined behavior after a call to `remove_tx_from_transient_lists` (it used an invalid iterator)
- Fixed `txCompare` (it wasn't strictly weak ordered)
2024-03-08 21:03:41 +01:00
j-berman f137a35984 Enforce restricted # pool txs served via RPC + optimize chunked reqs [release-v0.18]
- `/getblocks.bin` respects the `RESTRICTED_TX_COUNT` (=100) when
returning pool txs via a restricted RPC daemon.
- A restricted RPC daemon includes a max of `RESTRICTED_TX_COUNT` txs
in the `added_pool_txs` field, and returns any remaining pool hashes
in the `remaining_added_pool_txids` field. The client then requests
the remaining txs via `/gettransactions` in chunks.
- `/gettransactions` no longer does expensive no-ops for ALL pool txs
if the client requests a subset of pool txs. Instead it searches for
the txs the client explicitly requests.
- Reset `m_pool_info_query_time` when a user:
  (1) rescans the chain (so the wallet re-requests the whole pool)
  (2) changes the daemon their wallets points to (a new daemon would
      have a different view of the pool)
- `/getblocks.bin` respects the `req.prune` field when returning
pool txs.
- Pool extension fields in response to `/getblocks.bin` are optional
with default 0'd values.
2023-07-09 08:38:18 +02:00
rbrunner7 23f782b211 wallet2, RPC: Optimize RPC calls for periodic refresh from 3 down to 1 call [release-v0.18] 2023-07-09 08:30:53 +02:00
luigi1111 b9e8504cfb
Merge pull request #8467
fac7c43 continue pool pruning even if a tx can't be found (j-berman)
2022-08-09 17:43:32 -05:00
luigi1111 5c33f40cd8
Merge pull request #8455
099fc1f Fixed get_block_template_backlog performance (SChernykh)
2022-08-08 20:29:56 -05:00
j-berman fac7c43644 continue pool pruning even if a tx can't be found 2022-07-26 17:28:02 -07:00
SChernykh 099fc1f8a9 Fixed get_block_template_backlog performance
Before the fix, it processed all transactions in the mempool which could be very slow when mempool grows to several MBs in size. I observed `get_block_template_backlog` taking up to 15 seconds of CPU time under high mempool load.

After the fix, only transactions that can potentially be mined in the next block will be processed (a bit more than the current block median weight).
2022-07-22 13:50:21 +02:00
j-berman 8cc3c9af4d Publish submitted txs via zmq 2022-07-21 11:53:31 -07:00
mj-xmr da9aa1f7f8
Copyright: Update to 2022 2022-03-04 06:59:20 +01:00
SChernykh dfee15eee1 RPC and ZeroMQ APIs to support p2pool
Adds the following:

- "get_miner_data" to RPC API
- "json-miner-data" to ZeroMQ subscriber contexts

Both provide the necessary data to create a custom block template. They are used by p2pool.

Data provided:

- major fork version
- current height
- previous block id
- RandomX seed hash
- network difficulty
- median block weight
- coins mined by the network so far
- mineable mempool transactions
2021-09-11 15:15:07 +02:00
Lee Clagett d73cb95dfa Fix timeout checks for forwarded and Dandelion++ stem txes 2020-11-15 00:08:10 -05: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
SomaticFanatic 5ef0607da6 Update copyright year to 2020
Update copyright year to 2020
2020-05-06 22:36:54 -04:00
Lee Clagett 571546067f Always reject duplicate key-images from second txid 2020-03-30 17:52:42 +00: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
Lee Clagett 5d7ae2d279 Adding support for hidden (anonymity) txpool 2019-11-02 20:36:03 +00: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
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 01f660f60f
blockchain: fill in cumulative block weight for alt blocks 2019-10-10 20:26:40 +00:00
stoffu ec14abdbe8
tx_pool: make spent return-by-reference as intended 2019-10-06 12:28:30 +09: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
binaryFate 1f2930ce0b Update 2019 copyright 2019-03-05 22:05:34 +01:00
moneromooo-monero b044d03a51
Avoid repeated (de)serialization when syncing 2019-03-05 11:57:55 +00:00
Tom Smeding 9bf0e53751 cryptonote: Add const-qualifier on comparison functor
The original code did not compile with GCC 8.2.1 in C++17 mode, since
comparison functions for std::set's must be invocable as const.
2019-02-01 16:44:56 +01:00
Riccardo Spagni e90ee7548c
Merge pull request #4765
09dbd9cb tx_pool: fix comment about transaction_prefix (moneromooo-monero)
2018-11-16 10:58:42 +02:00
moneromooo-monero bf31447e9b
tx_pool: speed up take_tx for transactions from blocks
This happens for every historical tx when syncing, and the
unnecessary parsing is actually showing up on profile.
Since these are kept cached for just one block, this does
not increase memory usage after syncing.
2018-11-01 15:51:28 +00:00
moneromooo-monero 6ecc99ad1f
core: avoid unnecessary tx/blob conversions 2018-11-01 15:51:19 +00:00
moneromooo-monero 09dbd9cbbc
tx_pool: fix comment about transaction_prefix
It was leftover from a change that was undone before commit,
but the comment change was let through
2018-10-31 12:15:38 +00:00
moneromooo-monero 6844ae1b8d
tx_pool: avoid parsing a whole tx if only the prefix is needed 2018-10-08 10:18:01 +00:00
moneromooo-monero 5ffb2ff9b7
v8: per byte fee, pad bulletproofs, fixed 11 ring size 2018-09-11 13:38:07 +00:00
moneromooo-monero 82d1b74500
core: cache block template where possible
This avoids constant rechecking of the same things each time
a miner asks for the block template. The tx pool maintains
a cookie to allow users to detect when the pool state changed,
which means the block template needs rebuilding.
2018-08-16 12:44:33 +00:00
luigi1111 5cade94189
Merge pull request #4047
41b4bf9 tx_pool: cache check_tx_inputs results (moneromooo-monero)
2018-07-19 14:02:20 -05:00
moneromooo-monero ed2c81ed95
replace std::list with std::vector on some hot paths
also use reserve where appropriate
2018-06-26 22:14:21 +01:00
moneromooo-monero 41b4bf9d6d
tx_pool: cache check_tx_inputs results
This is called a lot when creating a block template, and
does not change until the blockchain changes.
This also avoids tx parsing when cached.
2018-06-24 11:22:26 +01:00
moneromooo-monero 2b0c632f32
tx_pool: hold off parsing a tx blob till we actually need it 2018-06-02 09:17:41 +01:00
moneromooo-monero bc61ae69bf
tx_pool: add a max pool size, settable with --max-txpool-size 2018-02-07 13:42:12 +00:00
xmr-eric 18216f19dd Update 2018 copyright 2018-01-26 10:03:20 -05:00
Riccardo Spagni fd0740e5e7
Merge pull request #2615
10013e94 Protect node privacy by proper filtering in restricted-mode RPC answers (binaryFate)
2017-11-14 14:53:10 +02:00
binaryFate 10013e9434 Protect node privacy by proper filtering in restricted-mode RPC answers
This patch allows to filter out sensitive information for queries that rely on the pool state, when running in restricted mode.
This filtering is only applied to data sent back to RPC queries. Results of inline commands typed locally in the daemon are not affected.
In practice, when running with `--restricted-rpc`:
* get_transaction_pool will list relayed transactions with the fields "last relayed time" and "received time" set to zero.
* get_transaction_pool will not list transaction that have do_not_relay set to true, and will not list key images that are used only for such transactions
* get_transaction_pool_hashes.bin will not list such transaction
* get_transaction_pool_stats will not count such transactions in any of the aggregated values that are computed

The implementation does not make filtering the default, so developers should be mindful of this if they add new RPC functionality.
Fixes #2590.
2017-11-08 13:07:07 +01:00
moneromooo-monero ccf53a566c
track double spending in the txpool
Transactions in the txpool are marked when another transaction
is seen double spending one or more of its inputs.
This is then exposed wherever appropriate.

Note that being marked with this "double spend seen" flag does
NOT mean this transaction IS a double spend and will never be
mined: it just means that the network has seen at least another
transaction spending at least one of the same inputs, so care
should be taken to wait for a few confirmations before acting
upon that transaction (ie, mostly of use for merchants wanting
to accept unconfirmed transactions).
2017-11-06 00:05:44 +00:00
Thomas Winget 77986023c3
json serialization for rpc-relevant monero types
Structured {de-,}serialization methods for (many new) types
which are used for requests or responses in the RPC.

New types include RPC requests and responses, and structs which compose
types within those.

# Conflicts:
#	src/cryptonote_core/blockchain.cpp
2017-09-05 12:20:27 -04:00
moneromooo-monero 55bec1f03d
rpc: add a new RPC to get current txpool backlog (sizes and fees) 2017-08-26 16:23:31 +01:00
moneromooo-monero 14ec6ed80d
tx_pool: remove obsolete unused m_config_folder field 2017-07-30 12:03:43 +01:00
Howard Chu 5414970dcd
Speedup print_pool_stats
Since we're just counting txs, there's no reason to deserialize all the blobs.
2017-06-01 17:34:03 +01:00
Riccardo Spagni 545e2b003c
Merge pull request #1982
b52abd13 Move txpool to the database (moneromooo-monero)
2017-05-30 21:12:44 +02:00
moneromooo-monero b52abd1370
Move txpool to the database
Integration could go further (ie, return_tx_to_pool calls should
not be needed anymore, possibly other things).

poolstate.bin is now obsolete.
2017-05-25 22:23:37 +01:00
assylias bff90264b8
Add expected total reward to RPC "getblocktemplate".
Only works from V5 fork onward - returns 0 before that block.
2017-04-19 18:28:16 +01:00
moneromooo-monero 558cfc31ca
core, wallet: faster tx pool scanning
Includes a new RPC to get tx pool hashes fast.
2017-03-23 09:25:22 +00:00
Riccardo Spagni c3599fa7b9
update copyright year, fix occasional lack of newline at line end 2017-02-21 19:38:18 +02:00