Skip to content

Commit

Permalink
Update example_test.go
Browse files Browse the repository at this point in the history
  • Loading branch information
ehsan6sha committed Dec 20, 2023
1 parent bdde9e8 commit fac2a79
Showing 1 changed file with 19 additions and 4 deletions.
23 changes: 19 additions & 4 deletions mobile/example_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/functionland/go-fula/blox"
"github.com/functionland/go-fula/exchange"
fulamobile "github.com/functionland/go-fula/mobile"
"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p"
"github.com/libp2p/go-libp2p/core/crypto"
Expand Down Expand Up @@ -375,16 +376,30 @@ func Example_poolExchangeDagBetweenClientBlox() {
fmt.Printf("Error storing the raw data: %v", err)
return
}
fmt.Printf("Stored raw data link: %x", linkBytes)
log.Infof("Stored raw data link: %x", linkBytes)
c, err := cid.Cast(linkBytes)
if err != nil {
fmt.Printf("Error casting bytes to CID: %v", err)
return
}
fmt.Printf("Stored raw data link: %s", c.String())
log.Infof("Stored raw data link: %s", c.String())

recentCids, err := c1.ListRecentCidsAsString()
if err != nil {
log.Error("Error happened in ListRecentCidsAsString")
panic(err)
}
fmt.Printf("recentCids are %v", recentCids)
log.Infof("recentCids are %v", recentCids)
for recentCids.HasNext() {
cid, err := recentCids.Next()
if err != nil {
fmt.Printf("Error retrieving next CID: %v", err)
log.Errorf("Error retrieving next CID: %v", err)
// Decide if you want to break or continue based on your error handling strategy
break
}
fmt.Printf("recentCid link: %s", cid) // Print each CID
log.Infof("recentCid link: %s", cid)
}
time.Sleep(5 * time.Second)
fmt.Printf("Now fetching the link %x", linkBytes)
log.Infof("Now fetching the link %x", linkBytes)
Expand Down

0 comments on commit fac2a79

Please sign in to comment.