import block
import ecc
import helper
import script
import tx
---
exercise1:tx:TxTest:test_is_coinbase
---
example1
---
example2
---
exercise2:tx:TxTest:test_coinbase_height
---
example3
---
exercise3:block:BlockTest:test_parse
---
exercise4:block:BlockTest:test_serialize
---
exercise5:block:BlockTest:test_hash
---
example4
---
exercise6:block:BlockTest:test_bip9
---
exercise7:block:BlockTest:test_bip91
---
exercise8:block:BlockTest:test_bip141
---
example5
---
example6
---
example7
---
exercise9:block:BlockTest:test_target
---
example8
---
exercise10:block:BlockTest:test_difficulty
---
exercise11:block:BlockTest:test_check_pow
---
example9
---
exercise12:
from block import Block, TWO_WEEKS
from helper import target_to_bits

block1_hex = '000000203471101bbda3fe307664b3283a9ef0e97d9a38a7eacd8800000000000000000010c8aba8479bbaa5e0848152fd3c2289ca50e1c3e58c9a4faaafbdf5803c5448ddb845597e8b0118e43a81d3'
block2_hex = '02000020f1472d9db4b563c35f97c428ac903f23b7fc055d1cfc26000000000000000000b3f449fcbe1bc4cfbcb8283a0d2c037f961a3fdf2b8bedc144973735eea707e1264258597e8b0118e5f00474'

# przeanalizuj oba bloki,
# określ różnicę czasu,
# jeśli różnica > 8 tygodni, przypisz jej 8 tygodni,
# jeśli różnica < 1/2 tygodnia, przypisz jej 1/2 tygodnia,
# nowy cel, to ostatni cel * różnica/2 tygodnie,
# skonwertuj nowy cel na bity,
# wydrukuj nowe bity szesnastkowo

---
exercise13:helper:HelperTest:test_calculate_new_bits
