forked from BoltzExchange/boltz-client
-
Notifications
You must be signed in to change notification settings - Fork 0
/
btcutil.patch
30 lines (28 loc) · 1.23 KB
/
btcutil.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
From ec3a794d547ad1260e50f2942f4bf80528c2e330 Mon Sep 17 00:00:00 2001
From: michael1011 <[email protected]>
Date: Sat, 14 Dec 2019 12:57:55 +0100
Subject: [PATCH] fix Litecoin bech32 address decoding
---
address.go | 6 +++---
address_test.go | 27 +++++++++++++++++++++++++--
2 files changed, 28 insertions(+), 5 deletions(-)
diff --git a/address.go b/address.go
index 8966de43..4bf4bbd1 100644
--- a/address.go
+++ b/address.go
@@ -137,12 +137,12 @@ func DecodeAddress(addr string, defaultNet *chaincfg.Params) (Address, error) {
// Bech32 encoded segwit addresses start with a human-readable part
// (hrp) followed by '1'. For Bitcoin mainnet the hrp is "bc", and for
// testnet it is "tb". If the address string has a prefix that matches
- // one of the prefixes for the known networks, we try to decode it as
- // a segwit address.
+ // the one defined in the defaultNet parameter, we try to decode it
+ // as a segwit address.
oneIndex := strings.LastIndexByte(addr, '1')
if oneIndex > 1 {
prefix := addr[:oneIndex+1]
- if chaincfg.IsBech32SegwitPrefix(prefix) {
+ if strings.ToLower(prefix) == defaultNet.Bech32HRPSegwit+"1" {
witnessVer, witnessProg, err := decodeSegWitAddress(addr)
if err != nil {
return nil, err