File tree Expand file tree Collapse file tree 1 file changed +18
-4
lines changed
util/indexer-r/src/indexer Expand file tree Collapse file tree 1 file changed +18
-4
lines changed Original file line number Diff line number Diff line change @@ -193,21 +193,35 @@ async fn script_exists_in_output(
193
193
script_id : i64 ,
194
194
tx : & mut Transaction < ' _ , Any > ,
195
195
) -> Result < bool , Error > {
196
- let row = sqlx:: query (
196
+ let row_lock = sqlx:: query (
197
197
r#"
198
198
SELECT EXISTS (
199
199
SELECT 1
200
200
FROM output
201
- WHERE lock_script_id = $1 OR type_script_id = $1
201
+ WHERE lock_script_id = $1
202
202
)
203
203
"# ,
204
204
)
205
205
. bind ( script_id)
206
- . fetch_one ( tx)
206
+ . fetch_one ( & mut * tx)
207
207
. await
208
208
. map_err ( |err| Error :: DB ( err. to_string ( ) ) ) ?;
209
209
210
- Ok ( row. get :: < bool , _ > ( 0 ) )
210
+ let row_type = sqlx:: query (
211
+ r#"
212
+ SELECT EXISTS (
213
+ SELECT 1
214
+ FROM output
215
+ WHERE type_script_id = $1
216
+ )
217
+ "# ,
218
+ )
219
+ . bind ( script_id)
220
+ . fetch_one ( & mut * tx)
221
+ . await
222
+ . map_err ( |err| Error :: DB ( err. to_string ( ) ) ) ?;
223
+
224
+ Ok ( row_lock. get :: < bool , _ > ( 0 ) || row_type. get :: < bool , _ > ( 0 ) )
211
225
}
212
226
213
227
async fn uncle_exists_in_association_table (
You can’t perform that action at this time.
0 commit comments