Skip to content

Commit

Permalink
go fmt; update context usage in consensus
Browse files Browse the repository at this point in the history
  • Loading branch information
Wondertan committed Jun 4, 2021
1 parent 9334d09 commit eec6a12
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
7 changes: 4 additions & 3 deletions consensus/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -1122,10 +1122,11 @@ func (cs *State) defaultDecideProposal(height int64, round int32) {
// TODO(evan): don't hard code context and timeout
//
// longer timeouts result in block proposers failing to propose blocks in time
// TODO(Wondertan): rework context for cancel to be callable
ctx, _ := context.WithTimeout(context.Background(), time.Minute*5)
cs.Logger.Info("Putting Block to ipfs", "height", block.Height)
err = ipld.PutBlock(ctx, cs.dag, block, cs.croute, cs.Logger, false)
// TODO(Wondertan): CONTEXT !!!
// We can't pass there cancelable context right now
// Ideally, we should create context once proposing and it keep it alive until it is next turn to propose
err = ipld.PutBlock(context.TODO(), cs.dag, block, cs.croute, cs.Logger, false)
if err != nil {
// If PutBlock fails we will be the only node that has the data
// this means something is seriously wrong and we can not recover
Expand Down
2 changes: 1 addition & 1 deletion p2p/ipld/write.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ type provider struct {

croute routing.ContentRouting
log log.Logger
took time.Time
took time.Time
}

func newProvider(ctx context.Context, croute routing.ContentRouting, logger log.Logger) *provider {
Expand Down

0 comments on commit eec6a12

Please sign in to comment.