Skip to content

Commit

Permalink
Fix error handling in golang snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
ok300 committed Apr 29, 2024
1 parent 2e5bf79 commit e084005
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions snippets/go/communicating_fees.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func getFeeInfoBeforeInvoiceCreated() {
// ANCHOR: get-fee-info-before-receiving-payment
if nodeInfo, err := sdk.NodeInfo(); err != nil {
if nodeInfo, err := sdk.NodeInfo(); err == nil {
var inboundLiquiditySat = nodeInfo.InboundLiquidityMsats / 1_000

if openingFeeResponse, err := sdk.OpenChannelFee(breez_sdk.OpenChannelFeeRequest{}); err == nil {
Expand Down Expand Up @@ -48,7 +48,7 @@ func getFeeInfoReceiveOnchain() {
var minDepositSat = swapInfo.MinAllowedDeposit
var maxDepositSat = swapInfo.MaxAllowedDeposit

if nodeInfo, err := sdk.NodeInfo(); err != nil {
if nodeInfo, err := sdk.NodeInfo(); err == nil {
var inboundLiquiditySat = nodeInfo.InboundLiquidityMsats / 1_000

var swapOpeningFees = swapInfo.ChannelOpeningFees
Expand Down
2 changes: 1 addition & 1 deletion snippets/go/getting_started.go
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ func GettingStartedRestoreOnly(config breez_sdk.Config, seed []uint8) *breez_sdk

func FetchBalance() {
// ANCHOR: fetch-balance
if nodeInfo, err := sdk.NodeInfo(); err != nil {
if nodeInfo, err := sdk.NodeInfo(); err == nil {
lnBalance := nodeInfo.ChannelsBalanceMsat
onchainBalance := nodeInfo.OnchainBalanceMsat

Expand Down

0 comments on commit e084005

Please sign in to comment.