Skip to content

Commit

Permalink
Refactor: reverted unnecessary changes
Browse files Browse the repository at this point in the history
  • Loading branch information
hmoog committed Apr 16, 2024
1 parent 2e553ff commit 9db69b6
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 17 deletions.
8 changes: 1 addition & 7 deletions pkg/protocol/attestations.go
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package protocol

import (
"fmt"

"github.com/libp2p/go-libp2p/core/peer"

"github.com/iotaledger/hive.go/core/eventticker"
Expand Down Expand Up @@ -131,11 +129,7 @@ func (a *Attestations) setupCommitmentVerifier(chain *Chain) (shutdown func()) {
}

a.commitmentVerifiers.GetOrCreate(forkingPoint.ID(), func() (commitmentVerifier *CommitmentVerifier) {
engine := forkingPoint.Chain.Get().LatestEngine()
if engine == nil {
fmt.Println("engine not available ", a.ParentLogger().LogName(), a.LogName())
}
commitmentVerifier, err := newCommitmentVerifier(engine, parentOfForkingPoint.Commitment)
commitmentVerifier, err := newCommitmentVerifier(forkingPoint.Chain.Get().LatestEngine(), parentOfForkingPoint.Commitment)
if err != nil {
a.LogError("failed to create commitment verifier", "chain", chain.LogName(), "error", err)
}
Expand Down
9 changes: 4 additions & 5 deletions pkg/protocol/commitment.go
Original file line number Diff line number Diff line change
Expand Up @@ -324,11 +324,10 @@ func (c *Commitment) deriveChain(parent *Commitment) func() {
// then we inherit the parent chain and evict the current one.
// We will spawn a new one if we ever change back to not being the main child.
// Here we basically move commitments to the parent chain.

//if currentChain != nil && currentChain != parentChain {
// // TODO: refactor it to use a dedicated WorkerPool
// go currentChain.IsEvicted.Trigger()
//}
if currentChain != nil && currentChain != parentChain {
// TODO: refactor it to use a dedicated WorkerPool
go currentChain.IsEvicted.Trigger()
}

return parentChain
}, c.IsRoot, parent.MainChild, parent.Chain, c.Chain.Get()))
Expand Down
5 changes: 0 additions & 5 deletions pkg/protocol/engine/accounts/accountsledger/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,11 +127,6 @@ func (m *Manager) AccountsTreeRoot() iotago.Identifier {
m.mutex.RLock()
defer m.mutex.RUnlock()

_ = m.accountsTree.Stream(func(accountID iotago.AccountID, accountData *accounts.AccountData) error {
m.LogDebug(">> committing account account", "accountID", accountID, "BIC.VALUE", accountData.Credits.Value, "BIC.UpdateSlot", accountData.Credits.UpdateSlot)
return nil
})

return m.accountsTree.Root()
}

Expand Down

0 comments on commit 9db69b6

Please sign in to comment.