Skip to content

Commit

Permalink
Fixed examples
Browse files Browse the repository at this point in the history
  • Loading branch information
mrz1836 committed Nov 11, 2020
1 parent 40dc55b commit 4c7ce6b
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 5 deletions.
9 changes: 7 additions & 2 deletions .make/Makefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,17 @@ test-short: ## Runs vet, lint and tests (excludes integration tests)

test-travis: ## Runs all tests via Travis (also exports coverage)
@$(MAKE) lint
@echo "running tests..."
@echo "running tests (travis)..."
@go test ./... -race -coverprofile=coverage.txt -covermode=atomic

test-travis-no-race: ## Runs all tests (no race) (also exports coverage)
@$(MAKE) lint
@echo "running tests (no race)..."
@go test ./... -coverprofile=coverage.txt -covermode=atomic

test-travis-short: ## Runs unit tests via Travis (also exports coverage)
@$(MAKE) lint
@echo "running tests (short)..."
@echo "running tests (short & travis)..."
@go test ./... -test.short -race -coverprofile=coverage.txt -covermode=atomic

uninstall: ## Uninstall the application (and remove files)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import (
func main() {

// Start with a private key (we will make one for this example)
privateKey, err := bitcoin.CreatePrivateKeyString()
privateKey, err := bitcoin.CreatePrivateKey()
if err != nil {
log.Fatalf("error occurred: %s", err.Error())
}
Expand Down
2 changes: 1 addition & 1 deletion examples/script_from_address/script_from_address.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (

func main() {
// Start with a private key (we will make one for this example)
privateKey, err := bitcoin.CreatePrivateKeyString()
privateKey, err := bitcoin.CreatePrivateKey()
if err != nil {
log.Fatalf("error occurred: %s", err.Error())
}
Expand Down
8 changes: 7 additions & 1 deletion examples/verify_signature/verify_signature.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@ func main() {
signature := "H/sEz5QDQYkXCox9shPB4MMVAVUM/JzfbPHNpPRwNl+hMI2gxy3x7xs9Ed5ryuny5s2hY4Qxc5uirqjMyEEON6k="
message := "This is the example message"

rawKey, err := bitcoin.PrivateKeyFromString(privateKey)
if err != nil {
log.Fatalf("error occurred: %s", err.Error())
}

// Get an address from private key
address, err := bitcoin.GetAddressFromPrivateKey(privateKey, true)
var address string
address, err = bitcoin.GetAddressFromPrivateKey(rawKey, true)
if err != nil {
log.Fatalf("error occurred: %s", err.Error())
}
Expand Down

0 comments on commit 4c7ce6b

Please sign in to comment.