mirror of
https://github.com/tendermint/tendermint.git
synced 2026-09-19 14:34:17 +00:00
WIP update verifyTimeStamp
This commit is contained in:
@@ -240,27 +240,12 @@ func verifyTx(hash []byte) (*abci.TxResult, error) {
|
|||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyTimeStamp(tb string) error {
|
func verifyTimeStamp(tableName string) error {
|
||||||
|
return db.QueryRow(fmt.Sprintf(`
|
||||||
// We assume the tx indexing time would not exceed 2 second from now
|
SELECT DISTINCT %[1]s.created_at
|
||||||
sqlStmt := sq.
|
FROM %[1]s
|
||||||
Select(fmt.Sprintf("%s.created_at", tb)).
|
WHERE %[1]s.created_at >= ?;
|
||||||
Distinct().From(tb).
|
`, tableName), time.Now().Add(-2*time.Second)).Err()
|
||||||
Where(fmt.Sprintf("%s.created_at >= $1", tb), time.Now().Add(-2*time.Second))
|
|
||||||
|
|
||||||
rows, err := sqlStmt.RunWith(db).Query()
|
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
defer rows.Close()
|
|
||||||
|
|
||||||
if rows.Next() {
|
|
||||||
var ts string
|
|
||||||
return rows.Scan(&ts)
|
|
||||||
}
|
|
||||||
|
|
||||||
return errors.New("no result")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func verifyBlock(h int64) (bool, error) {
|
func verifyBlock(h int64) (bool, error) {
|
||||||
|
|||||||
Reference in New Issue
Block a user