Commit f7edbff4 authored by Diego Salazar's avatar Diego Salazar

Merge branch 'fix-multi-output-deposits' into 'master'

Fix multi-destination deposits

Closes ccs-proposals#4

See merge request !8
parents 29f279cd b8a30ffa
...@@ -15,7 +15,8 @@ class walletNotify extends Command ...@@ -15,7 +15,8 @@ class walletNotify extends Command
* *
* @var string * @var string
*/ */
protected $signature = 'monero:notify'; protected $signature = 'monero:notify
{height? : Scan wallet transactions starting from the specified height}';
/** /**
* The console command description. * The console command description.
...@@ -50,7 +51,7 @@ class walletNotify extends Command ...@@ -50,7 +51,7 @@ class walletNotify extends Command
return; return;
} }
$min_height = Deposit::max('block_received'); $min_height = $this->argument('height') ?? Deposit::max('block_received');
$transactions = $wallet->scanIncomingTransfers(max($min_height, 50) - 50); $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,7 +67,7 @@ class walletNotify extends Command ...@@ -66,7 +67,7 @@ class walletNotify extends Command
*/ */
public function processPayment(Transaction $transaction) public function processPayment(Transaction $transaction)
{ {
$deposit = Deposit::where('tx_id', $transaction->id)->first(); $deposit = Deposit::where('tx_id', $transaction->id)->where('subaddr_index', $transaction->subaddr_index)->first();
if ($deposit) { if ($deposit) {
if ($deposit->block_received == 0) { if ($deposit->block_received == 0) {
$deposit->block_received = $transaction->block_height; $deposit->block_received = $transaction->block_height;
......
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