-
Notifications
You must be signed in to change notification settings - Fork 893
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
[ZCash] Fetch consensus branch id from the backend #27089
Conversation
zcash_wallet_service_->zcash_rpc().GetLightdInfo( | ||
chain_id, | ||
base::BindOnce(&ZCashTransactionCompleteManager::OnGetLatestBlockHeight, | ||
base::BindOnce(&ZCashTransactionCompleteManager::OnGetLightdInfo, | ||
weak_ptr_factory_.GetWeakPtr(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How frequently branch id changes? Does it make sense to cache it per browser instance, or persist it per network?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Several times a year i guess, we have to check whether it has been changed anyway
@@ -334,7 +334,6 @@ void ZCashWalletService::CompleteTransactionDone( | |||
result.error()); | |||
return; | |||
} | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need this change?
std::array<uint8_t, kBlake2bPersonalizationSize> result; | ||
uint32_t consensusBranchId = tx.consensus_brach_id(); | ||
base::span(result) | ||
.subspan(0, sizeof(kTxHashPersonalizerPrefix) - 1) | ||
.copy_from(base::byte_span_from_cstring(kTxHashPersonalizerPrefix)); | ||
base::span(result) | ||
.subspan(sizeof(kTxHashPersonalizerPrefix) - 1, sizeof(consensusBranchId)) | ||
.copy_from(base::byte_span_from_ref(base::numerics::U32FromLittleEndian( | ||
base::byte_span_from_ref(consensusBranchId)))); | ||
return result; | ||
} | ||
|
||
} // namespace | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That should be done with SpanWriter
something like
auto span_writer = base::SpanWriter(base::span(result));
span_writer.Write(base::byte_span_from_cstring(kTxHashPersonalizerPrefix));
span_writer.WriteU32LittleEndian(tx.consensus_brach_id())
DCHECK_EQ(span_writer.remaining(), 0u);
@@ -10,6 +10,7 @@ | |||
#include <utility> | |||
|
|||
#include "base/containers/span.h" | |||
#include "base/containers/to_vector.h" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
#include "base/containers/to_vector.h"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wallet core lgtm
Released in v1.75.122 |
* [ZCash] Fetch consensus branch id from the backend Resolves brave/brave-browser#42951
* [ZCash] Fetch consensus branch id from the backend Resolves brave/brave-browser#42951
Resolves brave/brave-browser#42951
Testplan :
Test transparent transactions to be working
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan: