fix: remove unwanted u64 length from raw Transaction bytes, it's RPC API specific

This commit is contained in:
Michael Vines
2019-02-02 10:00:20 -08:00
parent 5bb07e541d
commit 564d09fdfe
3 changed files with 12 additions and 19 deletions

View File

@ -431,8 +431,15 @@ export class Connection {
async sendRawTransaction(
rawTransaction: Buffer,
): Promise<TransactionSignature> {
// sendTransaction RPC API requires a u64 length field prepended to the raw
// Transaction bytes
const rpcTransaction = Buffer.alloc(8 + rawTransaction.length);
rpcTransaction.writeUInt32LE(rawTransaction.length, 0);
rawTransaction.copy(rpcTransaction, 8);
const unsafeRes = await this._rpcRequest('sendTransaction', [
[...rawTransaction],
[...rpcTransaction],
]);
const res = SendTransactionRpcResult(unsafeRes);
if (res.error) {