Skip to content

Commit

Permalink
types/btctypes: fixed BtcCompactAddress' DecodeAddress
Browse files Browse the repository at this point in the history
  • Loading branch information
susruth committed Oct 3, 2019
1 parent cbc0af8 commit cfa87c3
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
10 changes: 6 additions & 4 deletions types/btctypes/address_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,15 @@ package btctypes_test
import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
_ "github.com/renproject/mercury/types/btctypes"
. "github.com/renproject/mercury/types/btctypes"
)

var _ = Describe("btctypes", func() {
Context("when decoding testnet bitcoin cash addresses", func() {
It("should decode a valid bitcoin cash address", func() {
Expect(true).To(BeTrue())
Context("when decoding testnet zcash addresses", func() {
FIt("should decode a valid zcash address", func() {
address, err := DecodeAddress("tmXj1bXqHFU9toMhLnAwFad5JcehNNqGASy")
Expect(err).Should(BeNil())
Expect(address.String()).Should(Equal("tmXj1bXqHFU9toMhLnAwFad5JcehNNqGASy"))
})
})
})
2 changes: 1 addition & 1 deletion types/btctypes/btccompatAddress.go
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ func DecodeAddress(address string) (btcutil.Address, error) {

var net Network
var addrType AddressType
var hash []byte
hash := make([]byte, 20)
if len(decoded) == 26 {
addrType, net = ParsePrefix(decoded[:2])
copy(hash, decoded[2:22])
Expand Down

0 comments on commit cfa87c3

Please sign in to comment.