Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Index cold staking address unspent output by spending address #434

Merged
merged 3 commits into from Apr 10, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
12 changes: 10 additions & 2 deletions src/main.cpp
Expand Up @@ -2430,6 +2430,8 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI
CTxDestination destination;
ExtractDestination(out.scriptPubKey, destination);
CNavCoinAddress address(destination);
if (out.scriptPubKey.IsColdStaking())
address.GetSpendingAddress(address);
address.GetIndexKey(hashBytes, type);

// undo spending activity
Expand Down Expand Up @@ -2509,9 +2511,11 @@ bool DisconnectBlock(const CBlock& block, CValidationState& state, const CBlockI
} else if (prevout.scriptPubKey.IsPayToPublicKey() || prevout.scriptPubKey.IsColdStaking()) {
uint160 hashBytes;
int type = 0;
CTxDestination destination;
CTxDestination destination;
ExtractDestination(prevout.scriptPubKey, destination);
CNavCoinAddress address(destination);
if (prevout.scriptPubKey.IsColdStaking())
address.GetSpendingAddress(address);
address.GetIndexKey(hashBytes, type);

// undo spending activity
Expand Down Expand Up @@ -2975,6 +2979,8 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
CTxDestination destination;
ExtractDestination(prevout.scriptPubKey, destination);
CNavCoinAddress address(destination);
if (prevout.scriptPubKey.IsColdStaking())
address.GetSpendingAddress(address);
address.GetIndexKey(hashBytes, addressType);
} else {
hashBytes.SetNull();
Expand Down Expand Up @@ -3091,9 +3097,11 @@ bool ConnectBlock(const CBlock& block, CValidationState& state, CBlockIndex* pin
} else if (out.scriptPubKey.IsPayToPublicKey() || out.scriptPubKey.IsColdStaking()) {
uint160 hashBytes;
int type = 0;
CTxDestination destination;
CTxDestination destination;
ExtractDestination(out.scriptPubKey, destination);
CNavCoinAddress address(destination);
if (out.scriptPubKey.IsColdStaking())
address.GetSpendingAddress(address);
address.GetIndexKey(hashBytes, type);

// undo spending activity
Expand Down