Skip to content

Commit

Permalink
Potential bugfix for total-supply bug (#589)
Browse files Browse the repository at this point in the history
  • Loading branch information
r-gochain authored Nov 4, 2024
1 parent 433c435 commit a55d012
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions server/backend/backend.go
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ func NewBackend(ctx context.Context, mongoUrl, rpcUrl, dbName string, lockedAcco
return b, nil
}

//METHODS USED IN API
// METHODS USED IN API
func (b *Backend) PingDB() error {
return b.mongo.PingDB()
}
Expand Down Expand Up @@ -142,7 +142,7 @@ func (b *Backend) CodeAt(ctx context.Context, address string) ([]byte, error) {
// TotalSupply returns the total supply and the fees burned (already subtracted from total).
func (b *Backend) TotalSupply(ctx context.Context) (*big.Int, *big.Int, error) {
var alloc *big.Int
if l := b.alloc.Load(); l != nil {
if l := b.alloc.Load(); l != nil && l.(*big.Int).Cmp(big.NewInt(0)) > 0 {
alloc = l.(*big.Int)
}
if alloc == nil {
Expand Down Expand Up @@ -524,7 +524,7 @@ func (b *Backend) InternalTxsConsistent(blockNumber int64) (*models.Block, bool,
return b.mongo.internalTxsConsistent(blockNumber)
}

//return false if a number of transactions in DB is different from a number of transactions in the blockchain
// return false if a number of transactions in DB is different from a number of transactions in the blockchain
func (b *Backend) ExternalTxsConsistent(ctx context.Context, block *models.Block) (bool, error) {
lgr := b.Lgr.With(zap.String("hash", block.BlockHash))
lgr.Debug("Checking transaction count for the block")
Expand Down

0 comments on commit a55d012

Please sign in to comment.