34 Commits

Author SHA1 Message Date
LLFourn
c0e75fc1a8
Split get_tx into its own trait
to make supporting verify_tx easier
2022-02-24 20:39:00 +11:00
LLFourn
410a51355b
Add SyncOptions as the second argument to Wallet::sync
The current options are awkward and it would be good if we could
introduce more in the future without breaking changes.
2022-02-24 20:39:00 +11:00
LLFourn
326bfe82a8
Remove Blockchain from wallet
Although somewhat convenient to have, coupling the Wallet with
the blockchain trait causes development friction and complexity.
What if sometimes the wallet is "offline" (no access to the blockchain)
but sometimes its online?
The only thing the Wallet needs the blockchain for is to sync.
But not all applications will even use the sync method and the sync
method doesn't require the full blockchain functionality.
So we instead pass the blockchain in when we want to sync.

- To further reduce the coupling with blockchain I removed the get_height call from `new` and just use the height of the
last sync in the database.
- I split up the blockchain trait a bit into subtraits.
2022-02-24 20:39:00 +11:00
Daniela Brozzoni
bfd0d13779
[blockchain] Fix sent calculation in the RPC backend
We used to consider a tx input as ours if we had the
tx that creates it in the database.
This commit actually checks if an input is ours before adding
its value to the `sent` field.
2022-02-18 12:54:51 +01:00
Daniela Brozzoni
128c37595c
[tests] Pass tx inputs to the testutils macro 2022-02-18 12:54:51 +01:00
James Taylor
bf5994b14a
fixed fee in test, removed unnecessary comment 2021-12-19 18:37:05 -05:00
LLFourn
a630685a0a
Merge branch 'master' into sync_pipeline 2021-11-23 12:53:40 +11:00
Steve Myers
afa1ab4ff8
Fix blockchain_tests::test_send_to_bech32m_addr
Now works with latest released versions of rust-bitcoincore-rpc and
bitcoind. Once these crates are updated to support creating descriptor
wallets and add importdescriptors and bech32m support this test will
need to be updated.
2021-11-11 13:59:11 -08:00
Sandipan Dey
632422a3ab
Added wallet blockchain test to send to Bech32m address 2021-11-11 08:20:40 -08:00
Alekos Filini
7c06f52a07
[wallet] Store the block height and timestamp after syncing
Closes #455
2021-11-10 12:30:02 +01:00
LLFourn
3f5cb6997f
Invert dependencies in electrum sync
Blockchain calls sync logic rather than the other way around.
Sync logic is captured in script_sync.rs.
2021-11-10 09:06:49 +11:00
Riccardo Casatta
aa075f0b2f
fix after merge changing borrow of tx in broadcast 2021-11-09 15:37:18 +01:00
Riccardo Casatta
b2d7412d6d
add test for add_data 2021-11-09 15:36:42 +01:00
Steve Myers
7f91bcdf1a
Merge commit 'refs/pull/453/head' of github.com:bitcoindevkit/bdk 2021-11-03 13:51:59 -07:00
Steve Myers
ee8b992f8b
Update dev-dependencies electrsd to 0.12 2021-10-27 13:42:01 -07:00
Mariusz Klochowicz
3d8efbf8bf
Borrow instead of moving transaction when broadcasting
There's no need to take ownership of the transaction for a broadcast.
2021-10-27 21:51:55 +10:30
Steve Myers
ea56a87b4b
Change dependencies bitcoincore-rpc to core-rpc, update bitcoin to ^0.27 and miniscript to ^6.0 2021-08-17 22:52:17 +02:00
Riccardo Casatta
f57c0ca98e
in tests enable daemons logging if log level is Debug 2021-08-03 12:15:16 +02:00
Riccardo Casatta
ad69702aa3
Update electrsd dep 2021-07-26 17:09:00 +02:00
Riccardo Casatta
a6be470fe4
use electrsd with feature to download the binary 2021-06-29 11:34:58 +02:00
Riccardo Casatta
8e41c4587d
use bitcoind with feature to download the binary 2021-06-29 11:34:56 +02:00
Riccardo Casatta
2ecae348ea
use cfg! instead of #[cfg] and use semver 2021-06-29 11:34:54 +02:00
Riccardo Casatta
f4ecfa0d49
Remove container and test blockchains downloading backends executables 2021-06-29 11:34:48 +02:00
Riccardo Casatta
696647b893
trigger electrs when polling 2021-06-29 11:32:30 +02:00
Riccardo Casatta
18dcda844f
remove serial_test 2021-06-29 11:32:28 +02:00
Riccardo Casatta
6394c3e209
use bitcoind and electrsd crate to launch daemons 2021-06-29 11:32:26 +02:00
Alekos Filini
4498e0f7f8
[testutils] Allow the generated blockchain tests to access test_client 2021-06-29 11:32:20 +02:00
Riccardo Casatta
0bbfa5f989
make fee in TransactionDetails Option, add confirmation_time field as Option
confirmation_time contains both a block height and block timestamp and is
Some only for confirmed transaction
2021-06-14 15:29:24 +02:00
Riccardo Casatta
e1b037a921
change feature to execute sync from rpc to test-rpc 2021-06-03 10:56:01 +02:00
Riccardo Casatta
bfef2e3cfe
Implements RPC Backend 2021-06-03 10:55:58 +02:00
Paul Miller
6b60914ca1
return AddressInfo from get_address 2021-05-27 17:11:16 -04:00
LLFourn
ea8488b2a7
Initialize env_logger at start of blockchain tests 2021-05-21 13:21:59 +10:00
LLFourn
38b0470b14
Move blockchain related stuff to blockchain_tests 2021-05-19 16:45:48 +10:00
LLFourn
d60c5003bf
Merge testutils crate into the main crate
This avoids having to keep the apis in sync between the macros and the
main project.
2021-05-19 16:45:48 +10:00