hathor-core icon indicating copy to clipboard operation
hathor-core copied to clipboard

feat(tx): verify block-reward-lock on the first-block of tx that spends

Open jansegre opened this issue 4 years ago • 1 comments

Acceptance Criteria (msbrogli's proposal)

  1. A block B is valid only if B.height >= tx.min_height for all tx such that tx.first_block == B.
  2. All invalid blocks are discarded (and cannot be added to the storage).
  3. A transaction tx is valid if it is verified by a block in the bestchain.
  4. If a transaction tx is in the mempool and the next block cannot verify it, then it must be invalid.

Note: We are using the word "invalid" with two different meanings. On the one hand, invalid blocks must be discarded. On the other hand, invalid txs can be added to the DAG. We need a better word for each of theses cases to avoid misunderstandings.

jansegre avatar Aug 25 '21 19:08 jansegre

Codecov Report

Merging #300 (e90e6b0) into dev (9e25a0a) will decrease coverage by 0.92%. The diff coverage is 79.65%.

:exclamation: Current head e90e6b0 differs from pull request most recent head 95d329e. Consider uploading reports for the commit 95d329e to get more accurate results

@@            Coverage Diff             @@
##              dev     #300      +/-   ##
==========================================
- Coverage   83.72%   82.79%   -0.93%     
==========================================
  Files         185      173      -12     
  Lines       16542    15854     -688     
  Branches     2534     2510      -24     
==========================================
- Hits        13849    13127     -722     
- Misses       2236     2277      +41     
+ Partials      457      450       -7     
Impacted Files Coverage Δ
hathor/transaction/storage/binary_storage.py 93.42% <38.46%> (-4.43%) :arrow_down:
hathor/transaction/storage/compact_storage.py 91.71% <38.46%> (-4.81%) :arrow_down:
hathor/transaction/storage/cache_storage.py 96.80% <60.00%> (+2.10%) :arrow_up:
hathor/transaction/storage/rocksdb_storage.py 94.36% <61.53%> (-5.64%) :arrow_down:
hathor/transaction/storage/transaction_storage.py 81.22% <64.04%> (-13.91%) :arrow_down:
...tion/storage/migrations/add_min_height_metadata.py 72.72% <72.72%> (ø)
hathor/manager.py 72.20% <76.92%> (ø)
hathor/transaction/storage/memory_storage.py 89.06% <77.77%> (-1.85%) :arrow_down:
hathor/transaction/storage/migrations/__init__.py 86.20% <86.20%> (ø)
hathor/consensus.py 95.80% <100.00%> (-0.07%) :arrow_down:
... and 97 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

codecov[bot] avatar Apr 28 '22 20:04 codecov[bot]