Skip to content

Commit

Permalink
add back support for updatePrices and updateBalances flags
Browse files Browse the repository at this point in the history
  • Loading branch information
jdogresorg committed Oct 25, 2024
1 parent 3b1c20e commit c1704c7
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions counterparty2mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,19 @@
$block = (isset($last) && $last>=$first) ? (intval($last) + 1) : $first;
}

// Flag to indicate if we should update market/asset prices as we parse each block
// Set this to false if you want a faster parse (price updates take a lil while)
// NOTE: If this is set to false, be sure to run the following scripts after your done with your parse to update asset and market prices
// ./misc/update_asset_prices.php
// ./misc/update_market_info.php --update
$updatePrices = true;

// Flag to indicate if we should update balances as we parse each block
// Set this to false if you want a faster parse
// NOTE: If this is set to false, be sure to run the following scripts after your done with your parse to update all address balances since block_index
// ./misc/fix_address_balances.php --block=block_index
$updateBalances = true;

// Get the current block index from status info
$current = $counterparty->status['last_block']['block_index'];

Expand Down Expand Up @@ -165,8 +178,10 @@

// Loop through addresses and update any asset balances
// Doing this first ensures that address balances are correct immediately
foreach($addresses as $address => $address_id)
updateAddressBalance($address, array_keys($assets));
if($updateBalances){
foreach($addresses as $address => $address_id)
updateAddressBalance($address, array_keys($assets));
}

// Loop through the messages and create/update the counterparty tables
foreach($messages as $message){
Expand Down Expand Up @@ -409,7 +424,8 @@

// Loop through assets and update BTC & XCP price
foreach($assets as $asset =>$id)
updateAssetPrice($asset);
if($updatePrices)
updateAssetPrice($asset);

// array of markets
$markets = array();
Expand Down Expand Up @@ -444,7 +460,7 @@
}
}
// If we have any market changes, update the markets
if(count($markets)){
if(count($markets) && $updatePrices){
$block_24hr = get24HourBlockIndex();
createUpdateMarkets($markets);
}
Expand Down

0 comments on commit c1704c7

Please sign in to comment.