Merge pull request #699 from wpaulino/btcd-dep-update

build: update to latest btcd version
This commit is contained in:
Olaoluwa Osuntokun 2020-05-15 15:49:13 -07:00 committed by GitHub
commit e0e62245ec
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 23 additions and 19 deletions

2
go.mod
View file

@ -1,7 +1,7 @@
module github.com/btcsuite/btcwallet module github.com/btcsuite/btcwallet
require ( require (
github.com/btcsuite/btcd v0.20.1-beta github.com/btcsuite/btcd v0.20.1-beta.0.20200513120220-b470eee47728
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d
github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0 github.com/btcsuite/btcwallet/wallet/txauthor v1.0.0

2
go.sum
View file

@ -5,6 +5,8 @@ github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3 h1:A/EVblehb75cUgXA5
github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI= github.com/btcsuite/btcd v0.0.0-20190824003749-130ea5bddde3/go.mod h1:3J08xEfcugPacsc34/LKRU2yO7YmuT8yt28J8k2+rrI=
github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw= github.com/btcsuite/btcd v0.20.1-beta h1:Ik4hyJqN8Jfyv3S4AGBOmyouMsYE3EdYODkMbQjwPGw=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ= github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btcd v0.20.1-beta.0.20200513120220-b470eee47728 h1:kF1MN22IdIZ1I7VMgS5WuihFuYaWOoP69Btm4bLUBxY=
github.com/btcsuite/btcd v0.20.1-beta.0.20200513120220-b470eee47728/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo= github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f h1:bAs4lUbRJpnnkd9VhRV3jjAVU7DJVjMaK+IsvSeZvFo=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA= 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 h1:yJzD/yFppdVCf6ApMkVy8cUxV0XrxdP9rVf6D87/Mng=

View file

@ -20,7 +20,6 @@ import (
"github.com/btcsuite/btcd/btcjson" "github.com/btcsuite/btcd/btcjson"
"github.com/btcsuite/btcd/chaincfg" "github.com/btcsuite/btcd/chaincfg"
"github.com/btcsuite/btcd/chaincfg/chainhash" "github.com/btcsuite/btcd/chaincfg/chainhash"
"github.com/btcsuite/btcd/rpcclient"
"github.com/btcsuite/btcd/txscript" "github.com/btcsuite/btcd/txscript"
"github.com/btcsuite/btcd/wire" "github.com/btcsuite/btcd/wire"
"github.com/btcsuite/btcutil" "github.com/btcsuite/btcutil"
@ -2202,7 +2201,6 @@ func (w *Wallet) GetTransactions(startBlock, endBlock *BlockIdentifier, cancel <
// TODO: Fetching block heights by their hashes is inherently racy // TODO: Fetching block heights by their hashes is inherently racy
// because not all block headers are saved but when they are for SPV the // because not all block headers are saved but when they are for SPV the
// db can be queried directly without this. // db can be queried directly without this.
var startResp, endResp rpcclient.FutureGetBlockVerboseResult
if startBlock != nil { if startBlock != nil {
if startBlock.hash == nil { if startBlock.hash == nil {
start = startBlock.height start = startBlock.height
@ -2212,7 +2210,13 @@ func (w *Wallet) GetTransactions(startBlock, endBlock *BlockIdentifier, cancel <
} }
switch client := chainClient.(type) { switch client := chainClient.(type) {
case *chain.RPCClient: case *chain.RPCClient:
startResp = client.GetBlockVerboseTxAsync(startBlock.hash) startHeader, err := client.GetBlockHeaderVerbose(
startBlock.hash,
)
if err != nil {
return nil, err
}
start = startHeader.Height
case *chain.BitcoindClient: case *chain.BitcoindClient:
var err error var err error
start, err = client.GetBlockHeight(startBlock.hash) start, err = client.GetBlockHeight(startBlock.hash)
@ -2237,7 +2241,19 @@ func (w *Wallet) GetTransactions(startBlock, endBlock *BlockIdentifier, cancel <
} }
switch client := chainClient.(type) { switch client := chainClient.(type) {
case *chain.RPCClient: case *chain.RPCClient:
endResp = client.GetBlockVerboseTxAsync(endBlock.hash) endHeader, err := client.GetBlockHeaderVerbose(
endBlock.hash,
)
if err != nil {
return nil, err
}
end = endHeader.Height
case *chain.BitcoindClient:
var err error
start, err = client.GetBlockHeight(endBlock.hash)
if err != nil {
return nil, err
}
case *chain.NeutrinoClient: case *chain.NeutrinoClient:
var err error var err error
end, err = client.GetBlockHeight(endBlock.hash) end, err = client.GetBlockHeight(endBlock.hash)
@ -2247,20 +2263,6 @@ func (w *Wallet) GetTransactions(startBlock, endBlock *BlockIdentifier, cancel <
} }
} }
} }
if startResp != nil {
resp, err := startResp.Receive()
if err != nil {
return nil, err
}
start = int32(resp.Height)
}
if endResp != nil {
resp, err := endResp.Receive()
if err != nil {
return nil, err
}
end = int32(resp.Height)
}
var res GetTransactionsResult var res GetTransactionsResult
err := walletdb.View(w.db, func(dbtx walletdb.ReadTx) error { err := walletdb.View(w.db, func(dbtx walletdb.ReadTx) error {