git ssb

0+

wanderer🌟 / js-primea-hypervisor



Commit a4b17a05ea3da61030c0dc36eb69c2b6922359b6

TestEnvironment: use Buffer to replace hex processing

Alex Beregszaszi committed on 8/18/2016, 12:18:59 AM
Parent: a0505132b8612ca530c2f3038001b9749a8507e3

Files changed

testEnvironment.jschanged
testEnvironment.jsView
@@ -42,9 +42,9 @@
4242 self.callValue = new U256(data.callValue)
4343 }
4444
4545 if (data.callData) {
46- self.callData = hexStr2arrayBuf(data.callData)
46+ self.callData = Uint8Array.from(new Buffer(data.callData, 'hex'))
4747 }
4848
4949 if (data.gasPrice) {
5050 self.gasPrice = data.gasPrice
@@ -54,18 +54,4 @@
5454 self.gasLimit = data.gasLimit
5555 }
5656 }
5757 }
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