Commit Graph

64 Commits

Author SHA1 Message Date
tomFlowee 7e375f50b5 Bugfix how we handle numbers from user input
This is a long overdue cleanup around the ideas of entering
numbers in Flowee Pay.

The core dataclass BitcoinValue now keeps track where the number
came from, either user input or some calculation. This allows
us to have the Fiat and the Coin price stay in sync without weird
problems.
The one we type uses a string, the price field that we are not typing in
is then a slave and we follow the auto-generated number as the
source.

This solves a host of known issues:

* Editing of value objects is much more consistnnt and predictable now.
* Switching to a different fiat type now properly re-calculates the
  values that are slaved. So if the primary is a BCH value then the fiat
  value gets the new exhange rate instantly applied.
* Switching to a different fiat type properly applies having a separator
  So if you go from euro to Japanese yen, we now remove the separator
  and the numbers behind it.
* Changing the app setting from BCH to mBCH now properly updates all
  amounts. Notice that the user-typed string wins, if you typed 2 and
  then change to mBCH we assume you wanted 2, not 2000.
* Paste now works more logcally.
* Cursor is no longer sometimes invisible, requiring backspace to make
  it show up.

And last we now protect against too large numbers. It is seen as an
error to type a number above 21 million BCH.

Fixes #19
2023-06-23 10:35:35 +02:00
tomFlowee 1220a3839c Start a setup for modules.
This sets up a basic system for creating modules on top of the flowee
pay static lib in a way that is ensured to be isolated (modules can't
accidentally use each other's classes)

The setup is made such that the buildsystem does the hard work on
plugging in a new module, making it so that all you need to do is create
a new dir and a "{something}ModuleInfo.h" file and it will get compiled
in.
The point there is to make it not have any merge conflicts and just make
it dead easy to get started.
2023-06-13 15:59:37 +02:00
tomFlowee 5125ecc222 Upgrade tests for 'earlier-this-month' model.
This fixes some cornercases and makes the test
a) properly data-driven (don't use 'today').
b) much more extensive.

This also removes some duplicate code and fixes some bugs in the actual
model it tests.
2023-05-08 10:29:15 +02:00
tomFlowee 2e4860f1c1 Fix unit test sometimes failing
As the code is by nature probabilistic, the unit test needed to be a
little more flexible in handling different outcomes.
2023-05-02 20:07:39 +02:00
tomFlowee 73e10f8bef Fix reordering of finding transactions
In our wallet we very rarely end up in a situation where we have to ask
the same transactions twice from a peer due to us having generated a
bunch of new keys from a HD wallet in the middle of a series we asked
that peer. Making the filter we sent at the start of the series be
outdated halfway through.

This is now handled properly.

This adds a unit test which tests that we now reach the right balance
and can add the same block multiple times without it failing.

Fixes: #12
2023-04-04 13:36:07 +02:00
tomFlowee d5d5c74cb4 Fixlet in unit test. 2023-02-02 12:46:30 +01:00
tomFlowee 6c82e6cd4f Fix being able to run 'make check'.
Make the name here match the name registerd in the child cmakelists.txt
2022-12-19 23:29:38 +01:00
tomFlowee 702735e17a Fix the grouping of transactions.
This adds a unit test as well, which is a bit tricky as this is date
specific.
2022-12-13 20:53:58 +01:00
tomFlowee 163e615613 Move sources into the src subdir
Slowly the amount of cpp sources has been growing to the point
where its just too much to store in the root of the project.
I think they are more happy in a subdir as well, getting an elevated
position for themselves.
2022-12-13 11:54:03 +01:00
tomFlowee f25b4a716c Allow the 'BitcoinValue' to easier editable
This new allows a value to be set as a number, for instance from the
user reading a QR code, and the "typed-value" is created from this
in order to allow the user to edit it instead of overwrite it.
2022-12-06 22:09:28 +01:00
tomFlowee f36d075c64 Make unit test pass again. 2022-10-07 22:45:02 +02:00
tomFlowee 01e169e41b Fixlets from linter detection. 2022-09-26 16:23:21 +02:00
tomFlowee e643a7749b Port to Qt6 2022-08-20 18:23:51 +02:00
tomFlowee f27667c172 Integrate historical price module
For mined transactions we now use the historical fiat price of BCH
instead of the current.

This will give us a much more stable and historically accurate view of
our transactions.

Fixes: #7
2022-08-12 23:46:18 +02:00
tomFlowee 5eda36008d Add some more functionality to the price history 2022-08-11 13:48:59 +02:00
tomFlowee b81910226d Start new class 2022-08-02 21:49:30 +02:00
tomFlowee fff90de695 Fixlets and simplification in unit unit test
This reflects that we no longer have a 3-state but that a wallet is
either open or closed.
2022-07-21 14:21:31 +02:00
tomFlowee 56f367a515 Fixlet in unit test. 2022-07-06 22:54:37 +02:00
tomFlowee 663169530d Follow rename of CKeyID -> KeyId 2022-07-06 22:06:58 +02:00
tomFlowee 7558fb1517 Refactor encryption, pass pwd when needed. 2022-06-19 14:29:27 +02:00
tomFlowee 9afdad806f Add more encryption support to the QML classes.
Also allow better interaction with the wallet.
2022-05-18 12:59:01 +02:00
tomFlowee 751d8f2119 Add test for saveTransaction 2022-05-17 22:49:01 +02:00
tomFlowee e120df9b71 Implement fully encrypting the wallet files.
For the 'fullyEncrypted' option we now simply fully
encrypt the entire blob of both the secrets file as well
as the wallet.dat (which transactions we own).
2022-05-17 22:26:48 +02:00
tomFlowee f0ca231e7a Make the re-loading of an encrypted tx work. 2022-05-17 16:21:59 +02:00
tomFlowee fe6fa98ff2 Make full-encrypted encrypt the transactions
This additionally makes the password get hashed more often and we create
an 'iv' from it as well.
2022-05-17 00:44:51 +02:00
tomFlowee a58bf9f09f Make basic wallet-encryption work.
We encrypt using a standard AES256 encryption scheme.
The key is 256 bits and we derive that from a user provided password
which we double-hash (sha256). Additionally we use a randomly generated
salt for a specific wallet that is fed into the hashing algo as well.

This version simply encrypts the private keys of a wallet, which makes
it quite basic. A good start.
2022-05-14 14:34:28 +02:00
tomFlowee 2accfa9700 Start wallet-encryption 2022-05-13 19:29:25 +02:00
tomFlowee a9004af44f Cleanup code quality. 2022-04-15 18:09:02 +02:00
tomFlowee b2ca1f0d31 Improve UTXO selection wrt Fusions
When the wallet contains fused transactions we select UTXOs a bit
different in order to maximize privacy.

Additionally this prefers an UTXO that is closest in value to the paid
amount.
2022-04-15 18:09:02 +02:00
tomFlowee 4a184fc5c2 Make a static lib pay_lib
To avoid recompiles and such generally to simplify stuff, this
moves all the code into a static lib that is then linked with
by the various apps (including tests).
2021-11-20 22:20:08 +01:00
tomFlowee 89dfd87a44 remove unused include 2021-11-08 20:04:37 +01:00
tomFlowee 5edfbe7ca4 Add test for rejected transactions 2021-11-08 19:36:47 +01:00
tomFlowee 06b02db4dc Add new unittest and code for output locking 2021-11-08 15:24:48 +01:00
tomFlowee 351283e6bf Fix typo in methodname. 2021-11-08 15:21:53 +01:00
tomFlowee 61eb8ef1ec Fix one more usecase. 2021-11-03 22:00:58 +01:00
tomFlowee 941757f6cb Make entering Bitcoin Values much more native.
This also starts a FiatValueField widget and related logic in the send
screen, but this is still unfinished.
2021-11-03 19:26:50 +01:00
tomFlowee 6a708726a1 Rework BitcoinValue class
We now have a unit test and it supports cursor position for a much more
intuitive editing experience.
2021-11-03 18:29:31 +01:00
tomFlowee 5a245c8b17 Mark "spam" transactions as locked. 2021-11-01 16:33:53 +01:00
tomFlowee e39c8233d6 Fix returning a bad value sometimes. 2021-11-01 14:14:00 +01:00
tomFlowee 35bd66297d Find in the transactions the signature type used.
As transactions are found on the blockchain we remember the signature
type used in order to avoid one private key to be used for both types of
signatures, which can cause compromised keys.
2021-10-31 16:56:03 +01:00
tomFlowee d005a2cd7e Refactor; move code. 2021-10-29 12:48:12 +02:00
tomFlowee b63ba4e9b0 Make test more stable. 2021-10-27 19:44:19 +02:00
tomFlowee 80d7456898 Make new-wallet pane functional.
This changes the default generated wallet to be a HD wallet.
We also add a helper class to configure newly created wallets from QML.
This finishes up the new wallet panel to have all the visible features
actually do something.
2021-10-27 19:11:00 +02:00
tomFlowee d839e18ed2 Add to wallet ability to sync a HD path 2021-10-21 14:57:20 +02:00
tomFlowee f61daf7cb9 Shape the 'import' screen to be much more useful. 2021-10-18 22:26:53 +02:00
tomFlowee 1106937648 Make wallet able to be hierarchically deterministic 2021-10-14 14:42:27 +02:00
tomFlowee 87c8ba701f [Unit test] Avoid compiler warning.
We read 20 bytes where only 4 were provided, so lets provide 20 bytes.
2021-08-09 22:08:04 +02:00
tomFlowee dc48600ff4 Make Schnorr signing default. 2021-05-04 17:41:49 +02:00
tomFlowee 596b246c0f Try to reproduce a bug. 2021-04-19 19:22:37 +02:00
tomFlowee fb598c8c8f Add notification manager. 2021-02-05 16:56:02 +01:00