Correct a few cases of address encoding.
There are certain RPCs where an address should be sent as the raw string instead of the encoded bitcoin address since the RPC handler on the other end expects "keys" instead of Bitcoin addresses. For example, the multisignature RPCs addmultisigaddress and createmultisig can work with pubkeys (compressed, uncompressed, or hybrid) as well as Bitcoin addresses. The original issue which prompted these changes was report by Paul Snow on IRC.
This commit is contained in:
parent
28c0a3c8c7
commit
67d570e660
3 changed files with 6 additions and 6 deletions
|
@ -847,7 +847,7 @@ func (c *Client) NotifyReceivedAsync(addresses []btcutil.Address) FutureNotifyRe
|
|||
// Convert addresses to strings.
|
||||
addrs := make([]string, 0, len(addresses))
|
||||
for _, addr := range addresses {
|
||||
addrs = append(addrs, addr.EncodeAddress())
|
||||
addrs = append(addrs, addr.String())
|
||||
}
|
||||
id := c.NextID()
|
||||
cmd := btcws.NewNotifyReceivedCmd(id, addrs)
|
||||
|
@ -921,7 +921,7 @@ func (c *Client) RescanAsync(startHeight int32, addresses []btcutil.Address,
|
|||
// Convert addresses to strings.
|
||||
addrs := make([]string, 0, len(addresses))
|
||||
for _, addr := range addresses {
|
||||
addrs = append(addrs, addr.EncodeAddress())
|
||||
addrs = append(addrs, addr.String())
|
||||
}
|
||||
|
||||
// Convert outpoints.
|
||||
|
@ -996,7 +996,7 @@ func (c *Client) RescanEndHeightAsync(startHeight int32,
|
|||
// Convert addresses to strings.
|
||||
addrs := make([]string, 0, len(addresses))
|
||||
for _, addr := range addresses {
|
||||
addrs = append(addrs, addr.EncodeAddress())
|
||||
addrs = append(addrs, addr.String())
|
||||
}
|
||||
|
||||
// Convert outpoints.
|
||||
|
|
|
@ -257,7 +257,7 @@ func (c *Client) CreateRawTransactionAsync(inputs []btcjson.TransactionInput,
|
|||
id := c.NextID()
|
||||
convertedAmts := make(map[string]int64, len(amounts))
|
||||
for addr, amount := range amounts {
|
||||
convertedAmts[addr.EncodeAddress()] = int64(amount)
|
||||
convertedAmts[addr.String()] = int64(amount)
|
||||
}
|
||||
cmd, err := btcjson.NewCreateRawTransactionCmd(id, inputs, convertedAmts)
|
||||
if err != nil {
|
||||
|
|
|
@ -782,7 +782,7 @@ func (c *Client) AddMultisigAddressAsync(requiredSigs int, addresses []btcutil.A
|
|||
|
||||
addrs := make([]string, 0, len(addresses))
|
||||
for _, addr := range addresses {
|
||||
addrs = append(addrs, addr.EncodeAddress())
|
||||
addrs = append(addrs, addr.String())
|
||||
}
|
||||
|
||||
cmd, err := btcjson.NewAddMultisigAddressCmd(id, requiredSigs, addrs, account)
|
||||
|
@ -832,7 +832,7 @@ func (c *Client) CreateMultisigAsync(requiredSigs int, addresses []btcutil.Addre
|
|||
|
||||
addrs := make([]string, 0, len(addresses))
|
||||
for _, addr := range addresses {
|
||||
addrs = append(addrs, addr.EncodeAddress())
|
||||
addrs = append(addrs, addr.String())
|
||||
}
|
||||
|
||||
cmd, err := btcjson.NewCreateMultisigCmd(id, requiredSigs, addrs)
|
||||
|
|
Loading…
Add table
Reference in a new issue