diff --git a/address_test.go b/address_test.go index 27cf057..4f7b732 100644 --- a/address_test.go +++ b/address_test.go @@ -7,6 +7,7 @@ package btcutil_test import ( "bytes" "code.google.com/p/go.crypto/ripemd160" + "encoding/hex" "github.com/conformal/btcutil" "github.com/conformal/btcwire" "reflect" @@ -220,61 +221,338 @@ func TestAddresses(t *testing.T) { return btcutil.NewAddressScriptHashFromHash(hash, btcwire.TestNet) }, }, + + // Positive P2PK tests. + { + name: "mainnet p2pk compressed (0x02)", + addr: "13CG6SJ3yHUXo4Cr2RY4THLLJrNFuG3gUg", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4}, + btcutil.PKFCompressed, btcwire.MainNet), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.MainNet) + }, + net: btcwire.MainNet, + }, + { + name: "mainnet p2pk compressed (0x03)", + addr: "15sHANNUBSh6nDp8XkDPmQcW6n3EFwmvE6", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65}, + btcutil.PKFCompressed, btcwire.MainNet), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.MainNet) + }, + net: btcwire.MainNet, + }, + { + name: "mainnet p2pk uncompressed (0x04)", + addr: "12cbQLTFMXRnSzktFkuoG3eHoMeFtpTu3S", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, + 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, + 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, + 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, + 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, + 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, + 0xf6, 0x56, 0xb4, 0x12, 0xa3}, + btcutil.PKFUncompressed, btcwire.MainNet), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, + 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, + 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, + 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, + 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, + 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, + 0xf6, 0x56, 0xb4, 0x12, 0xa3} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.MainNet) + }, + net: btcwire.MainNet, + }, + { + name: "mainnet p2pk hybrid (0x06)", + addr: "1Ja5rs7XBZnK88EuLVcFqYGMEbBitzchmX", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x06, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4, 0x0d, 0x45, 0x26, 0x48, 0x38, 0xc0, 0xbd, + 0x96, 0x85, 0x26, 0x62, 0xce, 0x6a, 0x84, 0x7b, 0x19, 0x73, + 0x76, 0x83, 0x01, 0x60, 0xc6, 0xd2, 0xeb, 0x5e, 0x6a, 0x4c, + 0x44, 0xd3, 0x3f, 0x45, 0x3e}, + btcutil.PKFHybrid, btcwire.MainNet), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x06, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4, 0x0d, 0x45, 0x26, 0x48, 0x38, 0xc0, 0xbd, + 0x96, 0x85, 0x26, 0x62, 0xce, 0x6a, 0x84, 0x7b, 0x19, 0x73, + 0x76, 0x83, 0x01, 0x60, 0xc6, 0xd2, 0xeb, 0x5e, 0x6a, 0x4c, + 0x44, 0xd3, 0x3f, 0x45, 0x3e} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.MainNet) + }, + net: btcwire.MainNet, + }, + { + name: "mainnet p2pk hybrid (0x07)", + addr: "1ExqMmf6yMxcBMzHjbj41wbqYuqoX6uBLG", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x07, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65, 0x37, 0xa5, 0x76, 0x78, 0x2e, 0xba, 0x66, + 0x8a, 0x7e, 0xf8, 0xbd, 0x3b, 0x3c, 0xfb, 0x1e, 0xdb, 0x71, + 0x17, 0xab, 0x65, 0x12, 0x9b, 0x8a, 0x2e, 0x68, 0x1f, 0x3c, + 0x1e, 0x09, 0x08, 0xef, 0x7b}, + btcutil.PKFHybrid, btcwire.MainNet), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x07, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65, 0x37, 0xa5, 0x76, 0x78, 0x2e, 0xba, 0x66, + 0x8a, 0x7e, 0xf8, 0xbd, 0x3b, 0x3c, 0xfb, 0x1e, 0xdb, 0x71, + 0x17, 0xab, 0x65, 0x12, 0x9b, 0x8a, 0x2e, 0x68, 0x1f, 0x3c, + 0x1e, 0x09, 0x08, 0xef, 0x7b} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.MainNet) + }, + net: btcwire.MainNet, + }, + { + name: "testnet p2pk compressed (0x02)", + addr: "mhiDPVP2nJunaAgTjzWSHCYfAqxxrxzjmo", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4}, + btcutil.PKFCompressed, btcwire.TestNet3), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x02, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.TestNet3) + }, + net: btcwire.TestNet3, + }, + { + name: "testnet p2pk compressed (0x03)", + addr: "mkPETRTSzU8MZLHkFKBmbKppxmdw9qT42t", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65}, + btcutil.PKFCompressed, btcwire.TestNet3), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x03, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.TestNet3) + }, + net: btcwire.TestNet3, + }, + { + name: "testnet p2pk uncompressed (0x04)", + addr: "mh8YhPYEAYs3E7EVyKtB5xrcfMExkkdEMF", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, + 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, + 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, + 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, + 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, + 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, + 0xf6, 0x56, 0xb4, 0x12, 0xa3}, + btcutil.PKFUncompressed, btcwire.TestNet3), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x04, 0x11, 0xdb, 0x93, 0xe1, 0xdc, 0xdb, 0x8a, 0x01, 0x6b, + 0x49, 0x84, 0x0f, 0x8c, 0x53, 0xbc, 0x1e, 0xb6, 0x8a, 0x38, + 0x2e, 0x97, 0xb1, 0x48, 0x2e, 0xca, 0xd7, 0xb1, 0x48, 0xa6, + 0x90, 0x9a, 0x5c, 0xb2, 0xe0, 0xea, 0xdd, 0xfb, 0x84, 0xcc, + 0xf9, 0x74, 0x44, 0x64, 0xf8, 0x2e, 0x16, 0x0b, 0xfa, 0x9b, + 0x8b, 0x64, 0xf9, 0xd4, 0xc0, 0x3f, 0x99, 0x9b, 0x86, 0x43, + 0xf6, 0x56, 0xb4, 0x12, 0xa3} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.TestNet3) + }, + net: btcwire.TestNet3, + }, + { + name: "testnet p2pk hybrid (0x06)", + addr: "my639vCVzbDZuEiX44adfTUg6anRomZLEP", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x06, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4, 0x0d, 0x45, 0x26, 0x48, 0x38, 0xc0, 0xbd, + 0x96, 0x85, 0x26, 0x62, 0xce, 0x6a, 0x84, 0x7b, 0x19, 0x73, + 0x76, 0x83, 0x01, 0x60, 0xc6, 0xd2, 0xeb, 0x5e, 0x6a, 0x4c, + 0x44, 0xd3, 0x3f, 0x45, 0x3e}, + btcutil.PKFHybrid, btcwire.TestNet3), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x06, 0x19, 0x2d, 0x74, 0xd0, 0xcb, 0x94, 0x34, 0x4c, 0x95, + 0x69, 0xc2, 0xe7, 0x79, 0x01, 0x57, 0x3d, 0x8d, 0x79, 0x03, + 0xc3, 0xeb, 0xec, 0x3a, 0x95, 0x77, 0x24, 0x89, 0x5d, 0xca, + 0x52, 0xc6, 0xb4, 0x0d, 0x45, 0x26, 0x48, 0x38, 0xc0, 0xbd, + 0x96, 0x85, 0x26, 0x62, 0xce, 0x6a, 0x84, 0x7b, 0x19, 0x73, + 0x76, 0x83, 0x01, 0x60, 0xc6, 0xd2, 0xeb, 0x5e, 0x6a, 0x4c, + 0x44, 0xd3, 0x3f, 0x45, 0x3e} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.TestNet3) + }, + net: btcwire.TestNet3, + }, + { + name: "testnet p2pk hybrid (0x07)", + addr: "muUnepk5nPPrxUTuTAhRqrpAQuSWS5fVii", + valid: true, + canDecode: false, + result: btcutil.TstAddressPubKey( + []byte{ + 0x07, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65, 0x37, 0xa5, 0x76, 0x78, 0x2e, 0xba, 0x66, + 0x8a, 0x7e, 0xf8, 0xbd, 0x3b, 0x3c, 0xfb, 0x1e, 0xdb, 0x71, + 0x17, 0xab, 0x65, 0x12, 0x9b, 0x8a, 0x2e, 0x68, 0x1f, 0x3c, + 0x1e, 0x09, 0x08, 0xef, 0x7b}, + btcutil.PKFHybrid, btcwire.TestNet3), + f: func() (btcutil.Address, error) { + serializedPubKey := []byte{ + 0x07, 0xb0, 0xbd, 0x63, 0x42, 0x34, 0xab, 0xbb, 0x1b, 0xa1, + 0xe9, 0x86, 0xe8, 0x84, 0x18, 0x5c, 0x61, 0xcf, 0x43, 0xe0, + 0x01, 0xf9, 0x13, 0x7f, 0x23, 0xc2, 0xc4, 0x09, 0x27, 0x3e, + 0xb1, 0x6e, 0x65, 0x37, 0xa5, 0x76, 0x78, 0x2e, 0xba, 0x66, + 0x8a, 0x7e, 0xf8, 0xbd, 0x3b, 0x3c, 0xfb, 0x1e, 0xdb, 0x71, + 0x17, 0xab, 0x65, 0x12, 0x9b, 0x8a, 0x2e, 0x68, 0x1f, 0x3c, + 0x1e, 0x09, 0x08, 0xef, 0x7b} + return btcutil.NewAddressPubKey(serializedPubKey, btcwire.TestNet3) + }, + net: btcwire.TestNet3, + }, } for _, test := range tests { + var decoded btcutil.Address + var err error if test.canDecode { // Decode addr and compare error against valid. - decoded, err := btcutil.DecodeAddr(test.addr) + decoded, err = btcutil.DecodeAddr(test.addr) if (err == nil) != test.valid { t.Errorf("%v: decoding test failed", test.name) return } + } else { + // The address can't be decoded directly, so instead + // call the creation function. + decoded, err = test.f() + if (err == nil) != test.valid { + t.Errorf("%v: creation test failed", test.name) + return + } + } - // If decoding succeeded, encode again and compare against the original. - if err == nil { - encoded := decoded.EncodeAddress() + // If decoding succeeded, encode again and compare against the original. + if err == nil { + encoded := decoded.EncodeAddress() - // Compare encoded addr against the original encoding. - if test.addr != encoded { - t.Errorf("%v: decoding and encoding produced different addressess: %v != %v", - test.name, test.addr, encoded) - return - } + // Compare encoded addr against the original encoding. + if test.addr != encoded { + t.Errorf("%v: decoding and encoding produced different addressess: %v != %v", + test.name, test.addr, encoded) + return + } - // Perform type-specific calculations. - var saddr []byte - var net btcwire.BitcoinNet - switch d := decoded.(type) { - case *btcutil.AddressPubKeyHash: - saddr = btcutil.TstAddressSAddr(encoded) + // Perform type-specific calculations. + var saddr []byte + var net btcwire.BitcoinNet + switch d := decoded.(type) { + case *btcutil.AddressPubKeyHash: + saddr = btcutil.TstAddressSAddr(encoded) - // Net is not part of the Address interface and - // must be calculated here. - net = d.Net() + // Net is not part of the Address interface and + // must be calculated here. + net = d.Net() - case *btcutil.AddressScriptHash: - saddr = btcutil.TstAddressSAddr(encoded) + case *btcutil.AddressScriptHash: + saddr = btcutil.TstAddressSAddr(encoded) - // Net is not part of the Address interface and - // must be calculated here. - net = d.Net() - } + // Net is not part of the Address interface and + // must be calculated here. + net = d.Net() - // Check script address. - if !bytes.Equal(saddr, decoded.ScriptAddress()) { - t.Errorf("%v: script addresses do not match:\n%v != \n%v", - test.name, saddr, decoded.ScriptAddress()) - return - } + case *btcutil.AddressPubKey: + // Ignore the error here since the script + // address is checked below. + saddr, _ = hex.DecodeString(d.String()) - // Check networks. This check always succeeds for non-P2PKH and - // non-P2SH addresses as both nets will be Go's default zero value. - if net != test.net { - t.Errorf("%v: calculated network does not match expected", - test.name) - return - } + // Net is not part of the Address interface and + // must be calculated here. + net = d.Net() + } + + // Check script address. + if !bytes.Equal(saddr, decoded.ScriptAddress()) { + t.Errorf("%v: script addresses do not match:\n%x != \n%x", + test.name, saddr, decoded.ScriptAddress()) + return + } + + // Check networks. This check always succeeds for non-P2PKH and + // non-P2SH addresses as both nets will be Go's default zero value. + if net != test.net { + t.Errorf("%v: calculated network does not match expected", + test.name) + return } } diff --git a/internal_test.go b/internal_test.go index 32e74cb..5c7bacc 100644 --- a/internal_test.go +++ b/internal_test.go @@ -13,6 +13,7 @@ package btcutil import ( "code.google.com/p/go.crypto/ripemd160" + "github.com/conformal/btcec" "github.com/conformal/btcwire" ) @@ -51,6 +52,19 @@ func TstAddressScriptHash(hash [ripemd160.Size]byte, } } +// TstAddressPubKey makes an AddressPubKey, setting the unexported fields with +// the parameters. +func TstAddressPubKey(serializedPubKey []byte, pubKeyFormat PubKeyFormat, + net btcwire.BitcoinNet) *AddressPubKey { + + pubKey, _ := btcec.ParsePubKey(serializedPubKey, btcec.S256()) + return &AddressPubKey{ + pubKeyFormat: pubKeyFormat, + pubKey: (*btcec.PublicKey)(pubKey), + net: net, + } +} + // TstAddressSAddr returns the expected script address bytes for // P2PKH and P2SH bitcoin addresses. func TstAddressSAddr(addr string) []byte { diff --git a/test_coverage.txt b/test_coverage.txt index 764b06e..f1b56d7 100644 --- a/test_coverage.txt +++ b/test_coverage.txt @@ -1,45 +1,58 @@ github.com/conformal/btcutil/base58.go Base58Decode 100.00% (20/20) +github.com/conformal/btcutil/address.go DecodeAddr 100.00% (18/18) github.com/conformal/btcutil/base58.go Base58Encode 100.00% (15/15) github.com/conformal/btcutil/addrconvs.go DecodeAddress 100.00% (14/14) github.com/conformal/btcutil/block.go Block.Tx 100.00% (12/12) github.com/conformal/btcutil/block.go Block.Transactions 100.00% (11/11) -github.com/conformal/btcutil/address.go AddressScriptHash.EncodeAddress 100.00% (11/11) -github.com/conformal/btcutil/address.go AddressPubKeyHash.EncodeAddress 100.00% (11/11) github.com/conformal/btcutil/block.go Block.TxShas 100.00% (10/10) +github.com/conformal/btcutil/address.go encodeAddress 100.00% (9/9) github.com/conformal/btcutil/addrconvs.go EncodeAddress 100.00% (8/8) github.com/conformal/btcutil/addrconvs.go EncodeScriptHash 100.00% (8/8) -github.com/conformal/btcutil/address.go NewAddressPubKeyHash 100.00% (7/7) -github.com/conformal/btcutil/block.go NewBlockFromBytes 100.00% (7/7) -github.com/conformal/btcutil/tx.go NewTxFromBytes 100.00% (7/7) github.com/conformal/btcutil/address.go NewAddressScriptHashFromHash 100.00% (7/7) github.com/conformal/btcutil/addrconvs.go encodeHashWithNetId 100.00% (7/7) -github.com/conformal/btcutil/tx.go Tx.Sha 100.00% (5/5) +github.com/conformal/btcutil/address.go NewAddressPubKeyHash 100.00% (7/7) +github.com/conformal/btcutil/tx.go NewTxFromBytes 100.00% (7/7) +github.com/conformal/btcutil/block.go NewBlockFromBytes 100.00% (7/7) +github.com/conformal/btcutil/address.go AddressPubKeyHash.EncodeAddress 100.00% (5/5) github.com/conformal/btcutil/block.go Block.Sha 100.00% (5/5) +github.com/conformal/btcutil/address.go AddressScriptHash.EncodeAddress 100.00% (5/5) +github.com/conformal/btcutil/tx.go Tx.Sha 100.00% (5/5) +github.com/conformal/btcutil/address.go AddressPubKey.EncodeAddress 100.00% (5/5) github.com/conformal/btcutil/block.go Block.TxSha 100.00% (4/4) -github.com/conformal/btcutil/address.go NewAddressScriptHash 100.00% (2/2) +github.com/conformal/btcutil/address.go checkBitcoinNet 100.00% (3/3) github.com/conformal/btcutil/hash160.go calcHash 100.00% (2/2) -github.com/conformal/btcutil/address.go AddressPubKeyHash.Net 100.00% (1/1) +github.com/conformal/btcutil/address.go NewAddressScriptHash 100.00% (2/2) +github.com/conformal/btcutil/hash160.go Hash160 100.00% (1/1) github.com/conformal/btcutil/address.go AddressPubKeyHash.ScriptAddress 100.00% (1/1) +github.com/conformal/btcutil/address.go AddressPubKeyHash.Net 100.00% (1/1) github.com/conformal/btcutil/address.go AddressScriptHash.ScriptAddress 100.00% (1/1) github.com/conformal/btcutil/address.go AddressScriptHash.Net 100.00% (1/1) github.com/conformal/btcutil/block.go OutOfRangeError.Error 100.00% (1/1) +github.com/conformal/btcutil/address.go AddressPubKey.ScriptAddress 100.00% (1/1) +github.com/conformal/btcutil/address.go AddressPubKey.Net 100.00% (1/1) +github.com/conformal/btcutil/address.go AddressPubKey.String 100.00% (1/1) github.com/conformal/btcutil/block.go Block.MsgBlock 100.00% (1/1) +github.com/conformal/btcutil/block.go Block.Height 100.00% (1/1) +github.com/conformal/btcutil/block.go Block.SetHeight 100.00% (1/1) github.com/conformal/btcutil/block.go NewBlock 100.00% (1/1) github.com/conformal/btcutil/block.go NewBlockFromBlockAndBytes 100.00% (1/1) -github.com/conformal/btcutil/hash160.go Hash160 100.00% (1/1) +github.com/conformal/btcutil/tx.go Tx.MsgTx 100.00% (1/1) github.com/conformal/btcutil/tx.go Tx.Index 100.00% (1/1) github.com/conformal/btcutil/tx.go Tx.SetIndex 100.00% (1/1) github.com/conformal/btcutil/tx.go NewTx 100.00% (1/1) -github.com/conformal/btcutil/tx.go Tx.MsgTx 100.00% (1/1) -github.com/conformal/btcutil/block.go Block.Height 100.00% (1/1) -github.com/conformal/btcutil/block.go Block.SetHeight 100.00% (1/1) github.com/conformal/btcutil/appdata.go appDataDir 92.00% (23/25) +github.com/conformal/btcutil/address.go NewAddressPubKey 91.67% (11/12) github.com/conformal/btcutil/addrconvs.go EncodePrivateKey 90.91% (20/22) -github.com/conformal/btcutil/address.go DecodeAddr 90.00% (18/20) -github.com/conformal/btcutil/block.go Block.Bytes 88.89% (8/9) github.com/conformal/btcutil/block.go Block.TxLoc 88.89% (8/9) +github.com/conformal/btcutil/block.go Block.Bytes 88.89% (8/9) +github.com/conformal/btcutil/address.go AddressPubKey.serialize 85.71% (6/7) github.com/conformal/btcutil/addrconvs.go DecodePrivateKey 82.61% (19/23) +github.com/conformal/btcutil/address.go AddressPubKey.AddressPubKeyHash 0.00% (0/2) +github.com/conformal/btcutil/address.go AddressPubKey.Format 0.00% (0/1) +github.com/conformal/btcutil/address.go AddressPubKey.SetFormat 0.00% (0/1) +github.com/conformal/btcutil/address.go AddressScriptHash.String 0.00% (0/1) +github.com/conformal/btcutil/address.go AddressPubKeyHash.String 0.00% (0/1) github.com/conformal/btcutil/appdata.go AppDataDir 0.00% (0/1) -github.com/conformal/btcutil ------------------------------- 95.62% (284/297) +github.com/conformal/btcutil ------------------------------- 94.21% (309/328)