bool leveldb_chain_keeper::clear_transaction_data( leveldb_transaction_batch& batch, const transaction_type& remove_tx) { const hash_digest& tx_hash = hash_transaction(remove_tx); batch.tx.Delete(slice(tx_hash)); // Remove spends // ... spends don't exist for coinbase txs. if (!is_coinbase(remove_tx)) for (uint32_t input_index = 0; input_index < remove_tx.inputs.size(); ++input_index) { const transaction_input_type& input = remove_tx.inputs[input_index]; // We could check if the spend matches the inpoint for safety. //const input_point inpoint{tx_hash, input_index}; // Recreate the key... data_chunk spent_key = create_spent_key(input.previous_output); // ... Perform the delete. batch.spend.Delete(slice(spent_key)); if (!remove_debit(batch.debit, input)) return false; } // Remove addresses for (uint32_t output_index = 0; output_index < remove_tx.outputs.size(); ++output_index) { const transaction_output_type& output = remove_tx.outputs[output_index]; if (!remove_credit(batch.credit, output, {tx_hash, output_index})) return false; } return true; }
CALLSET_ENTRY (tilt, sw_slam_tilt) { /* Ignore slam tilt switch entirely while coin door is open, and configured for tournament mode. This is to avoid inadvertent slam tilts while dealing with problems. */ if (system_config.tournament_mode && !switch_poll_logical (SW_COIN_DOOR_CLOSED)) return; /* Ignore right after a coin door open/close */ if (nonball_event_did_follow (sw_coin_door_closed, sw_slam_tilt)) return; /* Kill the current game */ stop_game (); /* Disable coins briefly, the whole point of the slam tilt */ event_can_follow (sw_slam_tilt, sw_coin, TIME_5S); /* Start the slam tilt effect */ callset_invoke (slam_tilt); deff_start (DEFF_SLAM_TILT); leff_restart (LEFF_TILT); /* Audit the event */ audit_increment (&system_audits.slam_tilts); /* When slamtilt penalty adjustment is enabled, remove a credit. */ if (price_config.slamtilt_penalty) remove_credit (); while (deff_get_active () == DEFF_SLAM_TILT) task_sleep (TIME_66MS); /* TODO: wait for slam switch to become stable, to avoid * endless restarts */ warm_reboot (); }