Skip to content

Commit

Permalink
[GUI] Use new opcode for P2CS after v6 enforcement
Browse files Browse the repository at this point in the history
  • Loading branch information
random-zebra committed May 8, 2021
1 parent fb4fccf commit 2fbdef9
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
8 changes: 7 additions & 1 deletion src/qt/walletmodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,11 @@ bool WalletModel::isSaplingEnforced() const
return Params().GetConsensus().NetworkUpgradeActive(cachedNumBlocks, Consensus::UPGRADE_V5_0);
}

bool WalletModel::isV6Enforced() const
{
return Params().GetConsensus().NetworkUpgradeActive(cachedNumBlocks, Consensus::UPGRADE_V6_0);
}

bool WalletModel::isStakingStatusActive() const
{
return wallet && wallet->pStakerStatus && wallet->pStakerStatus->IsActive();
Expand Down Expand Up @@ -480,7 +485,8 @@ WalletModel::SendCoinsReturn WalletModel::prepareTransaction(WalletModelTransact
return InvalidAddress;
}

scriptPubKey = GetScriptForStakeDelegation(*stakerId, *ownerId);
scriptPubKey = isV6Enforced() ? GetScriptForStakeDelegation(*stakerId, *ownerId)
: GetScriptForStakeDelegationLOF(*stakerId, *ownerId);
} else {
// Regular P2PK or P2PKH
scriptPubKey = GetScriptForDestination(out);
Expand Down
1 change: 1 addition & 0 deletions src/qt/walletmodel.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,7 @@ class WalletModel : public QObject
bool isColdStakingNetworkelyEnabled() const;
bool isSaplingInMaintenance() const;
bool isSaplingEnforced() const;
bool isV6Enforced() const;
CAmount getMinColdStakingAmount() const;
/* current staking status from the miner thread **/
bool isStakingStatusActive() const;
Expand Down

0 comments on commit 2fbdef9

Please sign in to comment.