diff --git a/address.go b/address.go index 243a393..8672497 100644 --- a/address.go +++ b/address.go @@ -23,7 +23,7 @@ import ( type UnsupportedWitnessVerError byte func (e UnsupportedWitnessVerError) Error() string { - return fmt.Sprintf("unsupported witness version: %#x", e) + return fmt.Sprintf("unsupported witness version: %#x", byte(e)) } // UnsupportedWitnessProgLenError describes an error where a segwit address @@ -31,7 +31,7 @@ func (e UnsupportedWitnessVerError) Error() string { type UnsupportedWitnessProgLenError int func (e UnsupportedWitnessProgLenError) Error() string { - return fmt.Sprintf("unsupported witness program length: %d", e) + return fmt.Sprintf("unsupported witness program length: %d", int(e)) } var ( diff --git a/address_test.go b/address_test.go index 61f0fa9..b6a990d 100644 --- a/address_test.go +++ b/address_test.go @@ -859,6 +859,14 @@ func TestAddresses(t *testing.T) { test.name) return } + } else { + // If there is an error, make sure we can print it + // correctly. + errStr := err.Error() + if errStr == "" { + t.Errorf("%v: error was non-nil but message is"+ + "empty: %v", test.name, err) + } } if !test.valid {