Skip to content

Fixed bug in pendingSignatureQuery rollback function #639

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 11, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion common/query/pendingSignatureQuery.go
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ func (psq *PendingSignatureQuery) BuildModel(
func (psq *PendingSignatureQuery) Rollback(height uint32) (multiQueries [][]interface{}) {
return [][]interface{}{
{
fmt.Sprintf("DELETE FROM %s WHERE height > ?", psq.TableName),
fmt.Sprintf("DELETE FROM %s WHERE block_height > ?", psq.TableName),
height,
},
{
Expand Down
2 changes: 1 addition & 1 deletion common/query/pendingSignatureQuery_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -334,7 +334,7 @@ func TestPendingSignatureQuery_Rollback(t *testing.T) {
},
wantMultiQueries: [][]interface{}{
{
"DELETE FROM pending_signature WHERE height > ?",
"DELETE FROM pending_signature WHERE block_height > ?",
uint32(10),
},
{
Expand Down
6 changes: 0 additions & 6 deletions common/query/transactionQuery.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type (
GetTransactionsByBlockID(blockID int64) (str string, args []interface{})
ExtractModel(tx *model.Transaction) []interface{}
BuildModel(txs []*model.Transaction, rows *sql.Rows) ([]*model.Transaction, error)
DeleteTransactions(id int64) string
Scan(tx *model.Transaction, row *sql.Row) error
}

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

// DeleteTransactions. delete some transactions according to timestamp
func (tq *TransactionQuery) DeleteTransactions(id int64) string {
return fmt.Sprintf("DELETE FROM %v WHERE height >= (SELECT height FROM %v WHERE ID = %v)", tq.getTableName(), tq.getTableName(), id)
}

// ExtractModel extract the model struct fields to the order of TransactionQuery.Fields
func (*TransactionQuery) ExtractModel(tx *model.Transaction) []interface{} {
return []interface{}{
Expand Down