chain: also accept map[wire.OutPoint]btcutil.Address for bitcoind rescans

In this commit, we update bitcoind to also accept a mapping from
outpoint to address for its implementation of the recan RPC. We do this
as in the near future, when bitcoind implements BIP 158 indexing, then
we'll be able to utilize that to do rescans.
This commit is contained in:
Olaoluwa Osuntokun 2018-07-17 18:55:58 -07:00
parent 6a0e6da280
commit 5b3d124de2

View file

@ -229,7 +229,8 @@ func (c *BitcoindClient) notifying() bool {
// LoadTxFilter updates the transaction watchlists for the client. Acceptable // LoadTxFilter updates the transaction watchlists for the client. Acceptable
// arguments after `reset` are any combination of []btcutil.Address, // arguments after `reset` are any combination of []btcutil.Address,
// []wire.OutPoint, []*wire.OutPoint, []chainhash.Hash, and []*chainhash.Hash. // []wire.OutPoint, []*wire.OutPoint, []chainhash.Hash,
// map[wire.OutPoint]btcutil.Address, and []*chainhash.Hash.
func (c *BitcoindClient) LoadTxFilter(reset bool, func (c *BitcoindClient) LoadTxFilter(reset bool,
watchLists ...interface{}) error { watchLists ...interface{}) error {
@ -254,16 +255,25 @@ func (c *BitcoindClient) LoadTxFilter(reset bool,
for _, watchList := range watchLists { for _, watchList := range watchLists {
switch list := watchList.(type) { switch list := watchList.(type) {
case map[wire.OutPoint]btcutil.Address:
sendList(list)
case []wire.OutPoint: case []wire.OutPoint:
sendList(list) sendList(list)
case []*wire.OutPoint: case []*wire.OutPoint:
sendList(list) sendList(list)
case []btcutil.Address: case []btcutil.Address:
sendList(list) sendList(list)
case []chainhash.Hash: case []chainhash.Hash:
sendList(list) sendList(list)
case []*chainhash.Hash: case []*chainhash.Hash:
sendList(list) sendList(list)
default: default:
log.Warnf("Couldn't add item to filter: unknown type") log.Warnf("Couldn't add item to filter: unknown type")
} }