Fix documentation code examples.
The examples uses a btcutil API that was recently updated from passing btcwire.BitcoinNet to *btcnet.Params. This change updates the btcutil call in the examples, as well as modifying the example in the README to match that in doc.go (where errors were handled slightly differently).
This commit is contained in:
parent
18794e4cfc
commit
81c37e551f
2 changed files with 4 additions and 4 deletions
|
@ -20,6 +20,7 @@ package main
|
|||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/conformal/btcnet"
|
||||
"github.com/conformal/btcutil"
|
||||
|
@ -42,10 +43,9 @@ func main() {
|
|||
|
||||
// Create and print new payment address, specific to the active network.
|
||||
pubKeyHash := make([]byte, 20)
|
||||
addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, netParams.Net)
|
||||
addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, netParams)
|
||||
if err != nil {
|
||||
// badness
|
||||
return
|
||||
log.Fatal(err)
|
||||
}
|
||||
fmt.Println(addr)
|
||||
}
|
||||
|
|
2
doc.go
2
doc.go
|
@ -48,7 +48,7 @@
|
|||
//
|
||||
// // Create and print new payment address, specific to the active network.
|
||||
// pubKeyHash := make([]byte, 20)
|
||||
// addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, netParams.Net)
|
||||
// addr, err := btcutil.NewAddressPubKeyHash(pubKeyHash, netParams)
|
||||
// if err != nil {
|
||||
// log.Fatal(err)
|
||||
// }
|
||||
|
|
Loading…
Reference in a new issue