Skip to content

Commit

Permalink
Fix expired transaction bug
Browse files Browse the repository at this point in the history
  • Loading branch information
firelizzard18 committed Jun 13, 2024
1 parent b12bebc commit 07a2ae3
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions internal/core/execute/v2/block/msg_transaction.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import (
"gitlab.com/accumulatenetwork/accumulate/pkg/types/messaging"
"gitlab.com/accumulatenetwork/accumulate/pkg/url"
"gitlab.com/accumulatenetwork/accumulate/protocol"
"golang.org/x/exp/slog"
)

func init() {
Expand Down Expand Up @@ -696,12 +697,17 @@ func (x ExpiredTransaction) expireTransaction(batch *database.Batch, ctx *Messag
func (x ExpiredTransaction) eraseSignatures(batch *database.Batch, ctx *MessageContext, msg *internal.ExpiredTransaction) error {
// Load the account
account, err := batch.Account(msg.TxID.Account()).Main().Get()
if err != nil {
_, isAuth := account.(protocol.Authority)
switch {
case errors.Is(err, errors.NotFound):
slog.Info("Skip erasing signatures for expired transaction: account does not exist", "id", msg.TxID)
return nil

case err != nil:
return errors.UnknownError.WithFormat("load account: %w", err)
}

// Is it an authority?
if _, ok := account.(protocol.Authority); !ok {
case !isAuth:
// Is it an authority?
return nil
}

Expand All @@ -720,6 +726,6 @@ func (x ExpiredTransaction) eraseSignatures(batch *database.Batch, ctx *MessageC
}

// Clear the signature set
err = clearActiveSignatures(batch, account.GetUrl(), txn.ID())
err = clearActiveSignatures(batch, msg.TxID.Account(), txn.ID())
return errors.UnknownError.Wrap(err)
}

0 comments on commit 07a2ae3

Please sign in to comment.