Zebra/zebra-chain/src
Janito Vaqueiro Ferreira Filho a0d45c38f3
Reject conflicting mempool transactions (#2765)
* Add `Transaction::spent_outpoints` getter method

Returns an iterator over the UTXO `OutPoint`s spent by the transaction.

* Add `mempool::Error::Conflict` variant

An error representing that a transaction was rejected because it
conflicts with another transaction that's already in the mempool.

* Reject conflicting mempool transactions

Reject including a transaction in the mempool if it spends outputs
already spent by, or reveals nullifiers already revealed by another
transaction in the mempool.

* Fix typo in documentation

Remove the `r` that was incorrectly added.

Co-authored-by: teor <teor@riseup.net>

* Specify that the conflict is a spend conflict

Make the situation clearer, because there are other types of conflict.

Co-authored-by: teor <teor@riseup.net>

* Clarify that the outpoints are from inputs

Because otherwise it could lead to confusion because it could also mean
the outputs of the transaction represented as `OutPoint` references.

Co-authored-by: teor <teor@riseup.net>

* Create `storage::tests::vectors` module

Refactor to follow the convention used for other tests.

* Add an `AtLeastOne::first_mut` method

A getter to allow changing the first element.

* Add an `AtLeastOne::push` method

Allow appending elements to the collection.

* Derive `Arbitrary` for `FieldNotPresent`

This is just to make the code that generates arbitrary anchors a bit
simpler.

* Test if conflicting transactions are rejected

Generate two transactions (either V4 or V5) and insert a conflicting
spend, which can be either a transparent UTXO, or a nullifier for one of
the shielded pools. Check that any attempt to insert both transactions
causes one to be accepted and the other to be rejected.

* Delete a TODO comment that we decided not to do

Co-authored-by: teor <teor@riseup.net>
2021-09-28 01:03:08 +00:00
..
amount Check remaining transaction value & make value balance signs match the spec (#2566) 2021-08-09 14:22:26 -03:00
block Fix an incorrect assertion when the block locator is at the tip (#2789) 2021-09-27 22:43:05 +00:00
history_tree Refactor HistoryTree into NonEmptyHistoryTree and HistoryTree (#2582) 2021-08-10 09:51:50 -03:00
orchard Add orchard binding_verification_key (#2441) 2021-08-16 15:16:25 -04:00
parameters Reset `ChainTipChange`s on chain fork and network upgrade activation (#2721) 2021-09-02 12:25:42 +10:00
primitives Implement ZIP-244 authorizing data commitment (auth_digest) (#2547) 2021-08-13 12:58:04 -04:00
sapling Reject conflicting mempool transactions (#2765) 2021-09-28 01:03:08 +00:00
serialization Reject conflicting mempool transactions (#2765) 2021-09-28 01:03:08 +00:00
sprout Refactor value balances to support generated data modification (#2596) 2021-08-10 14:42:02 +00:00
transaction Add transaction downloader and verifier (#2679) 2021-09-02 00:06:20 +00:00
transparent Add transaction downloader and verifier (#2679) 2021-09-02 00:06:20 +00:00
value_balance Split ValueBalance methods into NegativeAllowed and NonNegative (#2649) 2021-08-20 13:30:38 +00:00
work Replace primitives_types with uint (#2350) 2021-06-18 15:35:05 -03:00
amount.rs Check remaining transaction value & make value balance signs match the spec (#2566) 2021-08-09 14:22:26 -03:00
block.rs ZIP-221/244 auth data commitment validation in checkpoint verifier (#2633) 2021-08-23 14:17:33 +00:00
chain_tip.rs Add a `ChainTipChange` type to `await` chain tip changes (#2715) 2021-09-01 22:31:16 +00:00
fmt.rs Add a TypeNameToDebug formatter to zebra_chain (#2466) 2021-07-09 12:40:19 +10:00
history_tree.rs Improve some test errors (#2643) 2021-08-19 19:44:02 +00:00
lib.rs Refactor BestTipHeight into a generic ChainTip sender and receiver (#2676) 2021-08-27 11:34:33 +10:00
orchard.rs Orchard data in V5 parsing (#2116) 2021-05-21 00:42:06 +00:00
parameters.rs Cleanup a few arbitrary impls (#2222) 2021-05-28 09:49:28 -03:00
primitives.rs Add ZIP-244 signature hash support (#2165) 2021-07-07 08:27:10 +10:00
sapling.rs Update multiple crates to ensure bitvec 0.22.3 is being used (#2351) 2021-06-23 13:16:22 +10:00
serialization.rs Security: Zebra should stop gossiping unreachable addresses to other nodes, Action: re-deploy all nodes (#2392) 2021-06-29 05:12:27 +00:00
shutdown.rs Fix shutdown panics (#1637) 2021-02-03 19:03:28 +10:00
sprout.rs Move the preallocate tests into their own files (#1977) 2021-04-07 12:32:27 +10:00
transaction.rs Reject conflicting mempool transactions (#2765) 2021-09-28 01:03:08 +00:00
transparent.rs Generate test chains with valid chain value pools (#2597) 2021-08-12 12:38:16 +00:00
value_balance.rs Add value pool/balances to non-finalized state (#2656) 2021-08-25 10:57:07 -03:00
work.rs Replace primitives_types with uint (#2350) 2021-06-18 15:35:05 -03:00