(b, alice, bob)
| 258 | |
| 259 | @pytest.mark.bdb |
| 260 | def test_run_recover(b, alice, bob): |
| 261 | from bigchaindb.commands.bigchaindb import run_recover |
| 262 | from bigchaindb.models import Transaction |
| 263 | from bigchaindb.lib import Block |
| 264 | from bigchaindb.backend import query |
| 265 | |
| 266 | tx1 = Transaction.create([alice.public_key], |
| 267 | [([alice.public_key], 1)], |
| 268 | asset={'cycle': 'hero'}, |
| 269 | metadata={'name': 'hohenheim'}) \ |
| 270 | .sign([alice.private_key]) |
| 271 | tx2 = Transaction.create([bob.public_key], |
| 272 | [([bob.public_key], 1)], |
| 273 | asset={'cycle': 'hero'}, |
| 274 | metadata={'name': 'hohenheim'}) \ |
| 275 | .sign([bob.private_key]) |
| 276 | |
| 277 | # store the transactions |
| 278 | b.store_bulk_transactions([tx1, tx2]) |
| 279 | |
| 280 | # create a random block |
| 281 | block8 = Block(app_hash='random_app_hash1', height=8, |
| 282 | transactions=['txid_doesnt_matter'])._asdict() |
| 283 | b.store_block(block8) |
| 284 | |
| 285 | # create the next block |
| 286 | block9 = Block(app_hash='random_app_hash1', height=9, |
| 287 | transactions=[tx1.id])._asdict() |
| 288 | b.store_block(block9) |
| 289 | |
| 290 | # create a pre_commit state which is ahead of the commit state |
| 291 | pre_commit_state = dict(height=10, transactions=[tx2.id]) |
| 292 | b.store_pre_commit_state(pre_commit_state) |
| 293 | |
| 294 | run_recover(b) |
| 295 | |
| 296 | assert not query.get_transaction(b.connection, tx2.id) |
| 297 | |
| 298 | |
| 299 | # Helper |
nothing calls this directly
no test coverage detected