From 98a3b3282a0ff59bbdf900adc765f6912d1975c1 Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 16 Dec 2021 20:51:18 +0530 Subject: [PATCH 01/11] Remove sync verification The default sync verification is removed from wallet module. By default sync time verification only makes sense for `electrum` and `esplora` backend as they are usually untrusted 3rd party services. script verification for transaction is costly, so removing default script verification optimizes performance. --- src/wallet/mod.rs | 17 ----------------- 1 file changed, 17 deletions(-) diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index bf7993d4..8c3c968b 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -1537,23 +1537,6 @@ where .sync(self.database.borrow_mut().deref_mut(), progress_update,))?; } - #[cfg(feature = "verify")] - { - debug!("Verifying transactions..."); - for mut tx in self.database.borrow().iter_txs(true)? { - if !tx.verified { - verify::verify_tx( - tx.transaction.as_ref().ok_or(Error::TransactionNotFound)?, - self.database.borrow().deref(), - &self.client, - )?; - - tx.verified = true; - self.database.borrow_mut().set_tx(&tx)?; - } - } - } - let sync_time = SyncTime { block_time: BlockTime { height: maybe_await!(self.client.get_height())?, From 4761155707a819c4db437e71a36621a027d5302a Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 16 Dec 2021 20:53:16 +0530 Subject: [PATCH 02/11] Add sync verification in `electrum` --- src/blockchain/electrum.rs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/blockchain/electrum.rs b/src/blockchain/electrum.rs index cb079a87..9ebde989 100644 --- a/src/blockchain/electrum.rs +++ b/src/blockchain/electrum.rs @@ -175,6 +175,7 @@ impl Blockchain for ElectrumBlockchain { let full_details = full_transactions .into_iter() .map(|tx| { + let mut input_index = 0usize; let prev_outputs = tx .input .iter() @@ -189,6 +190,20 @@ impl Blockchain for ElectrumBlockchain { .output .get(input.previous_output.vout as usize) .ok_or_else(electrum_goof)?; + // Verify this input if requested via feature flag + #[cfg(feature = "verify")] + { + use crate::wallet::verify::VerifyError; + let serialized_tx = bitcoin::consensus::serialize(&tx); + bitcoinconsensus::verify( + txout.script_pubkey.to_bytes().as_ref(), + txout.value, + &serialized_tx, + input_index, + ) + .map_err(|e| VerifyError::from(e))?; + } + input_index += 1; Ok(Some(txout.clone())) }) .collect::, Error>>()?; From acbf0ae08e0732579652aece9bc48169351884cf Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 16 Dec 2021 20:57:28 +0530 Subject: [PATCH 03/11] Add sync verification for `esplora` --- src/blockchain/esplora/reqwest.rs | 22 ++++++++++++++++++++-- src/blockchain/esplora/ureq.rs | 22 ++++++++++++++++++++-- 2 files changed, 40 insertions(+), 4 deletions(-) diff --git a/src/blockchain/esplora/reqwest.rs b/src/blockchain/esplora/reqwest.rs index aaf487e4..f1f39f9d 100644 --- a/src/blockchain/esplora/reqwest.rs +++ b/src/blockchain/esplora/reqwest.rs @@ -167,9 +167,27 @@ impl Blockchain for EsploraBlockchain { .request() .map(|txid| { let tx = tx_index.get(txid).expect("must be in index"); - (tx.previous_outputs(), tx.to_tx()) + // Verify this transaction if requested via feature flag + #[cfg(feature = "verify")] + { + use crate::wallet::verify::VerifyError; + let prev_outs = tx.previous_outputs(); + let tx_bytes = serialize(&tx.to_tx()); + for (index, output) in prev_outs.iter().enumerate() { + if let Some(output) = output { + bitcoinconsensus::verify( + output.script_pubkey.to_bytes().as_ref(), + output.value, + &tx_bytes, + index, + ) + .map_err(|e| VerifyError::from(e))?; + } + } + } + Ok((tx.previous_outputs(), tx.to_tx())) }) - .collect(); + .collect::>()?; tx_req.satisfy(full_txs)? } Request::Finish(batch_update) => break batch_update, diff --git a/src/blockchain/esplora/ureq.rs b/src/blockchain/esplora/ureq.rs index f3895a15..a32d8137 100644 --- a/src/blockchain/esplora/ureq.rs +++ b/src/blockchain/esplora/ureq.rs @@ -166,9 +166,27 @@ impl Blockchain for EsploraBlockchain { .request() .map(|txid| { let tx = tx_index.get(txid).expect("must be in index"); - (tx.previous_outputs(), tx.to_tx()) + // Verify this transaction if requested via feature flag + #[cfg(feature = "verify")] + { + use crate::wallet::verify::VerifyError; + let prev_outs = tx.previous_outputs(); + let tx_bytes = serialize(&tx.to_tx()); + for (index, output) in prev_outs.iter().enumerate() { + if let Some(output) = output { + bitcoinconsensus::verify( + output.script_pubkey.to_bytes().as_ref(), + output.value, + &tx_bytes, + index, + ) + .map_err(|e| VerifyError::from(e))?; + } + } + } + Ok((tx.previous_outputs(), tx.to_tx())) }) - .collect(); + .collect::>()?; tx_req.satisfy(full_txs)? } Request::Finish(batch_update) => break batch_update, From 08f312a82f889f6bf5dfedfaa565ac2cb59683ae Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 16 Dec 2021 21:06:59 +0530 Subject: [PATCH 04/11] Remove `verify` flag from `TransactionDetails` --- src/blockchain/rpc.rs | 1 - src/blockchain/script_sync.rs | 1 - src/database/memory.rs | 1 - src/database/mod.rs | 1 - src/types.rs | 9 --------- src/wallet/export.rs | 1 - src/wallet/mod.rs | 1 - 7 files changed, 15 deletions(-) diff --git a/src/blockchain/rpc.rs b/src/blockchain/rpc.rs index 5c9ee2dd..74ef8262 100644 --- a/src/blockchain/rpc.rs +++ b/src/blockchain/rpc.rs @@ -271,7 +271,6 @@ impl Blockchain for RpcBlockchain { received, sent, fee: tx_result.fee.map(|f| f.as_sat().abs() as u64), - verified: true, }; debug!( "saving tx: {} tx_result.fee:{:?} td.fees:{:?}", diff --git a/src/blockchain/script_sync.rs b/src/blockchain/script_sync.rs index 4c9b0222..0d450ef1 100644 --- a/src/blockchain/script_sync.rs +++ b/src/blockchain/script_sync.rs @@ -214,7 +214,6 @@ impl<'a, D: BatchDatabase> TxReq<'a, D> { // we're going to fill this in later confirmation_time: None, fee: Some(fee), - verified: false, }) }) .collect::, _>>()?; diff --git a/src/database/memory.rs b/src/database/memory.rs index 916ddcba..afde6fee 100644 --- a/src/database/memory.rs +++ b/src/database/memory.rs @@ -515,7 +515,6 @@ macro_rules! populate_test_db { received: 0, sent: 0, confirmation_time, - verified: current_height.is_some(), }; db.set_tx(&tx_details).unwrap(); diff --git a/src/database/mod.rs b/src/database/mod.rs index b0b9c9ea..2318dcc9 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -348,7 +348,6 @@ pub mod test { timestamp: 123456, height: 1000, }), - verified: true, }; tree.set_tx(&tx_details).unwrap(); diff --git a/src/types.rs b/src/types.rs index f9f34427..eadfc57b 100644 --- a/src/types.rs +++ b/src/types.rs @@ -211,15 +211,6 @@ pub struct TransactionDetails { /// If the transaction is confirmed, contains height and timestamp of the block containing the /// transaction, unconfirmed transaction contains `None`. pub confirmation_time: Option, - /// Whether the tx has been verified against the consensus rules - /// - /// Confirmed txs are considered "verified" by default, while unconfirmed txs are checked to - /// ensure an unstrusted [`Blockchain`](crate::blockchain::Blockchain) backend can't trick the - /// wallet into using an invalid tx as an RBF template. - /// - /// The check is only performed when the `verify` feature is enabled. - #[serde(default = "bool::default")] // default to `false` if not specified - pub verified: bool, } /// Block height and timestamp of a block diff --git a/src/wallet/export.rs b/src/wallet/export.rs index e39d178e..85898345 100644 --- a/src/wallet/export.rs +++ b/src/wallet/export.rs @@ -230,7 +230,6 @@ mod test { timestamp: 12345678, height: 5000, }), - verified: true, }) .unwrap(); diff --git a/src/wallet/mod.rs b/src/wallet/mod.rs index 8c3c968b..a24f922d 100644 --- a/src/wallet/mod.rs +++ b/src/wallet/mod.rs @@ -712,7 +712,6 @@ where received, sent, fee: Some(fee_amount), - verified: true, }; Ok((psbt, transaction_details)) From 61a95d0d15b9944e8b5d13db64ef6ffd9a8d6e29 Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Thu, 16 Dec 2021 22:46:44 +0530 Subject: [PATCH 05/11] Update changelog --- CHANGELOG.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6f7dece9..4a70b111 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -18,6 +18,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Overhauled sync logic for electrum and esplora. - Unify ureq and reqwest esplora backends to have the same configuration parameters. This means reqwest now has a timeout parameter and ureq has a concurrency parameter. - Fixed esplora fee estimation. +- Fixed generating WIF in the correct network format. +- Disable `reqwest` default features. +- Added `reqwest-default-tls` feature: Use this to restore the TLS defaults of reqwest if you don't want to add a dependency to it in your own manifest. +- Removed default verification from `wallet::sync`. `sync` verification is added only for `electrum` and +`esplora` blockchains. No `sync` verification for `rpc`. `verify_tx()` is refactored as an wallet api. +`verify` flag removed from `TransactionDetails`. ## [v0.14.0] - [v0.13.0] From 6a09075d1a87509e9117eab727132efdf8ea6e1d Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Sun, 2 Jan 2022 14:22:10 +0530 Subject: [PATCH 06/11] Remove verify flag from sqlite DB --- src/database/sqlite.rs | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index 597ef654..a01a7be3 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -29,7 +29,7 @@ static MIGRATIONS: &[&str] = &[ "CREATE INDEX idx_txid_vout ON utxos(txid, vout);", "CREATE TABLE transactions (txid BLOB, raw_tx BLOB);", "CREATE INDEX idx_txid ON transactions(txid);", - "CREATE TABLE transaction_details (txid BLOB, timestamp INTEGER, received INTEGER, sent INTEGER, fee INTEGER, height INTEGER, verified INTEGER DEFAULT 0);", + "CREATE TABLE transaction_details (txid BLOB, timestamp INTEGER, received INTEGER, sent INTEGER, fee INTEGER, height INTEGER);", "CREATE INDEX idx_txdetails_txid ON transaction_details(txid);", "CREATE TABLE last_derivation_indices (keychain TEXT, value INTEGER);", "CREATE UNIQUE INDEX idx_indices_keychain ON last_derivation_indices(keychain);", @@ -127,7 +127,7 @@ impl SqliteDatabase { let txid: &[u8] = &transaction.txid; - let mut statement = self.connection.prepare_cached("INSERT INTO transaction_details (txid, timestamp, received, sent, fee, height, verified) VALUES (:txid, :timestamp, :received, :sent, :fee, :height, :verified)")?; + let mut statement = self.connection.prepare_cached("INSERT INTO transaction_details (txid, timestamp, received, sent, fee, height) VALUES (:txid, :timestamp, :received, :sent, :fee, :height)")?; statement.execute(named_params! { ":txid": txid, @@ -136,7 +136,6 @@ impl SqliteDatabase { ":sent": transaction.sent, ":fee": transaction.fee, ":height": height, - ":verified": transaction.verified })?; Ok(self.connection.last_insert_rowid()) @@ -153,7 +152,7 @@ impl SqliteDatabase { let txid: &[u8] = &transaction.txid; - let mut statement = self.connection.prepare_cached("UPDATE transaction_details SET timestamp=:timestamp, received=:received, sent=:sent, fee=:fee, height=:height, verified=:verified WHERE txid=:txid")?; + let mut statement = self.connection.prepare_cached("UPDATE transaction_details SET timestamp=:timestamp, received=:received, sent=:sent, fee=:fee, height=:height WHERE txid=:txid")?; statement.execute(named_params! { ":txid": txid, @@ -162,7 +161,6 @@ impl SqliteDatabase { ":sent": transaction.sent, ":fee": transaction.fee, ":height": height, - ":verified": transaction.verified, })?; Ok(()) @@ -367,7 +365,7 @@ impl SqliteDatabase { } fn select_transaction_details_with_raw(&self) -> Result, Error> { - let mut statement = self.connection.prepare_cached("SELECT transaction_details.txid, transaction_details.timestamp, transaction_details.received, transaction_details.sent, transaction_details.fee, transaction_details.height, transaction_details.verified, transactions.raw_tx FROM transaction_details, transactions WHERE transaction_details.txid = transactions.txid")?; + let mut statement = self.connection.prepare_cached("SELECT transaction_details.txid, transaction_details.timestamp, transaction_details.received, transaction_details.sent, transaction_details.fee, transaction_details.height, transactions.raw_tx FROM transaction_details, transactions WHERE transaction_details.txid = transactions.txid")?; let mut transaction_details: Vec = vec![]; let mut rows = statement.query([])?; while let Some(row) = rows.next()? { @@ -378,7 +376,6 @@ impl SqliteDatabase { let sent: u64 = row.get(3)?; let fee: Option = row.get(4)?; let height: Option = row.get(5)?; - let verified: bool = row.get(6)?; let raw_tx: Option> = row.get(7)?; let tx: Option = match raw_tx { Some(raw_tx) => { @@ -400,7 +397,6 @@ impl SqliteDatabase { sent, fee, confirmation_time, - verified, }); } Ok(transaction_details) @@ -408,7 +404,7 @@ impl SqliteDatabase { fn select_transaction_details(&self) -> Result, Error> { let mut statement = self.connection.prepare_cached( - "SELECT txid, timestamp, received, sent, fee, height, verified FROM transaction_details", + "SELECT txid, timestamp, received, sent, fee, height FROM transaction_details", )?; let mut transaction_details: Vec = vec![]; let mut rows = statement.query([])?; @@ -420,7 +416,6 @@ impl SqliteDatabase { let sent: u64 = row.get(3)?; let fee: Option = row.get(4)?; let height: Option = row.get(5)?; - let verified: bool = row.get(6)?; let confirmation_time = match (height, timestamp) { (Some(height), Some(timestamp)) => Some(BlockTime { height, timestamp }), @@ -434,7 +429,6 @@ impl SqliteDatabase { sent, fee, confirmation_time, - verified, }); } Ok(transaction_details) @@ -444,7 +438,7 @@ impl SqliteDatabase { &self, txid: &[u8], ) -> Result, Error> { - let mut statement = self.connection.prepare_cached("SELECT transaction_details.timestamp, transaction_details.received, transaction_details.sent, transaction_details.fee, transaction_details.height, transaction_details.verified, transactions.raw_tx FROM transaction_details, transactions WHERE transaction_details.txid=transactions.txid AND transaction_details.txid=:txid")?; + let mut statement = self.connection.prepare_cached("SELECT transaction_details.timestamp, transaction_details.received, transaction_details.sent, transaction_details.fee, transaction_details.height, transactions.raw_tx FROM transaction_details, transactions WHERE transaction_details.txid=transactions.txid AND transaction_details.txid=:txid")?; let mut rows = statement.query(named_params! { ":txid": txid })?; match rows.next()? { @@ -454,9 +448,8 @@ impl SqliteDatabase { let sent: u64 = row.get(2)?; let fee: Option = row.get(3)?; let height: Option = row.get(4)?; - let verified: bool = row.get(5)?; - let raw_tx: Option> = row.get(6)?; + let raw_tx: Option> = row.get(5)?; let tx: Option = match raw_tx { Some(raw_tx) => { let tx: Transaction = deserialize(&raw_tx)?; @@ -477,7 +470,6 @@ impl SqliteDatabase { sent, fee, confirmation_time, - verified, })) } None => Ok(None), From 53c30b0479c74dde17cd27f8eac7f540e492067d Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Sun, 2 Jan 2022 14:22:39 +0530 Subject: [PATCH 07/11] Add verification tests in CI --- .github/workflows/cont_integration.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cont_integration.yml b/.github/workflows/cont_integration.yml index bab633dd..5bf54f07 100644 --- a/.github/workflows/cont_integration.yml +++ b/.github/workflows/cont_integration.yml @@ -89,13 +89,13 @@ jobs: matrix: blockchain: - name: electrum - features: test-electrum + features: test-electrum,verify - name: rpc features: test-rpc - name: esplora - features: test-esplora,use-esplora-reqwest + features: test-esplora,use-esplora-reqwest,verify - name: esplora - features: test-esplora,use-esplora-ureq + features: test-esplora,use-esplora-ureq,verify steps: - name: Checkout uses: actions/checkout@v2 From b05ee78c7335f7e3a1593dc4ff7686e6f72ff5c0 Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Sun, 2 Jan 2022 15:14:32 +0530 Subject: [PATCH 08/11] Remove verifcation flag from compact_filters --- src/blockchain/compact_filters/mod.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/src/blockchain/compact_filters/mod.rs b/src/blockchain/compact_filters/mod.rs index 93b5316c..56e9efc3 100644 --- a/src/blockchain/compact_filters/mod.rs +++ b/src/blockchain/compact_filters/mod.rs @@ -207,7 +207,6 @@ impl CompactFiltersBlockchain { received: incoming, sent: outgoing, confirmation_time: BlockTime::new(height, timestamp), - verified: height.is_some(), fee: Some(inputs_sum.saturating_sub(outputs_sum)), }; From 1d7ea89d8a792013212b1d269895b02fe3b410bd Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Fri, 21 Jan 2022 21:43:05 +0530 Subject: [PATCH 09/11] Refactor sync time verification Instead of verifying txs at sync time in every backend, its moved to script_sync to by default be available to any backend. --- src/blockchain/electrum.rs | 13 ------------- src/blockchain/esplora/reqwest.rs | 18 ------------------ src/blockchain/esplora/ureq.rs | 18 ------------------ src/blockchain/script_sync.rs | 18 ++++++++++++++++-- 4 files changed, 16 insertions(+), 51 deletions(-) diff --git a/src/blockchain/electrum.rs b/src/blockchain/electrum.rs index 9ebde989..1ab0db1c 100644 --- a/src/blockchain/electrum.rs +++ b/src/blockchain/electrum.rs @@ -190,19 +190,6 @@ impl Blockchain for ElectrumBlockchain { .output .get(input.previous_output.vout as usize) .ok_or_else(electrum_goof)?; - // Verify this input if requested via feature flag - #[cfg(feature = "verify")] - { - use crate::wallet::verify::VerifyError; - let serialized_tx = bitcoin::consensus::serialize(&tx); - bitcoinconsensus::verify( - txout.script_pubkey.to_bytes().as_ref(), - txout.value, - &serialized_tx, - input_index, - ) - .map_err(|e| VerifyError::from(e))?; - } input_index += 1; Ok(Some(txout.clone())) }) diff --git a/src/blockchain/esplora/reqwest.rs b/src/blockchain/esplora/reqwest.rs index f1f39f9d..494c6d30 100644 --- a/src/blockchain/esplora/reqwest.rs +++ b/src/blockchain/esplora/reqwest.rs @@ -167,24 +167,6 @@ impl Blockchain for EsploraBlockchain { .request() .map(|txid| { let tx = tx_index.get(txid).expect("must be in index"); - // Verify this transaction if requested via feature flag - #[cfg(feature = "verify")] - { - use crate::wallet::verify::VerifyError; - let prev_outs = tx.previous_outputs(); - let tx_bytes = serialize(&tx.to_tx()); - for (index, output) in prev_outs.iter().enumerate() { - if let Some(output) = output { - bitcoinconsensus::verify( - output.script_pubkey.to_bytes().as_ref(), - output.value, - &tx_bytes, - index, - ) - .map_err(|e| VerifyError::from(e))?; - } - } - } Ok((tx.previous_outputs(), tx.to_tx())) }) .collect::>()?; diff --git a/src/blockchain/esplora/ureq.rs b/src/blockchain/esplora/ureq.rs index a32d8137..856f6958 100644 --- a/src/blockchain/esplora/ureq.rs +++ b/src/blockchain/esplora/ureq.rs @@ -166,24 +166,6 @@ impl Blockchain for EsploraBlockchain { .request() .map(|txid| { let tx = tx_index.get(txid).expect("must be in index"); - // Verify this transaction if requested via feature flag - #[cfg(feature = "verify")] - { - use crate::wallet::verify::VerifyError; - let prev_outs = tx.previous_outputs(); - let tx_bytes = serialize(&tx.to_tx()); - for (index, output) in prev_outs.iter().enumerate() { - if let Some(output) = output { - bitcoinconsensus::verify( - output.script_pubkey.to_bytes().as_ref(), - output.value, - &tx_bytes, - index, - ) - .map_err(|e| VerifyError::from(e))?; - } - } - } Ok((tx.previous_outputs(), tx.to_tx())) }) .collect::>()?; diff --git a/src/blockchain/script_sync.rs b/src/blockchain/script_sync.rs index 0d450ef1..6fd3b9c8 100644 --- a/src/blockchain/script_sync.rs +++ b/src/blockchain/script_sync.rs @@ -178,7 +178,9 @@ impl<'a, D: BatchDatabase> TxReq<'a, D> { let mut inputs_sum: u64 = 0; let mut outputs_sum: u64 = 0; - for (txout, input) in vout.into_iter().zip(tx.input.iter()) { + for (txout, (_input_index, input)) in + vout.into_iter().zip(tx.input.iter().enumerate()) + { let txout = match txout { Some(txout) => txout, None => { @@ -190,7 +192,19 @@ impl<'a, D: BatchDatabase> TxReq<'a, D> { continue; } }; - + // Verify this input if requested via feature flag + #[cfg(feature = "verify")] + { + use crate::wallet::verify::VerifyError; + let serialized_tx = bitcoin::consensus::serialize(&tx); + bitcoinconsensus::verify( + txout.script_pubkey.to_bytes().as_ref(), + txout.value, + &serialized_tx, + _input_index, + ) + .map_err(VerifyError::from)?; + } inputs_sum += txout.value; if self.state.db.is_mine(&txout.script_pubkey)? { sent += txout.value; From 0195bc0636d9a58013f0cbc3781d213b0cfc1509 Mon Sep 17 00:00:00 2001 From: rajarshimaitra Date: Fri, 11 Feb 2022 22:08:17 +0530 Subject: [PATCH 10/11] Update CHANGELOG --- CHANGELOG.md | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4a70b111..409bc50c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +- Removed default verification from `wallet::sync`. sync-time verification is added in `script_sync` and is activated by `verify` feature flag. +- `verify` flag removed from `TransactionDetails`. + ## [v0.16.0] - [v0.15.0] - Disable `reqwest` default features. @@ -18,12 +21,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Overhauled sync logic for electrum and esplora. - Unify ureq and reqwest esplora backends to have the same configuration parameters. This means reqwest now has a timeout parameter and ureq has a concurrency parameter. - Fixed esplora fee estimation. -- Fixed generating WIF in the correct network format. -- Disable `reqwest` default features. -- Added `reqwest-default-tls` feature: Use this to restore the TLS defaults of reqwest if you don't want to add a dependency to it in your own manifest. -- Removed default verification from `wallet::sync`. `sync` verification is added only for `electrum` and -`esplora` blockchains. No `sync` verification for `rpc`. `verify_tx()` is refactored as an wallet api. -`verify` flag removed from `TransactionDetails`. ## [v0.14.0] - [v0.13.0] From 1999d97aeb3d97ee24a9b59a2f1453a26943b595 Mon Sep 17 00:00:00 2001 From: Steve Myers Date: Mon, 21 Feb 2022 14:06:15 -0800 Subject: [PATCH 11/11] Remove `verify` flag from `TransactionDetails` via new MIGRATIONS --- src/database/sqlite.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/database/sqlite.rs b/src/database/sqlite.rs index a01a7be3..b9c639bd 100644 --- a/src/database/sqlite.rs +++ b/src/database/sqlite.rs @@ -29,13 +29,17 @@ static MIGRATIONS: &[&str] = &[ "CREATE INDEX idx_txid_vout ON utxos(txid, vout);", "CREATE TABLE transactions (txid BLOB, raw_tx BLOB);", "CREATE INDEX idx_txid ON transactions(txid);", - "CREATE TABLE transaction_details (txid BLOB, timestamp INTEGER, received INTEGER, sent INTEGER, fee INTEGER, height INTEGER);", + "CREATE TABLE transaction_details (txid BLOB, timestamp INTEGER, received INTEGER, sent INTEGER, fee INTEGER, height INTEGER, verified INTEGER DEFAULT 0);", "CREATE INDEX idx_txdetails_txid ON transaction_details(txid);", "CREATE TABLE last_derivation_indices (keychain TEXT, value INTEGER);", "CREATE UNIQUE INDEX idx_indices_keychain ON last_derivation_indices(keychain);", "CREATE TABLE checksums (keychain TEXT, checksum BLOB);", "CREATE INDEX idx_checksums_keychain ON checksums(keychain);", - "CREATE TABLE sync_time (id INTEGER PRIMARY KEY, height INTEGER, timestamp INTEGER);" + "CREATE TABLE sync_time (id INTEGER PRIMARY KEY, height INTEGER, timestamp INTEGER);", + "ALTER TABLE transaction_details RENAME TO transaction_details_old;", + "CREATE TABLE transaction_details (txid BLOB, timestamp INTEGER, received INTEGER, sent INTEGER, fee INTEGER, height INTEGER);", + "INSERT INTO transaction_details SELECT txid, timestamp, received, sent, fee, height FROM transaction_details_old;", + "DROP TABLE transaction_details_old;", ]; /// Sqlite database stored on filesystem