File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -195,6 +195,25 @@ func TestStatelessGet(t *testing.T) {
195
195
}
196
196
}
197
197
198
+ func TestStatelessComputeCommitmentEmptyRoot (t * testing.T ) {
199
+ root := & StatelessNode {}
200
+ root .ComputeCommitment ()
201
+ if ! Equal (root .hash , & FrZero ) {
202
+ t .Fatal ("invalid commitment for the empty root" )
203
+ }
204
+
205
+ root .depth = 10
206
+ root .hash = nil
207
+ defer func () {
208
+ if err := recover (); err == nil {
209
+ t .Fatal ("should have caught the computation of an invalid node" )
210
+ }
211
+ }()
212
+ root .ComputeCommitment ()
213
+
214
+ t .Fatal ("should have panicked before" )
215
+ }
216
+
198
217
func TestStatelessToDot (t * testing.T ) {
199
218
key1 , _ := hex .DecodeString ("0000100000000000000000000000000000000000000000000000000000000000" )
200
219
root := NewStateless ()
You can’t perform that action at this time.
0 commit comments