Skip to content

Commit

Permalink
update mempool.space URL.
Browse files Browse the repository at this point in the history
  • Loading branch information
fiatjaf committed Jul 5, 2020
1 parent df4487f commit 1e5c034
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
10 changes: 9 additions & 1 deletion cmd/trustedcoin/getblock.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,11 @@ package main
import (
"encoding/hex"
"encoding/json"
"errors"
"fmt"
"io/ioutil"
"net/http"
"strings"

"github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcutil"
Expand Down Expand Up @@ -88,7 +90,13 @@ func getHash(height int64) (hash string, err error) {
continue
}

hash = string(data)
hash = strings.TrimSpace(string(data))

if len(hash) > 64 {
err = errors.New("got something that isn't a block hash: " + hash[:64])
continue
}

heightCache[height] = hash

return hash, nil
Expand Down
4 changes: 2 additions & 2 deletions cmd/trustedcoin/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import (

var (
esplora = []string{
"https://mempool.space/electrs",
"https://mempool.space/api",
"https://blockstream.info/api",
}
)
Expand All @@ -28,7 +28,7 @@ func esploras() (ss []string) {
func main() {
p := plugin.Plugin{
Name: "trustedcoin",
Version: "v0.2.1",
Version: "v0.2.2",
RPCMethods: []plugin.RPCMethod{
{
"getrawblockbyheight",
Expand Down

0 comments on commit 1e5c034

Please sign in to comment.