Skip to content

Commit e18c39e

Browse files
iltogasg2bcz
andauthored
Bug Fixing (#639)
* Fix bug in pendingSignatureQuery rollback function * Remove unused function from transactionQuery Co-authored-by: stefano galassi <[email protected]>
1 parent 3cdcd68 commit e18c39e

File tree

3 files changed

+2
-8
lines changed

3 files changed

+2
-8
lines changed

common/query/pendingSignatureQuery.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (psq *PendingSignatureQuery) BuildModel(
129129
func (psq *PendingSignatureQuery) Rollback(height uint32) (multiQueries [][]interface{}) {
130130
return [][]interface{}{
131131
{
132-
fmt.Sprintf("DELETE FROM %s WHERE height > ?", psq.TableName),
132+
fmt.Sprintf("DELETE FROM %s WHERE block_height > ?", psq.TableName),
133133
height,
134134
},
135135
{

common/query/pendingSignatureQuery_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ func TestPendingSignatureQuery_Rollback(t *testing.T) {
334334
},
335335
wantMultiQueries: [][]interface{}{
336336
{
337-
"DELETE FROM pending_signature WHERE height > ?",
337+
"DELETE FROM pending_signature WHERE block_height > ?",
338338
uint32(10),
339339
},
340340
{

common/query/transactionQuery.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@ type (
1717
GetTransactionsByBlockID(blockID int64) (str string, args []interface{})
1818
ExtractModel(tx *model.Transaction) []interface{}
1919
BuildModel(txs []*model.Transaction, rows *sql.Rows) ([]*model.Transaction, error)
20-
DeleteTransactions(id int64) string
2120
Scan(tx *model.Transaction, row *sql.Row) error
2221
}
2322

@@ -95,11 +94,6 @@ func (tq *TransactionQuery) GetTransactionsByIds(txIds []int64) (str string, arg
9594
return query, []interface{}{}
9695
}
9796

98-
// DeleteTransactions. delete some transactions according to timestamp
99-
func (tq *TransactionQuery) DeleteTransactions(id int64) string {
100-
return fmt.Sprintf("DELETE FROM %v WHERE height >= (SELECT height FROM %v WHERE ID = %v)", tq.getTableName(), tq.getTableName(), id)
101-
}
102-
10397
// ExtractModel extract the model struct fields to the order of TransactionQuery.Fields
10498
func (*TransactionQuery) ExtractModel(tx *model.Transaction) []interface{} {
10599
return []interface{}{

0 commit comments

Comments
 (0)