From 791bfb00aaf6a5953326c0ce711469fd8cf0853d Mon Sep 17 00:00:00 2001 From: Magic Cat Date: Tue, 26 Sep 2023 13:21:30 +0700 Subject: [PATCH] lint --- database/auth.go | 10 ++++++++-- modules/gov/handle_block.go | 5 ++--- modules/gov/handle_msg.go | 2 +- 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/database/auth.go b/database/auth.go index eb5cdbf5b..4b406ddd9 100644 --- a/database/auth.go +++ b/database/auth.go @@ -101,7 +101,7 @@ func (db *Db) storeVestingAccount(account exported.VestingAccount) (int, error) // Store the vesting account err := db.SaveAccounts([]types.Account{types.NewAccount(account.GetAddress().String())}) if err != nil { - return 0, fmt.Errorf("error while storing vesting account: %s", err) + return 0, fmt.Errorf("error while storing vesting account address: %s", err) } var vestingAccountRowID int @@ -130,7 +130,13 @@ func (db *Db) StoreBaseVestingAccountFromMsg(bva *vestingtypes.BaseVestingAccoun start_time = excluded.start_time, end_time = excluded.end_time` - _, err := db.SQL.Exec(stmt, + // Store the vesting account + err := db.SaveAccounts([]types.Account{types.NewAccount(bva.GetAddress().String())}) + if err != nil { + return fmt.Errorf("error while storing vesting account address: %s", err) + } + + _, err = db.SQL.Exec(stmt, proto.MessageName(bva), bva.GetAddress().String(), pq.Array(dbtypes.NewDbCoins(bva.OriginalVesting)), diff --git a/modules/gov/handle_block.go b/modules/gov/handle_block.go index 4e2ea494f..e16e34164 100644 --- a/modules/gov/handle_block.go +++ b/modules/gov/handle_block.go @@ -3,7 +3,6 @@ package gov import ( "fmt" "strconv" - "time" juno "github.com/forbole/juno/v5/types" @@ -20,7 +19,7 @@ func (m *Module) HandleBlock( b *tmctypes.ResultBlock, blockResults *tmctypes.ResultBlockResults, _ []*juno.Tx, _ *tmctypes.ResultValidators, ) error { - err := m.updateProposalsStatus(b.Block.Height, b.Block.Time, blockResults.EndBlockEvents) + err := m.updateProposalsStatus(b.Block.Height, blockResults.EndBlockEvents) if err != nil { log.Error().Str("module", "gov").Int64("height", b.Block.Height). Err(err).Msg("error while updating proposals") @@ -30,7 +29,7 @@ func (m *Module) HandleBlock( } // updateProposalsStatus updates the status of proposals if they have been included in the EndBlockEvents -func (m *Module) updateProposalsStatus(height int64, blockTime time.Time, events []abci.Event) error { +func (m *Module) updateProposalsStatus(height int64, events []abci.Event) error { if len(events) == 0 { return nil } diff --git a/modules/gov/handle_msg.go b/modules/gov/handle_msg.go index 146fcdab5..b41ec94c4 100644 --- a/modules/gov/handle_msg.go +++ b/modules/gov/handle_msg.go @@ -105,7 +105,7 @@ func (m *Module) handleMsgSubmitProposal(tx *juno.Tx, index int, msg *govtypesv1 err = m.db.SaveAccounts(addresses) if err != nil { - return fmt.Errorf("error while storing MsgCommunityPoolSpend proposal recipient: %s", err) + return fmt.Errorf("error while storing proposal recipient: %s", err) } // Store the proposal