Skip to content

Commit

Permalink
announce manually added blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
n8maninger committed Mar 20, 2024
1 parent b8bf38f commit ac0cb80
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ipfs/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,12 @@ func (n *Node) HasBlock(ctx context.Context, c cid.Cid) (bool, error) {

// AddBlock adds a generic block to the IPFS node
func (n *Node) AddBlock(ctx context.Context, block blocks.Block) error {
return n.blockService.AddBlock(ctx, block)
if err := n.blockService.AddBlock(ctx, block); err != nil {
return fmt.Errorf("failed to add block: %w", err)
} else if err := n.provider.Provide(block.Cid()); err != nil {
return fmt.Errorf("failed to provide block: %w", err)
}
return nil
}

// PeerID returns the peer ID of the node
Expand Down

0 comments on commit ac0cb80

Please sign in to comment.