diff --git a/components/brave_wallet/browser/zcash/zcash_serializer.cc b/components/brave_wallet/browser/zcash/zcash_serializer.cc index 28273c7d66b7..86f4dd09d017 100644 --- a/components/brave_wallet/browser/zcash/zcash_serializer.cc +++ b/components/brave_wallet/browser/zcash/zcash_serializer.cc @@ -10,7 +10,7 @@ #include #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" @@ -94,14 +94,10 @@ std::array HashScriptPubKeys(const ZCashTransaction& tx) { std::array GetHashPersonalizer( const ZCashTransaction& tx) { std::array 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; } diff --git a/components/brave_wallet/browser/zcash/zcash_wallet_service.cc b/components/brave_wallet/browser/zcash/zcash_wallet_service.cc index fa84713ef4a0..36a837db43be 100644 --- a/components/brave_wallet/browser/zcash/zcash_wallet_service.cc +++ b/components/brave_wallet/browser/zcash/zcash_wallet_service.cc @@ -334,6 +334,7 @@ void ZCashWalletService::CompleteTransactionDone( result.error()); return; } + auto tx = ZCashSerializer::SerializeRawTransaction(result.value()); zcash_rpc_->SendTransaction( chain_id, tx,