Commit a4b17a05ea3da61030c0dc36eb69c2b6922359b6
TestEnvironment: use Buffer to replace hex processing
Alex Beregszaszi committed on 8/18/2016, 12:18:59 AMParent: a0505132b8612ca530c2f3038001b9749a8507e3
Files changed
testEnvironment.js | changed |
testEnvironment.js | ||
---|---|---|
@@ -42,9 +42,9 @@ | ||
42 | 42 | self.callValue = new U256(data.callValue) |
43 | 43 | } |
44 | 44 | |
45 | 45 | if (data.callData) { |
46 | - self.callData = hexStr2arrayBuf(data.callData) | |
46 | + self.callData = Uint8Array.from(new Buffer(data.callData, 'hex')) | |
47 | 47 | } |
48 | 48 | |
49 | 49 | if (data.gasPrice) { |
50 | 50 | self.gasPrice = data.gasPrice |
@@ -54,18 +54,4 @@ | ||
54 | 54 | self.gasLimit = data.gasLimit |
55 | 55 | } |
56 | 56 | } |
57 | 57 | } |
58 | - | |
59 | -function hexStr2arrayBuf (string) { | |
60 | - const view = new Uint8Array(string.length / 2) | |
61 | - string = [...string] | |
62 | - let temp = '' | |
63 | - string.forEach((el, i) => { | |
64 | - temp += el | |
65 | - if (i % 2) { | |
66 | - view[(i + 1) / 2 - 1] = parseInt(temp, 16) | |
67 | - temp = '' | |
68 | - } | |
69 | - }) | |
70 | - return view | |
71 | -} |
Built with git-ssb-web