Commit Graph

43 Commits

Author SHA1 Message Date
tomFlowee 0bb6bb0bf5 Fix includes
Avoid the includes of whole modules, which is expensive and
unpredictable.
2025-03-07 23:27:08 +01:00
tomFlowee 42df2fb2c8 Fix new wallet being marked as import for a little
This moves the decision if it is importing out of the wallet and we stop
using a broken heuristic.

Also cleanup the API usage of the hd masterkey format in the wallet
header.
2024-12-31 15:57:17 +01:00
tomFlowee 5e89ba5d41 match comment to reality 2024-03-18 22:51:32 +01:00
tomFlowee dbed7c7a69 Reject transactions of v >= 10
This is purely a future-proofing measure, don't accept transactions that
are likely to be handled differently than todays transactions.
Since the May 2023 upgrade versions other than 1 or two are not allowed
on-chain, but before that some version 4 transactions were mined (and some
negative numbered ones longer ago).

Talks about a version 10 transaction has started, so make sure this software,
if it is still running at someone's machine, will already reject higher
version transactions because we can't know if they are compatible or not.
2024-03-13 17:03:37 +01:00
tomFlowee 8e0c7c57e6 Follow Streaming::pool() refactor
This upstream refactor stopped passing in the pool by pointer and
now wraps it in a shared_ptr.

A lot less 'address-of' operators and generally cleaner code are
the result.
2023-12-22 16:46:23 +01: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 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 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 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 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 b63ba4e9b0 Make test more stable. 2021-10-27 19:44:19 +02:00
tomFlowee d839e18ed2 Add to wallet ability to sync a HD path 2021-10-21 14:57:20 +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 0e34e308db Add unit test for Wallet::findInputsFor() 2021-01-31 22:51:55 +01:00
tomFlowee 1262733154 Make bip21 payment request minimal functional 2021-01-06 15:26:46 +01:00
tomFlowee 20690a24ce Update email 2021-01-05 14:04:10 +01:00
TomZ cb2b147096 Split 'balance' into 3 variables.
* confirmed
* unconfirmed
* immature
2020-11-06 22:54:39 +01:00
TomZ f24a6e0f84 Implement replacing transaction
When a unconfirmed transaction gets made invalid by a mined one spending
the same output, this updates the wallet balance and UTXO state
properly.
2020-11-03 20:16:36 +01:00
TomZ ae0c395d50 Make the wallet process mempool transactions
When a transaction is received by the p2pnet layer via a simple INV/
GetData we now process this and properly lock the outputs it spent to
avoid creating double spending transactions.

One task is left: properly recognize when a mined transaction
invalidates another transaction (like an unconfirmed one) and update the
datastructures.
2020-11-02 21:49:06 +01:00
TomZ 1c94c34582 Add copyright headers 2020-10-17 16:40:48 +02:00
TomZ 2c8954eafa Fix reorg-tx algo and add unit test for it.
The code to re-org all transactions in a block so transactions that
depend on others are processed after those they depend on had a silly
bug (missing line), fixed that but also made it unit-testable to
demonstrate the bug.
2020-10-17 16:38:37 +02:00