From 95260c71014e821cf8d5ec8395eaa551e57c0619 Mon Sep 17 00:00:00 2001 From: xiphon Date: Mon, 28 Jan 2019 12:50:05 +0000 Subject: [PATCH] fix mem pool deposits confirmations updating --- app/Console/Commands/WalletNotify.php | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/Console/Commands/WalletNotify.php b/app/Console/Commands/WalletNotify.php index f617a5f..3befc93 100644 --- a/app/Console/Commands/WalletNotify.php +++ b/app/Console/Commands/WalletNotify.php @@ -51,7 +51,7 @@ class walletNotify extends Command } $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) { $this->processPayment($transaction); }); @@ -66,10 +66,15 @@ class walletNotify extends Command */ public function processPayment(Transaction $transaction) { - // if the deposit exist, no need to try add it again - if (Deposit::where('tx_id', $transaction->id)->exists()) { + $deposit = Deposit::where('tx_id', $transaction->id)->first(); + if ($deposit) { + if ($deposit->block_received == 0) { + $deposit->block_received = $transaction->block_height; + $deposit->save(); + } return null; } + $this->info('amount: '.$transaction->amount / 1000000000000 .' confirmations:'.$transaction->confirmations.' tx_hash:'.$transaction->id); $this->info('subaddr_index: '.$transaction->subaddr_index); @@ -96,7 +101,8 @@ class walletNotify extends Command { $count = 0; //update all xmr deposit confirmations - Deposit::where('confirmations', '<', 10) + Deposit::where('confirmations', '<', 50) + ->where('block_received', '>', 0) ->each(function ($deposit) use ($blockheight, &$count) { $this->updateConfirmation($blockheight, $deposit); $count++; -- GitLab