43 Commits

Author SHA1 Message Date
Antoine Poinsot
9d0c68dae3
commands: add a 'list_coins' command. 2022-08-18 12:01:27 +02:00
Antoine Poinsot
99a9cbf0f8
poller: query derivation index by address from DB 2022-08-18 12:01:26 +02:00
Antoine Poinsot
3f17e9f0c3
database: change interface from update_der_index to increment_der_index
And take care of updating the (addr->index) mapping in the SQLite implementation.
2022-08-18 12:01:26 +02:00
Antoine Poinsot
e74ea4c2d3
sqlite: a table for a mapping from address to derivation index. 2022-08-18 12:01:25 +02:00
Antoine Poinsot
c9ef068fa5
poller: update our coins on each poll
This refactors the entire state update on each poll, to apply database
changes at the very end.
2022-08-18 12:01:25 +02:00
Antoine Poinsot
c6a25adfcd
bitcoin: interface for coins discovery and updates 2022-08-18 12:01:24 +02:00
Antoine Poinsot
05b3af1b5a
database: interface and implementation for coins storage and update 2022-08-18 12:01:24 +02:00
Antoine Poinsot
798bf67e21
commands: derive Deserialize for commands results 2022-08-17 19:40:00 +02:00
Antoine Poinsot
fe5de96312
Shorten the paths to the dummy datadirs in the unit tests
It failed CI on MacOS because of overflowing SUN_PATH_LEN.
2022-08-17 19:40:00 +02:00
Antoine Poinsot
069bca546a
jsonrpc: don't use a Mutex to share the DaemonControl between threads 2022-08-17 19:39:59 +02:00
Antoine Poinsot
e6fcdd5b09
jsonrpc: don't umask in unit tests
It can interfere with the creation of dummy directories in other threads and cause spurious errors
2022-08-17 19:39:59 +02:00
Antoine Poinsot
eeac67dc0a
qa: shut down the daemon via the JSONRPC interface at teardown 2022-08-17 19:39:58 +02:00
Antoine Poinsot
726209cc0a
jsonrpc: add a 'stop' command
This also implements a simple JSONRPC server sanity check

And introduces a new tmp_dir() test utility, that i didn't have the courage to split from this commit
2022-08-17 19:39:57 +02:00
Antoine Poinsot
d03c469967
Introduce a testutils module with a DummyMinisafe for unit tests
So we can have unit tests without a dummy bitcoind thread, as we
currently do for the startup test.

This commit also implements sanity checks for the two existing commands
using this mechanism.
2022-08-17 19:39:56 +02:00
Antoine Poinsot
e510c0a30d
config: separate the Bitcoin and bitcoind-specifc settings 2022-08-17 19:39:56 +02:00
Antoine Poinsot
ea3595349d
Accept a custom database interface when starting the daemon 2022-08-17 19:39:55 +02:00
Antoine Poinsot
f365effacd
Accept a custom Bitcoin interface when starting the daemon
The Bitcoin interface was thought of as being generic, but a caller
couldn't use one different from bitcoind. Make it so they can, and fix
our trait and generics implementations.
2022-08-17 19:39:55 +02:00
Antoine Poinsot
0d55d6c455
jsonrpc: a simple JSONRPC2 server 2022-08-17 19:39:54 +02:00
Antoine Poinsot
dd1b353a36
commands: derive serde::Serialize for results 2022-08-17 19:39:53 +02:00
Antoine Poinsot
86c1d32662
bitcoin: name the Bitcoin poller thread 2022-08-17 19:39:52 +02:00
Antoine Poinsot
6b2e901814
bit poller: fix a off logged percentage 2022-08-17 19:39:52 +02:00
Antoine Poinsot
6ff43fcd95
daemon: log the name of the current thread, too. 2022-08-17 19:39:51 +02:00
edouard
8b95b9f449 Make commands module public
It allows the gui to import commands
responses structs.
2022-08-15 16:40:11 +02:00
Antoine Poinsot
2609061a69
commands: implement getnewaddress 2022-08-06 10:53:47 +02:00
Antoine Poinsot
8309c85e30
commands: a module for the implementation of the API 2022-08-06 10:53:47 +02:00
Antoine Poinsot
4b659bc35a
lib: introduce a VERSION constant, the daemon version 2022-08-06 10:53:46 +02:00
Antoine Poinsot
fd86cfccee
lib: introduce a daemon controller for the API
This also finalizes the shutdown implementation
2022-08-06 10:53:46 +02:00
Antoine Poinsot
06b009a479
Merge #6: Bitcoin interface poller
dd37255d7b03051aa8924127112ff8fac6c38ff7 bitcoin: update our tip in the poller (Antoine Poinsot)
6997adc073981c3c786ab7e1244330fcc1d7afc7 daemon: bitcoin: introduce the Bitcoin poller (Antoine Poinsot)

Pull request description:

  This introduces the Bitcoin poller, an event loop in a new thread that continuously poll our Bitcoin backend to update our state. This is kept minimal; only introduce the necessary components (Bitcoin interface, DB interface) and as such it only takes care of updating the best tip at the moment.

ACKs for top commit:
  darosior:
    self-ACK dd37255d7b03051aa8924127112ff8fac6c38ff7 -- again, it was inspired and adapted from revaultd, where a similar logic was reviewed and well tested. This PR was tested with the following one, #9.

Tree-SHA512: d630659c75f172754ecfb4df7892d55184b20c848eff4a6184fb45669d57aa87de9377740b5c1bccf7829d859aed8d040c84f3040bb95d478dc41fbd7db157bf
2022-07-30 15:21:10 +02:00
Antoine Poinsot
9b98b0852d
descriptors: a module for users to create our descriptors 2022-07-29 12:16:50 +02:00
Antoine Poinsot
dd37255d7b
bitcoin: update our tip in the poller
This introduces the DB connection in the poller thread
2022-07-27 12:30:53 +02:00
Antoine Poinsot
6997adc073
daemon: bitcoin: introduce the Bitcoin poller 2022-07-27 12:30:52 +02:00
Antoine Poinsot
1f35885087
Merge #5: daemon: remove bitcoind folder
568078aa5bee793e3bbfddedfd42f51daa8aa9ec daemon: remove bitcoind folder (Antoine Poinsot)

Pull request description:

  It was mistakenly committed as part of the introduction of the bitcoind module

ACKs for top commit:
  darosior:
    ACK 568078aa5bee793e3bbfddedfd42f51daa8aa9ec -- trivial

Tree-SHA512: 8083e00bbd7bf71431de100c3d9047f69afc8f768b52eed7a39e7b762160d0567e56ccb874a6400d60fab7703cd79b5ea59ed815494b15a7b77dbace707c5644
2022-07-27 11:40:35 +02:00
Antoine Poinsot
55a79b7751
Merge #3: Functional tests framework
7c3289fda95aa79ca62258f14b7afb28548f5541 tests: add a functional test framework, adapted from revaultd (Antoine Poinsot)
cea72d8a63a247c8bcba39ecd487731d045d75eb bitcoind: don't try to match bitcoind's error string when loading wallet (Antoine Poinsot)
096ad68c4bd1b0332835fdbacb5d540a71646217 bitcoind: correctly check for errors when creating wallet (Antoine Poinsot)
5db59b1c892b82f2778949d2a51093507165b2c0 git: add a gitignore (Antoine Poinsot)

Pull request description:

  This adds a Python functional tests framework, taken and adapted from `revaultd`. Since we don't have a JSONRPC interface yet it only contains a single trivial startup functional test... And 2 bug fixes this trivial test uncovered! :)

  CI integration is still TODO, but it's not critical at the moment and i don't have the heart of fighting with it at the moment (we require a non-standard `bitcoind`).

ACKs for top commit:
  darosior:
    ACK 7c3289fda95aa79ca62258f14b7afb28548f5541 -- mostly adapted from revaultd, and tested with the following PRs rebased on this one.

Tree-SHA512: 95bd8ecfe70b1c7bacd17d10f009ec1bcc0211cb66b9545fa25c70b02a0f12d81e7747fc94c00de62f9aa7de17e7eb95183d8a2ffa659628f40313ef6bc43a1d
2022-07-27 11:39:56 +02:00
Antoine Poinsot
568078aa5b
daemon: remove bitcoind folder
It was mistakenly committed as part of the introduction of the bitcoind module
2022-07-26 15:38:36 +02:00
edouard
0d79a31eb2 fix crate name: minisafe 2022-07-26 10:46:16 +02:00
Antoine Poinsot
cea72d8a63
bitcoind: don't try to match bitcoind's error string when loading wallet
The functional tests uncovered another error. And trying to pattern match any error is brittle. Just explicitly let anything through.
2022-07-25 16:01:04 +02:00
Antoine Poinsot
096ad68c4b
bitcoind: correctly check for errors when creating wallet 2022-07-25 15:59:07 +02:00
Antoine Poinsot
512b5b7d12
daemon: gate startup unit test to UNIX only 2022-07-25 11:37:57 +02:00
Antoine Poinsot
7340c13142
daemon: implement daemonize for UNIX platforms 2022-07-25 11:37:55 +02:00
Antoine Poinsot
c095346e17
Introduce the Bitcoin network interface along with a bitcoind module 2022-07-23 12:49:18 +02:00
Antoine Poinsot
b0196ab529
daemon: introduce an SQLite database
With a schema similar to revaultd, but a different interface.
2022-07-23 12:49:17 +02:00
Antoine Poinsot
989a2cf8fd
daemon: introduce the DaemonHandle, which for now only creates a datadir
This code was mainly taken and adapted from revaultd at commit
7cd856d5a345319cebc815aa61f3b66cebb48b86.
2022-07-23 12:49:16 +02:00
Antoine Poinsot
1b35196448
daemon: backbone and configuration parsing
Taken from revaultd at 7cd856d5a345319cebc815aa61f3b66cebb48b86. Credits
to the revaultd contributors.
2022-07-20 18:42:08 +02:00