Commit 95260c71 authored by xiphon's avatar xiphon

fix mem pool deposits confirmations updating

parent f37b758e
...@@ -51,7 +51,7 @@ class walletNotify extends Command ...@@ -51,7 +51,7 @@ class walletNotify extends Command
} }
$min_height = Deposit::max('block_received'); $min_height = Deposit::max('block_received');
$transactions = $wallet->scanIncomingTransfers(max($min_height, 10) - 10); $transactions = $wallet->scanIncomingTransfers(max($min_height, 50) - 50);
$transactions->each(function ($transaction) use ($wallet) { $transactions->each(function ($transaction) use ($wallet) {
$this->processPayment($transaction); $this->processPayment($transaction);
}); });
...@@ -66,10 +66,15 @@ class walletNotify extends Command ...@@ -66,10 +66,15 @@ class walletNotify extends Command
*/ */
public function processPayment(Transaction $transaction) public function processPayment(Transaction $transaction)
{ {
// if the deposit exist, no need to try add it again $deposit = Deposit::where('tx_id', $transaction->id)->first();
if (Deposit::where('tx_id', $transaction->id)->exists()) { if ($deposit) {
if ($deposit->block_received == 0) {
$deposit->block_received = $transaction->block_height;
$deposit->save();
}
return null; return null;
} }
$this->info('amount: '.$transaction->amount / 1000000000000 .' confirmations:'.$transaction->confirmations.' tx_hash:'.$transaction->id); $this->info('amount: '.$transaction->amount / 1000000000000 .' confirmations:'.$transaction->confirmations.' tx_hash:'.$transaction->id);
$this->info('subaddr_index: '.$transaction->subaddr_index); $this->info('subaddr_index: '.$transaction->subaddr_index);
...@@ -96,7 +101,8 @@ class walletNotify extends Command ...@@ -96,7 +101,8 @@ class walletNotify extends Command
{ {
$count = 0; $count = 0;
//update all xmr deposit confirmations //update all xmr deposit confirmations
Deposit::where('confirmations', '<', 10) Deposit::where('confirmations', '<', 50)
->where('block_received', '>', 0)
->each(function ($deposit) use ($blockheight, &$count) { ->each(function ($deposit) use ($blockheight, &$count) {
$this->updateConfirmation($blockheight, $deposit); $this->updateConfirmation($blockheight, $deposit);
$count++; $count++;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment