Skip to content

Commit

Permalink
nit
Browse files Browse the repository at this point in the history
  • Loading branch information
dhrubabasu committed Dec 11, 2023
1 parent 4040a74 commit 81662ca
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
16 changes: 8 additions & 8 deletions vms/platformvm/block/builder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ func New(
}

func (b *builder) StartBlockTimer() {
b.txExecutorBackend.Ctx.Log.Debug("[builder.StartBlockTimer]: Called")
b.txExecutorBackend.Ctx.Log.Error("[builder.StartBlockTimer]: Called")
go func() {
timer := time.NewTimer(0)
defer timer.Stop()
Expand Down Expand Up @@ -126,7 +126,7 @@ func (b *builder) StartBlockTimer() {
break
}

b.txExecutorBackend.Ctx.Log.Debug("[builder.StartBlockTimer]: Calling [mempool.RequestBuildBlock] with emptyBlockPermitted=true")
b.txExecutorBackend.Ctx.Log.Error("[builder.StartBlockTimer]: Calling [mempool.RequestBuildBlock] with emptyBlockPermitted=true")

// Block needs to be issued to advance time.
b.Mempool.RequestBuildBlock(true /*=emptyBlockPermitted*/)
Expand All @@ -147,7 +147,7 @@ func (b *builder) StartBlockTimer() {
}

func (b *builder) durationToSleep() (time.Duration, error) {
b.txExecutorBackend.Ctx.Log.Debug("[builder.durationToSleep]: Called")
b.txExecutorBackend.Ctx.Log.Error("[builder.durationToSleep]: Called")
// Grabbing the lock here enforces that this function is not called mid-way
// through modifying of the state.
b.txExecutorBackend.Ctx.Lock.Lock()
Expand Down Expand Up @@ -179,7 +179,7 @@ func (b *builder) durationToSleep() (time.Duration, error) {
}

func (b *builder) ResetBlockTimer() {
b.txExecutorBackend.Ctx.Log.Debug("[builder.ResetBlockTimer]: Called")
b.txExecutorBackend.Ctx.Log.Error("[builder.ResetBlockTimer]: Called")
// Ensure that the timer will be reset at least once.
select {
case b.resetTimer <- struct{}{}:
Expand All @@ -188,7 +188,7 @@ func (b *builder) ResetBlockTimer() {
}

func (b *builder) ShutdownBlockTimer() {
b.txExecutorBackend.Ctx.Log.Debug("[builder.ShutdownBlockTimer]: Called")
b.txExecutorBackend.Ctx.Log.Error("[builder.ShutdownBlockTimer]: Called")
b.closeOnce.Do(func() {
close(b.closed)
})
Expand Down Expand Up @@ -252,7 +252,7 @@ func buildBlock(
forceAdvanceTime bool,
parentState state.Chain,
) (block.Block, error) {
builder.txExecutorBackend.Ctx.Log.Debug("[builder.buildBlock]: Called")
builder.txExecutorBackend.Ctx.Log.Error("[builder.buildBlock]: Called")

// Try rewarding stakers whose staking period ends at the new chain time.
// This is done first to prioritize advancing the timestamp as quickly as
Expand Down Expand Up @@ -291,7 +291,7 @@ func buildBlock(
)

for {
builder.txExecutorBackend.Ctx.Log.Debug("[builder.buildBlock] mempool: peeking tx",
builder.txExecutorBackend.Ctx.Log.Error("[builder.buildBlock] mempool: peeking tx",
zap.Int("remainingSize", remainingSize),
zap.Error(err),
)
Expand All @@ -302,7 +302,7 @@ func buildBlock(
builder.Mempool.Remove([]*txs.Tx{tx})

txID := tx.ID()
builder.txExecutorBackend.Ctx.Log.Debug("[builder.buildBlock] mempool: removed tx",
builder.txExecutorBackend.Ctx.Log.Error("[builder.buildBlock] mempool: removed tx",
zap.Stringer("txID", txID),
zap.Error(err),
)
Expand Down
2 changes: 1 addition & 1 deletion vms/platformvm/block/executor/rejector.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func (r *rejector) rejectBlock(b block.Block, blockType string) error {
}

txID := tx.ID()
r.ctx.Log.Debug("[rejector.rejectBlock] mempool: adding tx",
r.ctx.Log.Error("[rejector.rejectBlock] mempool: adding tx",
zap.Stringer("txID", txID),
)
}
Expand Down
4 changes: 2 additions & 2 deletions vms/platformvm/network/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ func (n *network) AppGossip(ctx context.Context, nodeID ids.NodeID, msgBytes []b
defer n.ctx.Lock.Unlock()

if reason := n.mempool.GetDropReason(txID); reason != nil {
n.ctx.Log.Debug("[network.AppGossip] mempool: dropped tx",
n.ctx.Log.Error("[network.AppGossip] mempool: dropped tx",
zap.Stringer("txID", txID),
zap.Error(reason),
)
Expand Down Expand Up @@ -185,7 +185,7 @@ func (n *network) issueTx(tx *txs.Tx) error {
return err
}

n.ctx.Log.Debug("[network.issueTx] added tx to mempool",
n.ctx.Log.Error("[network.issueTx] added tx to mempool",
zap.Stringer("txID", txID),
)

Expand Down
14 changes: 7 additions & 7 deletions vms/platformvm/txs/mempool/mempool.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func New(
}

func (m *mempool) Add(tx *txs.Tx) error {
m.log.Debug("[mempool.Add] trying to add tx",
m.log.Error("[mempool.Add] trying to add tx",
zap.Stringer("txID", tx.ID()),
)

Expand Down Expand Up @@ -177,7 +177,7 @@ func (m *mempool) Add(tx *txs.Tx) error {
return fmt.Errorf("%w: %s", errConflictsWithOtherTx, txID)
}

m.log.Debug("[mempool.Add] added tx",
m.log.Error("[mempool.Add] added tx",
zap.Stringer("txID", tx.ID()),
)

Expand Down Expand Up @@ -207,13 +207,13 @@ func (m *mempool) Get(txID ids.ID) *txs.Tx {
func (m *mempool) Remove(txsToRemove []*txs.Tx) {
for _, tx := range txsToRemove {
txID := tx.ID()
m.log.Debug("[mempool.Remove] attempting to remove tx",
m.log.Error("[mempool.Remove] attempting to remove tx",
zap.Stringer("txID", txID),
)
if !m.unissuedTxs.Delete(txID) {
continue
}
m.log.Debug("[mempool.Remove] removed tx",
m.log.Error("[mempool.Remove] removed tx",
zap.Stringer("txID", tx.ID()),
)
m.numTxs.Dec()
Expand All @@ -228,14 +228,14 @@ func (m *mempool) Remove(txsToRemove []*txs.Tx) {

func (m *mempool) Peek() *txs.Tx {
_, tx, _ := m.unissuedTxs.Oldest()
m.log.Debug("[mempool.Peek] returning tx",
m.log.Error("[mempool.Peek] returning tx",
zap.Stringer("txID", tx.ID()),
)
return tx
}

func (m *mempool) MarkDropped(txID ids.ID, reason error) {
m.log.Debug("[mempool.MarkDropped] marking tx dropped",
m.log.Error("[mempool.MarkDropped] marking tx dropped",
zap.Stringer("txID", txID),
)
m.droppedTxIDs.Put(txID, reason)
Expand All @@ -247,7 +247,7 @@ func (m *mempool) GetDropReason(txID ids.ID) error {
}

func (m *mempool) RequestBuildBlock(emptyBlockPermitted bool) {
m.log.Debug("[mempool.RequestBuildBlock] called",
m.log.Error("[mempool.RequestBuildBlock] called",
zap.Bool("emptyBlockPermitted", emptyBlockPermitted),
zap.Int("mempoolSize", m.unissuedTxs.Len()),
)
Expand Down

0 comments on commit 81662ca

Please sign in to comment.