Skip to content

Commit

Permalink
treat selectCoinsForJoin the same as joinStakePool
Browse files Browse the repository at this point in the history
  • Loading branch information
paweljakubas committed Aug 2, 2024
1 parent 875b1d6 commit 9078527
Showing 1 changed file with 18 additions and 11 deletions.
29 changes: 18 additions & 11 deletions lib/wallet/src/Cardano/Wallet/IO/Delegation.hs
Original file line number Diff line number Diff line change
Expand Up @@ -224,14 +224,18 @@ selectCoinsForJoin ctx pools poolId poolStatus = do
(Write.PParamsInAnyRecentEra era pp, timeTranslation)
<- W.readNodeTipStateForTxWrite netLayer
currentEpochSlotting <- W.getCurrentEpochSlotting netLayer
calculateWalletDelegations <-
db & \DBLayer{atomically,walletState} -> atomically $
readDelegation walletState
let dlg = calculateWalletDelegations currentEpochSlotting

(action, _) <- joinStakePoolDelegationAction
ctx
currentEpochSlotting
pools
poolId
poolStatus
NotVotedYet
(votingWalletDelegation dlg)

let changeAddrGen = W.defaultChangeAddressGen (delegationAddressS @n)

Expand Down Expand Up @@ -413,17 +417,20 @@ joinStakePool ctx wid pools poolId poolStatus passphrase = do
ti = timeInterpreter netLayer
txLayer = ctx ^. transactionLayer

votingWalletDelegation (WalletDelegation current coming) =
if isVoting current || any isVotingNext coming then
NotVotedThisTime
else
NotVotedYet
where
isVoting (Voting _) = True
isVoting (DelegatingVoting _ _) = True
isVoting _ = False
votingWalletDelegation
:: WalletDelegation
-> VoteRequest
votingWalletDelegation (WalletDelegation current coming) =
if isVoting current || any isVotingNext coming then
NotVotedThisTime
else
NotVotedYet
where
isVoting (Voting _) = True
isVoting (DelegatingVoting _ _) = True
isVoting _ = False

isVotingNext (WalletDelegationNext _ deleg) = isVoting deleg
isVotingNext (WalletDelegationNext _ deleg) = isVoting deleg

{-----------------------------------------------------------------------------
Quit stake pool
Expand Down

0 comments on commit 9078527

Please sign in to comment.