Skip to content

Commit

Permalink
Do not check if account output was spent. There is a race condition b…
Browse files Browse the repository at this point in the history
…etween updating UTXO and Accounts ledgers upon commitment.
  • Loading branch information
piotrm50 committed Jun 7, 2024
1 parent 97bab37 commit 3002562
Showing 1 changed file with 0 additions and 8 deletions.
8 changes: 0 additions & 8 deletions pkg/protocol/engine/ledger/ledger/ledger.go
Original file line number Diff line number Diff line change
Expand Up @@ -722,14 +722,6 @@ func (l *Ledger) resolveAccountOutput(accountID iotago.AccountID, slot iotago.Sl
l.utxoLedger.ReadLockLedger()
defer l.utxoLedger.ReadUnlockLedger()

isUnspent, err := l.utxoLedger.IsOutputIDUnspentWithoutLocking(accountMetadata.OutputID())
if err != nil {
return nil, ierrors.Wrapf(err, "error while checking whether account with output id %s is unspent", accountMetadata.OutputID().ToHex())
}
if !isUnspent {
return nil, ierrors.WithMessagef(mempool.ErrStateNotFound, "unspent account with output id %s not found", accountMetadata.OutputID().ToHex())
}

accountOutput, err := l.utxoLedger.ReadOutputByOutputIDWithoutLocking(accountMetadata.OutputID())
if err != nil {
return nil, ierrors.Wrapf(err, "error while retrieving account with output id %s", accountMetadata.OutputID().ToHex())
Expand Down

0 comments on commit 3002562

Please sign in to comment.