Merge pull request #208 from TheSerapher/issue-189

Issue 189
This commit is contained in:
Sebastian Grewe 2013-06-18 00:31:51 -07:00
commit 68d874b15a
2 changed files with 55 additions and 55 deletions

View File

@ -39,9 +39,8 @@ if ( $bitcoin->can_connect() === true ){
// Nothing to do so bail out // Nothing to do so bail out
if (empty($aTransactions['transactions'])) { if (empty($aTransactions['transactions'])) {
verbose("No new transactions since last block\n"); verbose("No new RPC transactions since last block\n");
} else { } else {
// Table header // Table header
verbose("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime\t\t\tStatus\n"); verbose("Blockhash\t\tHeight\tAmount\tConfirmations\tDiff\t\tTime\t\t\tStatus\n");
@ -66,25 +65,24 @@ if (empty($aTransactions['transactions'])) {
} }
} }
verbose("\n\n"); verbose("\n");
// Now with our blocks added we can scan for their upstream shares // Now with our blocks added we can scan for their upstream shares
$aAllBlocks = $block->getAllUnaccounted('ASC'); $aAllBlocks = $block->getAllUnaccounted('ASC');
if (empty($aAllBlocks)) { if (empty($aAllBlocks)) {
verbose("No new unaccounted blocks found\n"); verbose("No new unaccounted blocks found\n");
} } else {
// Loop through our unaccounted blocks
// Loop through our unaccounted blocks verbose("\nBlock ID\tBlock Height\tShare ID\tShares\tFinder\t\t\tStatus\n");
verbose("Block ID\tBlock Height\tShare ID\tShares\tFinder\t\t\tStatus\n"); foreach ($aAllBlocks as $iIndex => $aBlock) {
foreach ($aAllBlocks as $iIndex => $aBlock) {
if (empty($aBlock['share_id'])) { if (empty($aBlock['share_id'])) {
// Fetch this blocks upstream ID // Fetch this blocks upstream ID
if ($share->setUpstream($block->getLastUpstreamId())) { if ($share->setUpstream($block->getLastUpstreamId())) {
$iCurrentUpstreamId = $share->getUpstreamId(); $iCurrentUpstreamId = $share->getUpstreamId();
$iAccountId = $user->getUserId($share->getUpstreamFinder()); $iAccountId = $user->getUserId($share->getUpstreamFinder());
} else { } else {
verbose("Unable to fetch blocks upstream share\n"); verbose("\nUnable to fetch blocks upstream share. Aborting!\n");
verbose($share->getError() . "\n"); verbose($share->getError() . "\n");
continue; exit;
} }
// Fetch share information // Fetch share information
if (!$iPreviousShareId = $block->getLastShareId()) { if (!$iPreviousShareId = $block->getLastShareId()) {
@ -128,6 +126,7 @@ foreach ($aAllBlocks as $iIndex => $aBlock) {
} }
} }
} }
}
} }
?> ?>

View File

@ -187,6 +187,7 @@ class Share {
ORDER BY id ASC LIMIT 1"); ORDER BY id ASC LIMIT 1");
if ($this->checkStmt($stmt) && $stmt->bind_param('i', $last) && $stmt->execute() && $result = $stmt->get_result()) { if ($this->checkStmt($stmt) && $stmt->bind_param('i', $last) && $stmt->execute() && $result = $stmt->get_result()) {
$this->oUpstream = $result->fetch_object(); $this->oUpstream = $result->fetch_object();
if (!empty($this->oUpstream->account) && is_int($this->oUpstream->id))
return true; return true;
} }
// Catchall // Catchall