Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
CCS Backend
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Syai
CCS Backend
Commits
95260c71
Commit
95260c71
authored
6 years ago
by
xiphon
Browse files
Options
Downloads
Patches
Plain Diff
fix mem pool deposits confirmations updating
parent
f37b758e
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/Console/Commands/WalletNotify.php
+10
-4
10 additions, 4 deletions
app/Console/Commands/WalletNotify.php
with
10 additions
and
4 deletions
app/Console/Commands/WalletNotify.php
+
10
−
4
View file @
95260c71
...
@@ -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
,
1
0
)
-
1
0
);
$transactions
=
$wallet
->
scanIncomingTransfers
(
max
(
$min_height
,
5
0
)
-
5
0
);
$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
++
;
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment