@@ -1977,7 +1977,7 @@ export class PgStore {
1977
1977
limit : number ;
1978
1978
offset : number ;
1979
1979
} ) : Promise < DbPox2Event [ ] > {
1980
- return await this . sql . begin ( async sql => {
1980
+ return await this . sqlTransaction ( async sql => {
1981
1981
const queryResults = await sql < Pox2EventQueryResult [ ] > `
1982
1982
SELECT ${ sql ( POX2_EVENT_COLUMNS ) }
1983
1983
FROM pox2_events
@@ -1992,12 +1992,11 @@ export class PgStore {
1992
1992
}
1993
1993
1994
1994
async getPox2EventsForTx ( { txId } : { txId : string } ) : Promise < FoundOrNot < DbPox2Event [ ] > > {
1995
- // TODO: this query should be performed in the same sql tx as the next
1996
- const dbTx = await this . getTx ( { txId, includeUnanchored : true } ) ;
1997
- if ( ! dbTx . found ) {
1998
- return { found : false } ;
1999
- }
2000
- return await this . sql . begin ( async sql => {
1995
+ return await this . sqlTransaction ( async sql => {
1996
+ const dbTx = await this . getTx ( { txId, includeUnanchored : true } ) ;
1997
+ if ( ! dbTx . found ) {
1998
+ return { found : false } ;
1999
+ }
2001
2000
const queryResults = await sql < Pox2EventQueryResult [ ] > `
2002
2001
SELECT ${ sql ( POX2_EVENT_COLUMNS ) }
2003
2002
FROM pox2_events
@@ -2014,7 +2013,7 @@ export class PgStore {
2014
2013
} : {
2015
2014
principal : string ;
2016
2015
} ) : Promise < FoundOrNot < DbPox2Event [ ] > > {
2017
- return await this . sql . begin ( async sql => {
2016
+ return await this . sqlTransaction ( async sql => {
2018
2017
const queryResults = await sql < Pox2EventQueryResult [ ] > `
2019
2018
SELECT ${ sql ( POX2_EVENT_COLUMNS ) }
2020
2019
FROM pox2_events
0 commit comments