Fix variable naming
The variable should better reflect what the query is doing.
This commit is contained in:
parent
d509f430bf
commit
3c3ac01e98
@ -102,8 +102,8 @@ WHERE sig_id <> pk_id;
|
||||
-- #16.1.5 Get blocks with inputs that have outputs which have already been
|
||||
-- spent (double-spending)
|
||||
|
||||
-- First, get outputs that have been doubly spent
|
||||
CREATE OR REPLACE VIEW outputs_doubly_spent AS (
|
||||
-- First, get outputs that have more than one input
|
||||
CREATE OR REPLACE VIEW outputs_multiple_inputs AS (
|
||||
SELECT output_id
|
||||
FROM non_coinbase_inputs
|
||||
JOIN outputs USING(output_id)
|
||||
@ -113,14 +113,14 @@ CREATE OR REPLACE VIEW outputs_doubly_spent AS (
|
||||
-- Second, get corresponding input_id where the output was first spent
|
||||
CREATE OR REPLACE VIEW inputs_first_spent AS (
|
||||
SELECT MIN(input_id) AS input_id, output_id
|
||||
FROM outputs_doubly_spent
|
||||
FROM outputs_multiple_inputs
|
||||
JOIN non_coinbase_inputs USING(output_id)
|
||||
GROUP BY output_id
|
||||
);
|
||||
-- Third, combine to get invalid blocks
|
||||
INSERT INTO temporary_table
|
||||
SELECT block_id
|
||||
FROM outputs_doubly_spent
|
||||
FROM outputs_multiple_inputs
|
||||
JOIN non_coinbase_inputs USING(output_id)
|
||||
WHERE input_id NOT IN (
|
||||
SELECT input_id
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user