@@ -88,6 +88,7 @@ func (js *jsre) adminBindings() {
88
88
debug .Set ("getBlockRlp" , js .getBlockRlp )
89
89
debug .Set ("setHead" , js .setHead )
90
90
debug .Set ("processBlock" , js .debugBlock )
91
+ debug .Set ("seedhash" , js .seedHash )
91
92
// undocumented temporary
92
93
debug .Set ("waitForBlocks" , js .waitForBlocks )
93
94
}
@@ -118,6 +119,27 @@ func (js *jsre) getBlock(call otto.FunctionCall) (*types.Block, error) {
118
119
return block , nil
119
120
}
120
121
122
+ func (js * jsre ) seedHash (call otto.FunctionCall ) otto.Value {
123
+ if len (call .ArgumentList ) > 0 {
124
+ if call .Argument (0 ).IsNumber () {
125
+ num , _ := call .Argument (0 ).ToInteger ()
126
+ hash , err := ethash .GetSeedHash (uint64 (num ))
127
+ if err != nil {
128
+ fmt .Println (err )
129
+ return otto .UndefinedValue ()
130
+ }
131
+ v , _ := call .Otto .ToValue (fmt .Sprintf ("0x%x" , hash ))
132
+ return v
133
+ } else {
134
+ fmt .Println ("arg not a number" )
135
+ }
136
+ } else {
137
+ fmt .Println ("requires number argument" )
138
+ }
139
+
140
+ return otto .UndefinedValue ()
141
+ }
142
+
121
143
func (js * jsre ) pendingTransactions (call otto.FunctionCall ) otto.Value {
122
144
txs := js .ethereum .TxPool ().GetTransactions ()
123
145
@@ -220,10 +242,11 @@ func (js *jsre) debugBlock(call otto.FunctionCall) otto.Value {
220
242
vm .Debug = true
221
243
_ , err = js .ethereum .BlockProcessor ().RetryProcess (block )
222
244
if err != nil {
223
- glog . Infoln (err )
245
+ fmt . Println (err )
224
246
}
225
247
vm .Debug = old
226
248
249
+ fmt .Println ("ok" )
227
250
return otto .UndefinedValue ()
228
251
}
229
252
0 commit comments