Skip to content

Commit

Permalink
fix estimatefees: esplora loop.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Jul 17, 2024
1 parent 726f07e commit 656fd68
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ apt install lightningd
mkdir -p ~/.lightning/plugins
echo 'disable-plugin=bcli' >> .lightning/config
cd ~/.lightning/plugins
wget https://github.com/nbd-wtf/trustedcoin/releases/download/v0.8.1/trustedcoin-v0.8.1-linux-amd64.tar.gz
tar -xvf trustedcoin-v0.8.1-linux-amd64.tar.gz
wget https://github.com/nbd-wtf/trustedcoin/releases/download/v0.8.2/trustedcoin-v0.8.2-linux-amd64.tar.gz
tar -xvf trustedcoin-v0.8.2-linux-amd64.tar.gz
cd
lightningd
```
13 changes: 7 additions & 6 deletions estimatefees.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,15 @@ func getFeeRatesFromEsplora() (feerates map[string]float64, err error) {
defer w.Body.Close()

if w.StatusCode >= 300 {
err = errors.New(endpoint + " error: " + w.Status)
return
continue
}

err = json.NewDecoder(w.Body).Decode(&feerates)
return
if err := json.NewDecoder(w.Body).Decode(&feerates); err != nil {
continue
} else {
return feerates, nil
}
}

err = errors.New("none of the esploras returned usable responses")
return
return nil, errors.New("none of the esploras returned usable responses")
}
2 changes: 1 addition & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
"github.com/fiatjaf/lightningd-gjson-rpc/plugin"
)

const version = "0.8.1"
const version = "0.8.2"

var (
network string
Expand Down

0 comments on commit 656fd68

Please sign in to comment.