Skip to content

Commit

Permalink
Add delegation field to type ApplyBlockResult.
Browse files Browse the repository at this point in the history
This represents any stake delegation discovered when applying a block to
a wallet.
  • Loading branch information
jonathanknowles committed Nov 21, 2019
1 parent c40523d commit 51bb22f
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions lib/core/src/Cardano/Wallet/Primitive/Model.hs
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ import Cardano.Wallet.Primitive.Types
, EpochLength (..)
, FeePolicy (..)
, Hash (..)
, PoolId (..)
, SlotLength (..)
, SlotParameters (SlotParameters)
, StartTime (..)
Expand Down Expand Up @@ -272,8 +273,10 @@ updateState s (Wallet u tip _ bp) = Wallet u tip s bp

-- | Represents a set of data relevant to a particular wallet, discovered as
-- the result of applying a block to that wallet.
newtype ApplyBlockResult = ApplyBlockResult
{ transactions :: [(Tx, TxMeta)]
data ApplyBlockResult = ApplyBlockResult
{ delegation :: !(Maybe PoolId)
-- ^ Any stake delegation on behalf of the wallet.
, transactions :: ![(Tx, TxMeta)]
-- ^ The set of transactions that affect the wallet.
} deriving (Generic, Show, Eq)

Expand All @@ -290,7 +293,9 @@ applyBlock
-> (ApplyBlockResult, Wallet s)
applyBlock (Wallet !u _ s bp) !b =
( ApplyBlockResult
{ transactions = txs }
{ delegation = Nothing
, transactions = txs
}
, Wallet u' (b ^. #header) s' bp
)
where
Expand Down

0 comments on commit 51bb22f

Please sign in to comment.