fix: Add Transaction method to parse from wire fmt; update Transaction.serialize

This commit is contained in:
Tyera Eulberg
2019-01-31 02:16:07 -07:00
committed by Michael Vines
parent ac6e503b35
commit 79bc47a631
3 changed files with 415 additions and 50 deletions

View File

@@ -3,8 +3,7 @@
export function decodeLength(bytes: Array<number>): number {
let len = 0;
let size = 0;
// eslint-disable-next-line no-constant-condition
while (true) {
for (;;) {
let elem = bytes.shift();
len |= (elem & 0x7f) << (size * 7);
size += 1;
@@ -17,8 +16,7 @@ export function decodeLength(bytes: Array<number>): number {
export function encodeLength(bytes: Array<number>, len: number) {
let rem_len = len;
// eslint-disable-next-line no-constant-condition
while (true) {
for (;;) {
let elem = rem_len & 0x7f;
rem_len >>= 7;
if (rem_len == 0) {