Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upgrade to handle v5 transactions #28

Merged
19 commits merged into from
Nov 11, 2023
Merged

Upgrade to handle v5 transactions #28

19 commits merged into from
Nov 11, 2023

Conversation

IdaTucker
Copy link
Contributor

@IdaTucker IdaTucker commented Apr 27, 2023

🔗 zboto Link

@IdaTucker IdaTucker requested review from a user, ftheirs and jleni April 27, 2023 14:25
let hex_tx_version = match tx_version {
TxVersion::Zip225 => 0x05,
TxVersion::Sapling => 0x04,
_ => 0x04, //todo: what should the default be?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Due to it being an enum it represents all the possible values, but the app doesn't support it all, so you should return an error instead of having this default

progress_notifier.as_ref().map(|tx| tx.send(progress));
if let Some(sender) = progress_notifier.as_ref() {
// If the send fails, we should ignore the error, not crash.
sender.send(Progress::new(progress, None)).unwrap_or(());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you want to ignore the error just let _ = ... instead, it's the conventional way to ignore erros

@@ -41,7 +41,8 @@ rand_core = "0.6"
ripemd = "0.1"
secp256k1 = { version = "0.21" }
sha2 = "0.9"

log4rs = "1"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

unused - but should be used for binaries, not libraries (in that case log should be used)

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also chrono seems unused

@@ -137,7 +143,7 @@ where
pub fn transaction_data(&self) -> Option<TransactionData<A>> {
self.cached_branchid.map(|consensus_branch_id| {
TransactionData::from_parts(
transaction::TxVersion::Sapling,
self.cached_tx_version.expect("No tx version provided"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

avoid the panic here, rather return None if cached_tx is none, just like we would with cached_branchid

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

progress_notifier.as_ref().map(|tx| tx.send(progress));
if let Some(sender) = progress_notifier.as_ref() {
// If the send fails, we should ignore the error, not crash.
sender.send(Progress::new(progress, None)).unwrap_or(());
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

@@ -832,7 +880,7 @@ impl<P: consensus::Parameters, R: RngCore + CryptoRng>
fn transaction_data_authorized(&self) -> Option<TransactionData<transaction::Authorized>> {
self.cached_branchid.map(|consensus_branch_id| {
TransactionData::from_parts(
transaction::TxVersion::Sapling,
self.cached_tx_version.expect("No tx version provided"),
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same as above, zip and return None if it's missing

@ghost ghost self-requested a review November 11, 2023 11:24
@ghost
Copy link

ghost commented Nov 11, 2023

Also includes ZIP-0317

@ghost ghost merged commit febfcf7 into main Nov 11, 2023
3 checks passed
@ghost ghost deleted the ledger-v5 branch November 11, 2023 11:24
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants