1
0

Require renter settings to mount

This commit is contained in:
Scott E. Graves
2017-03-29 20:11:15 -05:00
parent e94d7169e4
commit 688c56ad5c
4 changed files with 70 additions and 27 deletions

View File

@@ -274,6 +274,7 @@ void CSiaDriveApp::OnContextCreated(
obj->SetValue("isWalletConfigured", CefV8Value::CreateBool(_siaApi->GetWallet()->GetCreated()), V8_PROPERTY_ATTRIBUTE_NONE);
obj->SetValue("isOnline", CefV8Value::CreateBool(_siaApi->GetWallet()->GetConnected()), V8_PROPERTY_ATTRIBUTE_NONE);
obj->SetValue("clientVersion", CefV8Value::CreateString(SIDRIVE_VERSION_STRING), V8_PROPERTY_ATTRIBUTE_NONE);
obj->SetValue("allocatedRenterFunds", CefV8Value::CreateString(_siaApi->GetRenter()->GetFunds().ToString()), V8_PROPERTY_ATTRIBUTE_NONE);
global->SetValue("uiState", obj, V8_PROPERTY_ATTRIBUTE_NONE);
CefRefPtr<FunctionHandler> handler(new FunctionHandler(*_siaApi, _appStarted, _siaDriveConfig, _siaDrive, [this]() {this->ShutdownServices(); }, [this](CefRefPtr<CefV8Context> context) {this->SiaApiRefreshCallback(context, *_siaCurl, _siaDriveConfig.get()); }));

View File

@@ -80,6 +80,13 @@ void CSiaApi::_CSiaRenter::Refresh(const CSiaCurl& siaCurl, CSiaDriveConfig* sia
SetPeriod(period);
_currentAllowance = { funds, hosts, period, renewWindow };
if (_currentAllowance.Funds == 0)
{
_currentAllowance.Funds = SIA_DEFAULT_MINIMUM_FUNDS;
_currentAllowance.Hosts = SIA_DEFAULT_HOST_COUNT;
_currentAllowance.Period = SIA_BLOCKS_PER_MONTH * 3;
_currentAllowance.RenewWindowInBlocks = SIA_DEFAULT_RENEW_WINDOW;
}
if (ApiSuccess(RefreshFileTree()))
{
CSiaFileTreePtr fileTree;