Remove dependence on btcjson.NewOutPointFromWire.

This commit is contained in:
Josh Rickmar 2015-04-23 14:55:35 -04:00
parent 05f1d6c89a
commit 13b872259d

View file

@ -734,6 +734,15 @@ func (c *Client) notifySpentInternal(outpoints []btcjson.OutPoint) FutureNotifyS
return c.sendCmd(cmd)
}
// newOutPointFromWire constructs the btcjson representation of a transaction
// outpoint from the wire type.
func newOutPointFromWire(op *wire.OutPoint) btcjson.OutPoint {
return btcjson.OutPoint{
Hash: op.Hash.String(),
Index: op.Index,
}
}
// NotifySpentAsync returns an instance of a type that can be used to get the
// result of the RPC at some future time by invoking the Receive function on
// the returned instance.
@ -755,7 +764,7 @@ func (c *Client) NotifySpentAsync(outpoints []*wire.OutPoint) FutureNotifySpentR
ops := make([]btcjson.OutPoint, 0, len(outpoints))
for _, outpoint := range outpoints {
ops = append(ops, *btcjson.NewOutPointFromWire(outpoint))
ops = append(ops, newOutPointFromWire(outpoint))
}
cmd := btcjson.NewNotifySpentCmd(ops)
return c.sendCmd(cmd)
@ -970,7 +979,7 @@ func (c *Client) RescanAsync(startBlock *wire.ShaHash,
// Convert outpoints.
ops := make([]btcjson.OutPoint, 0, len(outpoints))
for _, op := range outpoints {
ops = append(ops, *btcjson.NewOutPointFromWire(op))
ops = append(ops, newOutPointFromWire(op))
}
cmd := btcjson.NewRescanCmd(startBlockShaStr, addrs, ops, nil)
@ -1050,7 +1059,7 @@ func (c *Client) RescanEndBlockAsync(startBlock *wire.ShaHash,
// Convert outpoints.
ops := make([]btcjson.OutPoint, 0, len(outpoints))
for _, op := range outpoints {
ops = append(ops, *btcjson.NewOutPointFromWire(op))
ops = append(ops, newOutPointFromWire(op))
}
cmd := btcjson.NewRescanCmd(startBlockShaStr, addrs, ops,