Skip to content

Commit

Permalink
Only enable mainnet RPC method safety check on mainnet.
Browse files Browse the repository at this point in the history
This fixes the unsafemainnet option so it only affects mainnet.  This
broke as part of the recent btcwallet sync as the entire feature had
to be rewritten for the new legacyrpc package.

Fixes #85.
  • Loading branch information
jrick committed Mar 2, 2016
1 parent a86b675 commit 0b35b98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion rpc/legacyrpc/methods.go
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,8 @@ type lazyHandler func() (interface{}, *dcrjson.RPCError)
// chainClient is not nil, the returned handler performs RPC passthrough.
func lazyApplyHandler(request *dcrjson.Request, w *wallet.Wallet, chainClient *chain.RPCClient, unsafeMainNet bool) lazyHandler {
handlerData, ok := rpcHandlers[request.Method]
if ok && handlerData.requireUnsafeOnMainNet && !unsafeMainNet {
if ok && handlerData.requireUnsafeOnMainNet &&
w.ChainParams() == &chaincfg.MainNetParams && !unsafeMainNet {
return func() (interface{}, *dcrjson.RPCError) {
return nil, &ErrMainNetSafety
}
Expand Down

0 comments on commit 0b35b98

Please sign in to comment.