-
Notifications
You must be signed in to change notification settings - Fork 214
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
Tests for tracking known transactions #148
Conversation
prop_applyBlockTxHistoryIncoming :: WalletState -> Property | ||
prop_applyBlockTxHistoryIncoming s = conjoin (map prop wallets) | ||
where | ||
wallets = scanl (flip applyBlock) (initWallet s) blockchain |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there a particular reason to check all intermediate state and not only the last one 🤔 ?
inTxs = filter isIncoming $ Set.toList $ getTxHistory wallet | ||
isIncoming (_, m) = direction m == Incoming | ||
txOuts = map (Set.fromList . map address . outputs . fst) inTxs | ||
overlaps a b = not (Set.disjoint a b) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It'll be nice to add a coverage checks that makes sure that addrs
and ourAddresses
aren't just empty all the time.
it "Incoming transactions have output addresses that belong to the wallet" | ||
(property prop_applyBlockTxHistoryIncoming) | ||
it "Any transction involving our addresses must be incoming" | ||
(property prop_applyBlockTxHistoryOurs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't get this second property 🤔 ? What about outgoing transactions with change?
…model tests This allows for having the original transactions that are referred to in some other blocks, and therefore, counts for outgoing transactions as well during testing
… to keep the tx history stored in the wallet state
29cd470
to
6aca526
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
reviewed + extended test data to cover more cases / branches from the model.
Relates to issue #90
Overview
This is a start for tests of the transaction tracking part of
applyBlock
.