Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -271,14 +271,17 @@ END Amount
, t.Address AS ReceiveAddress
, t.OutputBlockHeight as BlockHeight
FROM HDTransactionData AS t
-- We want to skip any rows that join up to this sub-query but only for non-staking receives.
-- The idea is that any address appearing as both source and destination would otherwise be a change address that should be skipped.
LEFT JOIN (
SELECT DISTINCT SpendTxId, Address
FROM HDTransactionData AS t2
WHERE t2.WalletId = {strWalletId} AND t2.SpendTxId is not null and t2.AccountIndex = {strAccountIndex}) t2
ON t2.SpendTxId = t.OutputTxId
AND t2.Address = t.Address
AND t.OutputTxIsCoinbase = 0 -- Don't join up if staking.
WHERE t.WalletId = {strWalletId} AND t.AccountIndex = {strAccountIndex}{((address == null) ? "" : $@" AND t.Address = {strAddress}")}
AND (t.OutputTxIsCoinbase != 0 OR t2.SpendTxId IS NULL){(!forCirrus ? "" : $@"
AND t2.SpendTxId IS NULL /* Not joining up */{(!forCirrus ? "" : $@"
AND t.OutputTxIsCoinbase = 0")}
GROUP BY t.OutputTxId
UNION ALL";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Linq;
using NBitcoin;
using SQLite;
Expand Down Expand Up @@ -164,13 +165,13 @@ internal ChainedHeader GetFork(ChainedHeader chainTip)

var blockLocator = new BlockLocator()
{
Blocks = this.BlockLocator.Split(',').Select(strHash => uint256.Parse(strHash)).ToList()
Blocks = this.BlockLocator.Split(',', System.StringSplitOptions.RemoveEmptyEntries).Select(strHash => uint256.Parse(strHash)).ToList()
};

List<int> locatorHeights = ChainedHeaderExt.GetLocatorHeights(this.LastBlockSyncedHeight);

// Find a locator block at or below the chain tip.
for (int i = 0; i < locatorHeights.Count; i++)
for (int i = 0; i < Math.Min(locatorHeights.Count, blockLocator.Blocks.Count); i++)
{
if (chainTip.Height < locatorHeights[i])
continue;
Expand Down