Fix race condition (#586)

* `_set_proofs_pending` performs DB related "proofs are spendable" check inside the lock.

* move _verify_spent_proofs_and_set_pending to write.py

* edit logging

---------

Co-authored-by: callebtc <93376500+callebtc@users.noreply.github.com>
This commit is contained in:
lollerfirst
2024-07-17 14:04:17 +02:00
committed by GitHub
parent 71580a5e60
commit efdfecc182
7 changed files with 57 additions and 38 deletions

View File

@@ -39,7 +39,7 @@ async def test_mint_proofs_pending(wallet1: Wallet, ledger: Ledger):
[s.state == ProofSpentState.unspent for s in proofs_states_before_split.states]
)
await ledger.db_write._set_proofs_pending(proofs)
await ledger.db_write._verify_spent_proofs_and_set_pending(proofs)
proof_states = await wallet1.check_proof_state(proofs)
assert all([s.state == ProofSpentState.pending for s in proof_states.states])