[wallet] Verify unconfirmed transactions after syncing

Verify the unconfirmed transactions we download against the consensus
rules. This is currently exposed as an extra `verify` feature, since it
depends on a pre-release version of `bitcoinconsensus`.

Closes #352
This commit is contained in:
Alekos Filini
2021-05-27 16:58:42 +02:00
parent 476fa3fd7d
commit a186d82f9a
12 changed files with 228 additions and 2 deletions

View File

@@ -233,6 +233,7 @@ 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:{:?}",

View File

@@ -362,6 +362,7 @@ fn save_transaction_details_and_utxos<D: BatchDatabase>(
sent: outgoing,
confirmation_time: ConfirmationTime::new(height, timestamp),
fee: Some(inputs_sum.saturating_sub(outputs_sum)), /* if the tx is a coinbase, fees would be negative */
verified: height.is_some(),
};
updates.set_tx(&tx_details)?;