Skip to content

Commit

Permalink
Add pending tx expiry to TxMeta
Browse files Browse the repository at this point in the history
  • Loading branch information
rvl committed Aug 5, 2020
1 parent 8e5767e commit 3c6f96d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions lib/core/src/Cardano/Wallet.hs
Original file line number Diff line number Diff line change
Expand Up @@ -1726,6 +1726,7 @@ mkTxMeta interpretTime blockHeader wState cs =
, slotNo = blockHeader ^. #slotNo
, blockHeight = blockHeader ^. #blockHeight
, amount = Quantity (amtInps - amtOuts)
, expiry = Just (error "fixme: expiry slot")
}
)
where
Expand Down
1 change: 1 addition & 0 deletions lib/core/src/Cardano/Wallet/Primitive/Model.hs
Original file line number Diff line number Diff line change
Expand Up @@ -372,6 +372,7 @@ prefilterBlock b u0 = runState $ do
, slotNo = b ^. #header . #slotNo
, blockHeight = b ^. #header . #blockHeight
, amount = Quantity amt
, expiry = Nothing
}
applyTx
:: (IsOurs s Address)
Expand Down
4 changes: 3 additions & 1 deletion lib/core/src/Cardano/Wallet/Primitive/Types.hs
Original file line number Diff line number Diff line change
Expand Up @@ -879,15 +879,17 @@ data TxMeta = TxMeta
, slotNo :: !SlotNo
, blockHeight :: !(Quantity "block" Word32)
, amount :: !(Quantity "lovelace" Natural)
, expiry :: !(Maybe SlotNo)
} deriving (Show, Eq, Ord, Generic)

instance NFData TxMeta

instance Buildable TxMeta where
build (TxMeta s d sl (Quantity bh) (Quantity a)) = mempty
build (TxMeta s d sl (Quantity bh) (Quantity a) mex) = mempty
<> (case d of; Incoming -> "+"; Outgoing -> "-")
<> fixedF @Double 6 (fromIntegral a / 1e6)
<> " " <> build s
<> maybe mempty (\ex -> " expires " <> build ex) mex
<> " since " <> build sl <> "#" <> build bh

data TxStatus
Expand Down

0 comments on commit 3c6f96d

Please sign in to comment.