B6: atomic UTXO reservation, bet signed by the worker and saved before broadcast, broadcast verdicts (BET-30..33)
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2acd4ccd1c
commit
feff993584
25 files changed
+995
-53
No files matched your search
@@ -89,14 +89,19 @@ def test_a_coinbase_needs_120(player):
|
||||
assert scan(fake)["credited"] == 1
|
||||
|
||||
|
||||
def test_our_own_transactions_need_one(player):
|
||||
def test_the_change_of_our_own_transactions_is_spendable_but_never_a_deposit(player):
|
||||
"""BET-30: the stake was taken from the balance when the bet was placed; its change coming back must not be credited."""
|
||||
user, address = player
|
||||
tx = ChainTransaction.objects.create(kind="withdrawal", user=user)
|
||||
tx = ChainTransaction.objects.create(kind="bet", user=user)
|
||||
chain.register_version(tx, TXID, "00")
|
||||
fake = FakeChain()
|
||||
fake.entries[address] = [coin(height=1000)] # one confirmation
|
||||
fake.verified = {(TXID, 0)}
|
||||
assert scan(fake)["credited"] == 1
|
||||
assert scan(fake) == {"detected": 0, "credited": 0, "orphaned": 0, "reinstated": 0}
|
||||
utxo = Utxo.objects.get()
|
||||
assert utxo.user == user and utxo.confirmed_height == 1000 and not Deposit.objects.exists()
|
||||
assert not Movement.objects.exists() and balance_of(user).spendable_sats == 0
|
||||
scan(fake) # and once only
|
||||
assert Utxo.objects.count() == 1
|
||||
|
||||
|
||||
def test_dust_and_mempool_coins_are_ignored(player):
|
||||
@@ -217,7 +222,7 @@ def test_the_operator_changes_the_threshold_from_the_admin_and_it_is_audited(cli
|
||||
client.force_login(admin)
|
||||
config = LotteryConfig.get()
|
||||
data = {f: getattr(config, f) for f in ("fee_address", "bet_amount_sats", "round_duration_seconds", "round_cooldown_seconds",
|
||||
"draw_confirmations", "deposit_confirmations", "max_round_pool_sats")}
|
||||
"draw_confirmations", "deposit_confirmations", "max_round_pool_sats", "fee_rate_sat_vb")}
|
||||
data["deposit_confirmations"] = 3
|
||||
assert client.post("/admin/lottery/lotteryconfig/1/change/", data).status_code == 302
|
||||
assert LotteryConfig.get().deposit_confirmations == 3
|
||||
|
||||
Reference in new issue
Block a user