Check dcrwallet network before calling walletinfo RPC
This commit is contained in:
parent
70ba1adc93
commit
b029d88fdb
@ -84,6 +84,20 @@ func (w *WalletConnect) Clients(ctx context.Context, netParams *chaincfg.Params)
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Verify dcrwallet is on the correct network.
|
||||||
|
var netID wire.CurrencyNet
|
||||||
|
err = c.Call(ctx, "getcurrentnet", &netID)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("getcurrentnet check on dcrwallet '%s' failed: %v", c.String(), err)
|
||||||
|
failedConnections++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if netID != netParams.Net {
|
||||||
|
log.Errorf("dcrwallet '%s' running on %s, expected %s", c.String(), netID, netParams.Net)
|
||||||
|
failedConnections++
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// Verify dcrwallet is voting and unlocked.
|
// Verify dcrwallet is voting and unlocked.
|
||||||
var walletInfo wallettypes.WalletInfoResult
|
var walletInfo wallettypes.WalletInfoResult
|
||||||
err = c.Call(ctx, "walletinfo", &walletInfo)
|
err = c.Call(ctx, "walletinfo", &walletInfo)
|
||||||
@ -105,20 +119,6 @@ func (w *WalletConnect) Clients(ctx context.Context, netParams *chaincfg.Params)
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// Verify dcrwallet is on the correct network.
|
|
||||||
var netID wire.CurrencyNet
|
|
||||||
err = c.Call(ctx, "getcurrentnet", &netID)
|
|
||||||
if err != nil {
|
|
||||||
log.Errorf("getcurrentnet check on dcrwallet '%s' failed: %v", c.String(), err)
|
|
||||||
failedConnections++
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
if netID != netParams.Net {
|
|
||||||
log.Errorf("dcrwallet '%s' running on %s, expected %s", c.String(), netID, netParams.Net)
|
|
||||||
failedConnections++
|
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
walletClients = append(walletClients, &WalletRPC{c, ctx})
|
walletClients = append(walletClients, &WalletRPC{c, ctx})
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user