wallet: update db balances after manual send

This commit is contained in:
Tanguy Pruvot 2017-01-03 08:15:40 +01:00
parent 1e72d4fb81
commit f11285087f
3 changed files with 15 additions and 1 deletions

View file

@ -343,7 +343,19 @@ function BackendUpdatePoolBalances($coinid = NULL)
{
$t1 = microtime(true);
$sqlFilter = $coinid ? "id=".intval($coinid) : 'enable=1';
$sqlFilter = 'enable=1';
if ($coinid) { // used from wallet manual send
$sqlFilter = "id=".intval($coinid);
// refresh balance field from the wallet info
$coin = getdbo('db_coins', $coinid);
$remote = new WalletRPC($coin);
$info = $remote->getinfo();
if(isset($info['balance'])) {
$coin->balance = $info['balance'];
$coin->save();
}
}
$coins = getdbolist('db_coins', $sqlFilter);
foreach($coins as $coin)

View file

@ -85,6 +85,7 @@ class MarketController extends CommonController
} else {
$market->lastsent = time();
$market->save();
BackendUpdatePoolBalances($coin->id);
}
$exchange = new db_exchange;

View file

@ -252,6 +252,7 @@ class SiteController extends CommonController
debuglog("sent $amount {$coin->symbol} to bookmark {$bookmark->address}");
$bookmark->lastused = time();
$bookmark->save();
BackendUpdatePoolBalances($coin->id);
}
}