decred / dcrwallet

A secure Decred wallet daemon written in Go (golang).
https://decred.org
ISC License
218 stars 154 forks source link

Do not autogenerate voting address for non-voting wallets #1199

Open jrick opened 6 years ago

jrick commented 6 years ago

If a wallet is not in voting mode, all RPCs to purchase tickets should error when not either provided an explicit voting address to use, or the wallet is not configured to create voting addresses from an address/xpub set in the config.

This change is being prompted by the fact that SPV wallets will not vote, so they should not generate one of their own addresses as a voting address without going through additional hoops.

vctt94 commented 6 years ago

Can I get this one?

kLkA commented 5 years ago

@jrick I think this wasn't taken yet so I've made this enhancement inside #1137 PR as part of voting xpub account implementation with condition

if !w.VotingEnabled() && w.TicketAddress() == nil && !w.VotingAccountEnabled() {
        // Throw error if non-voting wallet has no voting address or voting account configured
        return nil, rpcErrorf(dcrjson.ErrRPCInvalidParameter, "non-voting wallet must have " +
            "configured voting address or voting account")
    }