diff --git a/go.mod b/go.mod index b9d1b4d..dae8619 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module github.com/btcsuite/btcwallet require ( github.com/btcsuite/btcd v0.20.1-beta.0.20200513120220-b470eee47728 github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f - github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d - github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0 + github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce + github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 github.com/btcsuite/btcwallet/wallet/txrules v1.0.0 github.com/btcsuite/btcwallet/walletdb v1.3.4 @@ -17,8 +17,8 @@ require ( github.com/kkdai/bstream v0.0.0-20181106074824-b3251f7901ec // indirect github.com/lightninglabs/gozmq v0.0.0-20191113021534-d20a764486bf github.com/lightninglabs/neutrino v0.11.0 - golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 - golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 + golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d + golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 google.golang.org/genproto v0.0.0-20190201180003-4b09977fb922 // indirect google.golang.org/grpc v1.18.0 ) diff --git a/go.sum b/go.sum index 3625f4a..d342646 100644 --- a/go.sum +++ b/go.sum @@ -11,8 +11,10 @@ github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9 github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng= github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg= -github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0 h1:3Zumkyl6PWyHuVJ04me0xeD9CnPOhNgeGpapFbzy7O4= -github.com/btcsuite/btcutil/psbt v1.0.3-0.20200826194809-5f93e33af2b0/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce h1:YtWJF7RHm2pYCvA5t0RPmAaLUhREsKuKd+SLhxFbFeQ= +github.com/btcsuite/btcutil v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:0DVlHczLPewLcPGEIeUEzfOJhqGPQ0mJJRDBtD307+o= +github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce h1:3PRwz+js0AMMV1fHRrCdQ55akoomx4Q3ulozHC3BDDY= +github.com/btcsuite/btcutil/psbt v1.0.3-0.20201208143702-a53e38424cce/go.mod h1:LVveMu4VaNSkIRTZu2+ut0HDBRuYjqGocxDMNS1KuGQ= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd h1:R/opQEbFEy9JGkIguV40SvRY1uliPX8ifOvi6ICsFCw= github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg= github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY= @@ -85,6 +87,9 @@ golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44 h1:9lP3x0pW80sDI6t1UMSLA4 golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67 h1:ng3VDlRp5/DHpSWl02R4rM9I+8M2rhmsuLwAMmkLQWE= golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d h1:2+ZP7EfsZV7Vvmx3TIqSlSzATMkTAKqM14YGFPoSKjI= +golang.org/x/crypto v0.0.0-20200115085410-6d4e4cb37c7d/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/lint v0.0.0-20180702182130-06c8688daad7/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE= @@ -95,12 +100,16 @@ golang.org/x/net v0.0.0-20181106065722-10aee1819953 h1:LuZIitY8waaxUfNIdtajyE/Yz golang.org/x/net v0.0.0-20181106065722-10aee1819953/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20190206173232-65e2d4e15006 h1:bfLnR+k0tq5Lqt6dflRLcZiz6UaXCMt3vhYJ1l4FQ80= golang.org/x/net v0.0.0-20190206173232-65e2d4e15006/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3 h1:0GoQqolDA55aaLxZyTzK/Y2ePZzZTUrRacwib7cNsYQ= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4 h1:YUO/7uOKsKeq9UokNS62b8FYywz3ker1l1vDZRCRefw= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd h1:DBH9mDw0zluJT/R+nGuV3jWFWLFaHyYZWD4tOT+cjn0= golang.org/x/sys v0.0.0-20190904154756-749cb33beabd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20200202164722-d101bd2416d5 h1:LfCXLvNmTYH9kEmVgqbnsWfruoXZIrh4YBgqVHtDvw0= diff --git a/waddrmgr/manager.go b/waddrmgr/manager.go index 45ee067..e003c0f 100644 --- a/waddrmgr/manager.go +++ b/waddrmgr/manager.go @@ -1372,13 +1372,17 @@ func deriveCoinTypeKey(masterNode *hdkeychain.ExtendedKey, // The branch is 0 for external addresses and 1 for internal addresses. // Derive the purpose key as a child of the master node. - purpose, err := masterNode.Child(scope.Purpose + hdkeychain.HardenedKeyStart) + purpose, err := masterNode.DeriveNonStandard( + scope.Purpose + hdkeychain.HardenedKeyStart, + ) if err != nil { return nil, err } // Derive the coin type key as a child of the purpose key. - coinTypeKey, err := purpose.Child(scope.Coin + hdkeychain.HardenedKeyStart) + coinTypeKey, err := purpose.DeriveNonStandard( + scope.Coin + hdkeychain.HardenedKeyStart, + ) if err != nil { return nil, err } @@ -1401,7 +1405,9 @@ func deriveAccountKey(coinTypeKey *hdkeychain.ExtendedKey, } // Derive the account key as a child of the coin type key. - return coinTypeKey.Child(account + hdkeychain.HardenedKeyStart) + return coinTypeKey.DeriveNonStandard( + account + hdkeychain.HardenedKeyStart, + ) } // checkBranchKeys ensures deriving the extended keys for the internal and @@ -1416,12 +1422,12 @@ func deriveAccountKey(coinTypeKey *hdkeychain.ExtendedKey, // The branch is 0 for external addresses and 1 for internal addresses. func checkBranchKeys(acctKey *hdkeychain.ExtendedKey) error { // Derive the external branch as the first child of the account key. - if _, err := acctKey.Child(ExternalBranch); err != nil { + if _, err := acctKey.DeriveNonStandard(ExternalBranch); err != nil { return err } - // Derive the external branch as the second child of the account key. - _, err := acctKey.Child(InternalBranch) + // Derive the internal branch as the second child of the account key. + _, err := acctKey.DeriveNonStandard(InternalBranch) return err } diff --git a/waddrmgr/scoped_manager.go b/waddrmgr/scoped_manager.go index 44f9b95..f449a4e 100644 --- a/waddrmgr/scoped_manager.go +++ b/waddrmgr/scoped_manager.go @@ -271,14 +271,14 @@ func (s *ScopedKeyManager) deriveKey(acctInfo *accountInfo, branch, } // Derive and return the key. - branchKey, err := acctKey.Child(branch) + branchKey, err := acctKey.DeriveNonStandard(branch) if err != nil { str := fmt.Sprintf("failed to derive extended key branch %d", branch) return nil, managerError(ErrKeyChain, str, err) } - addressKey, err := branchKey.Child(index) + addressKey, err := branchKey.DeriveNonStandard(index) branchKey.Zero() // Zero branch key after it's used. if err != nil { str := fmt.Sprintf("failed to derive child extended key -- "+ @@ -715,7 +715,7 @@ func (s *ScopedKeyManager) nextAddresses(ns walletdb.ReadWriteBucket, } // Derive the appropriate branch key and ensure it is zeroed when done. - branchKey, err := acctKey.Child(branchNum) + branchKey, err := acctKey.DeriveNonStandard(branchNum) if err != nil { str := fmt.Sprintf("failed to derive extended key branch %d", branchNum) @@ -732,7 +732,7 @@ func (s *ScopedKeyManager) nextAddresses(ns walletdb.ReadWriteBucket, var nextKey *hdkeychain.ExtendedKey for { // Derive the next child in the external chain branch. - key, err := branchKey.Child(nextIndex) + key, err := branchKey.DeriveNonStandard(nextIndex) if err != nil { // When this particular child is invalid, skip to the // next index. @@ -915,7 +915,7 @@ func (s *ScopedKeyManager) extendAddresses(ns walletdb.ReadWriteBucket, } // Derive the appropriate branch key and ensure it is zeroed when done. - branchKey, err := acctKey.Child(branchNum) + branchKey, err := acctKey.DeriveNonStandard(branchNum) if err != nil { str := fmt.Sprintf("failed to derive extended key branch %d", branchNum) @@ -934,7 +934,7 @@ func (s *ScopedKeyManager) extendAddresses(ns walletdb.ReadWriteBucket, var nextKey *hdkeychain.ExtendedKey for { // Derive the next child in the external chain branch. - key, err := branchKey.Child(nextIndex) + key, err := branchKey.DeriveNonStandard(nextIndex) if err != nil { // When this particular child is invalid, skip to the // next index.