Skip to content

Commit

Permalink
Review fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cypt4 committed Dec 24, 2024
1 parent d082456 commit 4ea3834
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
14 changes: 5 additions & 9 deletions components/brave_wallet/browser/zcash/zcash_serializer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include <utility>

#include "base/containers/span.h"
#include "base/containers/to_vector.h"
#include "base/containers/span_writer.h"
#include "base/numerics/byte_conversions.h"
#include "brave/components/brave_wallet/common/btc_like_serializer_stream.h"
#include "brave/components/brave_wallet/common/hex_utils.h"
Expand Down Expand Up @@ -94,14 +94,10 @@ std::array<uint8_t, 32> HashScriptPubKeys(const ZCashTransaction& tx) {
std::array<uint8_t, kBlake2bPersonalizationSize> GetHashPersonalizer(
const ZCashTransaction& tx) {
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))));
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);
return result;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -334,6 +334,7 @@ void ZCashWalletService::CompleteTransactionDone(
result.error());
return;
}

auto tx = ZCashSerializer::SerializeRawTransaction(result.value());
zcash_rpc_->SendTransaction(
chain_id, tx,
Expand Down

0 comments on commit 4ea3834

Please sign in to comment.