Skip to content

Commit

Permalink
Set tx field to none if include_raw is false
Browse files Browse the repository at this point in the history
`del_tx` pulls the TransactionDetails object using
`select_transaction_details_by_txid` method which gets the transaction
details' data with a non-None transaction field even if the
`include_raw` argument is `false`. So it becomes necessary to Set
the transaction field in transactiondetails to None in `del_tx`, when
we make a call to it with `include_raw=false`.
  • Loading branch information
vladimirfomene committed Sep 13, 2022
1 parent 06310f1 commit e06c3f9
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/database/sqlite.rs
Original file line number Diff line number Diff line change
Expand Up @@ -744,11 +744,13 @@ impl BatchOperations for SqliteDatabase {
include_raw: bool,
) -> Result<Option<TransactionDetails>, Error> {
match self.select_transaction_details_by_txid(txid)? {
Some(transaction_details) => {
Some(mut transaction_details) => {
self.delete_transaction_details_by_txid(txid)?;

if include_raw {
self.delete_transaction_by_txid(txid)?;
} else {
transaction_details.transaction = None;
}
Ok(Some(transaction_details))
}
Expand Down

0 comments on commit e06c3f9

Please sign in to comment.