From c7244e7fb7fcafbcb21cc3f8d915f732eb5cd79a Mon Sep 17 00:00:00 2001 From: Victor Neznaykin Date: Sun, 17 Sep 2023 17:51:24 +0400 Subject: [PATCH] get and publish proposal when got deposit message --- modules/gov/message.go | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/modules/gov/message.go b/modules/gov/message.go index d55afa4..6fdeb2b 100644 --- a/modules/gov/message.go +++ b/modules/gov/message.go @@ -113,6 +113,10 @@ func (m *Module) handleMsgSubmitProposal(ctx context.Context, tx *types.Tx, inde // handleMsgDeposit handles a MsgDeposit message. // Publishes proposalDeposit and proposalDepositMessage data to the broker. func (m *Module) handleMsgDeposit(ctx context.Context, tx *types.Tx, index int, msg *govtypesv1beta1.MsgDeposit) error { + if err := m.getAndPublishProposal(ctx, msg.ProposalId, ""); err != nil { + return err + } + if err := m.broker.PublishProposalDepositMessage(ctx, model.ProposalDepositMessage{ ProposalDeposit: model.ProposalDeposit{ ProposalID: msg.ProposalId, @@ -148,7 +152,6 @@ func (m *Module) handleMsgDeposit(ctx context.Context, tx *types.Tx, index int, return fmt.Errorf("error while getting proposal deposit: %w", err) } - // TODO: test it if err = m.broker.PublishProposalDeposit(ctx, model.ProposalDeposit{ ProposalID: msg.ProposalId, DepositorAddress: msg.Depositor,