Skip to content

Commit 404d85f

Browse files
Merge pull request #434 from NAVCoin/cold-staking-index-spending
Index cold staking address unspent output by spending address
2 parents 197c460 + 0ae6115 commit 404d85f

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/main.cpp

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2430,6 +2430,8 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI
24302430
CTxDestination destination;
24312431
ExtractDestination(out.scriptPubKey, destination);
24322432
CNavCoinAddress address(destination);
2433+
if (out.scriptPubKey.IsColdStaking())
2434+
address.GetSpendingAddress(address);
24332435
address.GetIndexKey(hashBytes, type);
24342436

24352437
// undo spending activity
@@ -2509,9 +2511,11 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI
25092511
} else if (prevout.scriptPubKey.IsPayToPublicKey() || prevout.scriptPubKey.IsColdStaking()) {
25102512
uint160 hashBytes;
25112513
int type = 0;
2512-
CTxDestination destination;
2514+
CTxDestination destination;
25132515
ExtractDestination(prevout.scriptPubKey, destination);
25142516
CNavCoinAddress address(destination);
2517+
if (prevout.scriptPubKey.IsColdStaking())
2518+
address.GetSpendingAddress(address);
25152519
address.GetIndexKey(hashBytes, type);
25162520

25172521
// undo spending activity
@@ -2975,6 +2979,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
29752979
CTxDestination destination;
29762980
ExtractDestination(prevout.scriptPubKey, destination);
29772981
CNavCoinAddress address(destination);
2982+
if (prevout.scriptPubKey.IsColdStaking())
2983+
address.GetSpendingAddress(address);
29782984
address.GetIndexKey(hashBytes, addressType);
29792985
} else {
29802986
hashBytes.SetNull();
@@ -3091,9 +3097,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
30913097
} else if (out.scriptPubKey.IsPayToPublicKey() || out.scriptPubKey.IsColdStaking()) {
30923098
uint160 hashBytes;
30933099
int type = 0;
3094-
CTxDestination destination;
3100+
CTxDestination destination;
30953101
ExtractDestination(out.scriptPubKey, destination);
30963102
CNavCoinAddress address(destination);
3103+
if (out.scriptPubKey.IsColdStaking())
3104+
address.GetSpendingAddress(address);
30973105
address.GetIndexKey(hashBytes, type);
30983106

30993107
// undo spending activity

0 commit comments

Comments
 (0)